Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions forum/templatetags/display_forum_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ def display_post(
edited_diff = abs((post.modified - post.created).total_seconds())
current_user = context["request"].user
can_view_moderator_info = current_user.has_perm("tickets.can_moderate") or current_user.is_staff
post_delay_is_short = False
if show_moderator_info and can_view_moderator_info and post.created and post.author.date_joined:
post_delay_seconds = (post.created - post.author.date_joined).total_seconds()
post_delay_is_short = post_delay_seconds < 3600
return {
"post": post,
"highlighted_content": highlighted_content,
Expand All @@ -115,6 +119,7 @@ def display_post(
"show_report_actions": show_report_actions,
"show_moderator_info": show_moderator_info and can_view_moderator_info,
"show_post_edited": edited_diff is not None and edited_diff > 1,
"post_delay_is_short": post_delay_is_short,
"perms": context["perms"],
"request": context["request"],
}
1 change: 1 addition & 0 deletions templates/forum/display_post.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ <h6 class="ellipsis"><a href="{% url "account" post.author.username %}">{{ post.
<p class="text-grey no-margins">{{ post.author.profile.num_comments|bw_intcomma }} comment{{ post.author.profile.num_comments|pluralize }}</p>
<p class="text-grey no-margins">{{ post.author.profile.num_sound_downloads|bw_intcomma }} downloaded</p>
<p class="text-grey no-margins">Account age: {{ post.author.date_joined|timesince }} ago</p>
<p class="no-margins" {% if post_delay_is_short %}style="background: yellow; padding: 1px 4px;"{% endif %}>Posted {{ post.author.date_joined|timesince:post.created }} after account creation</p>
{% endif %}
</div>
</div>
Expand Down
Loading