From f490626b8a2ff360c4a914615484ea6e5bf8cdee Mon Sep 17 00:00:00 2001 From: Jonas Kohl Date: Sat, 19 Oct 2024 12:38:45 +0200 Subject: Add modern theme --- .../templates/modern/components/post.twig | 180 +++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 src/application/templates/modern/components/post.twig (limited to 'src/application/templates/modern/components/post.twig') diff --git a/src/application/templates/modern/components/post.twig b/src/application/templates/modern/components/post.twig new file mode 100644 index 0000000..5ceb46e --- /dev/null +++ b/src/application/templates/modern/components/post.twig @@ -0,0 +1,180 @@ +{%- 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 +-%} + +{% if post.deleted %} +