{%- set fileAttachments = attachments|filter(a => not (a.mimeType starts with "image/" or a.mimeType starts with "video/")) -%} {%- set imageAttachments = attachments|filter(a => a.mimeType starts with "image/" or a.mimeType starts with "video/") -%} {%- set canReply = not post.deleted and not topic.isLocked and currentUser is not null and currentUser.hasPermission(permission("CREATE_OWN_POST")) -%} {%- set canEdit = not post.deleted and not topic.isLocked and currentUser is not null and ( ( postAuthor is not null and postAuthor.id == currentUser.id and postAuthor.hasPermission(permission("EDIT_OWN_POST")) ) or currentUser.hasPermission(permission("EDIT_OTHER_POST")) ) -%} {%- set canDelete = not post.deleted and currentUser is not null and ( ( postAuthor is not null and postAuthor.id == currentUser.id and postAuthor.hasPermission(permission("DELETE_OWN_POST")) ) or currentUser.hasPermission(permission("DELETE_OTHER_POST")) ) -%} {%- set canViewAttachments = currentUser is not null -%} {%- set your_are_the_author = currentUser is not null and postAuthor is not null and currentUser.id == postAuthor.id -%} {%- set is_op = topicAuthor is not null and postAuthor is not null and postAuthor.id == topicAuthor.id -%} {%- set hasOtherAttachments = (fileAttachments|length > 0) -%} {% if post.deleted %}
 {# #}{{ __("This post has been deleted") }}
{% else %} {% if not hide_pfp %} {% if postAuthor %} {% if hide_actions %} {{ __( {% else %} {{ __( {% endif %} {% else %}
{% endif %} {% endif %} {% if not hide_actions %}
{# #}{{ __( {%- if canReply -%} {%- endif -%} {%- if canEdit -%}
{# #}{# #}{# #}
{%- endif -%} {%- if canDelete -%}
{# #}{# #}{# #}
{%- endif -%}
{% endif %} {% if postAuthor %} {% if hide_actions %} {{ postAuthor.displayName }} {% else %} {{ postAuthor.displayName }} {% endif %} {% if your_are_the_author %} [{{ __("You") }}] {% endif %} {% if is_op %} {{ __( {% endif %} {% else %} {{ __("(deleted)") }} {% endif %}
{{ post.postDate.format("c") }} {% if post.edited %} {{ __("(edited)") }} {% endif %} {{ renderPost(post.content) }} {% if imageAttachments|length > 0 %}
{% for attachment in imageAttachments %} {% if hide_actions %} {% else %} {% if canViewAttachments %} {% else %} {% endif %} {% endif %} {% endfor %}
{% endif %} {% if hasOtherAttachments %} {% for attachment in fileAttachments %} {% if hide_actions %} {{ attachment.name }} {% else %} {% if not canViewAttachments %} {% endif %} {{ attachment.name }} {% endif %} {% endfor %} {% endif %} {% endif %}