blob: ac969c095d10ef744b0dfb7ad5b42db986965198 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
{%- 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.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 %}
<div class="media" id="post-{{ post.id }}">
<div class="media-left hidden-sm hidden-xs">
<div class="media-object" style="width:64px"></div>
</div>
<div class="media-body">
<div class="well icon-well text-warning">
<span class="fa fa-exclamation-triangle text-warning" aria-hidden="true"></span>
<em>{{ __("This post has been deleted") }}</em>
</div>
</div>
</div>
{% else %}
<div class="media" id="post-{{ post.id }}" data-text="{{ post.content }}" style="overflow: visible;">
{% if not hide_pfp %}
<div class="media-left hidden-sm hidden-xs">
{% if postAuthor %}
{% if hide_actions %}
<img class="media-object" alt="{{ __("Profile picture") }}" src="?_action=profilepicture&user={{ postAuthor.id|url_encode }}" width="64" height="64">
{% else %}
<a href="?_action=viewuser&user={{ postAuthor.id|url_encode }}">
<img class="media-object" alt="{{ __("Profile picture") }}" src="?_action=profilepicture&user={{ postAuthor.id|url_encode }}" width="64" height="64">
</a>
{% endif %}
{% else %}
<div class="media-object" style="width:64px;height:64px"></div>
{% endif %}
</div>
{% endif %}
<div class="media-body" style="overflow: visible;">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title h3">
{% if not hide_actions %}
<div class="pull-right">
<a href="#post-{{ post.id }}" class="btn btn-default"><span class="fa fa-link" aria-hidden="true"></span><span class="sr-only">{{ __("Permalink") }}</span></a>
{% if canReply %}
<button data-post-id="{{ post.id }}" class="btn btn-default js-only _reply-post"><span class="fa fa-comment" aria-hidden="true"></span><span class="sr-only">{{ __("Reply to post") }}</span></button>
{% endif %}
{% if canEdit %}
<button data-post-id="{{ post.id }}" class="btn btn-default js-only _edit-post"><span class="fa fa-pencil" aria-hidden="true"></span><span class="sr-only">{{ __("Edit post") }}</span></button>
{% endif %}
{% if canDelete %}
<form action="?_action=deletepost" method="post" class="seamless-inline">
<input type="hidden" name="post" value="{{ post.id }}">
<button type="submit" class="btn btn-danger"><span class="fa fa-trash" aria-hidden="true"></span><span class="sr-only">{{ __("Delete post") }}</span></button>
</form>
{% endif %}
</div>
{% endif %}
{% if postAuthor %}
{% if hide_actions %}
{{ postAuthor.displayName }}
{% else %}
<a href="?_action=viewuser&user={{ postAuthor.id|url_encode }}">{{ postAuthor.displayName }}</a>
{% if is_op %}
<span title="{{ __("Created this topic") }}" class="text-info fa fa-user-circle"></span>
{% endif %}
{% endif %}
{% if your_are_the_author %}
<span class="text-normal label label-primary">{{ __("You") }}</span>
{% endif %}
{% else %}
<em class="text-muted">{{ __("(deleted)") }}</em>
{% endif %}
</div>
<span class="_time">{{ post.postDate.format("c") }}</span>
{% if post.edited %}
<em class="text-muted">{{ __("(edited)") }}</em>
{% endif %}
</div>
<div class="panel-body">
<div class="post-content">{{ renderPost(post.content) }}</div>
{% if imageAttachments|length > 0 %}
<div class="post-images clearfix">
{% for attachment in imageAttachments %}
{% if hide_actions %}
<span class="image-attachment" title="{{ attachment.name }}">
<img class="image-attachment-image" src="?_action=thumb&attachment={{ attachment.id|url_encode }}" alt="" width="100">
</span>
{% else %}
<a class="
image-attachment
attachment
{{ attachment.mimeType starts with "video/" ? "video-attachment" }}
" href="?_action=attachment&attachment={{ attachment.id|url_encode }}" title="{{ attachment.name }}" data-attachment-id="{{ attachment.id }}">
<img class="image-attachment-image" src="?_action=thumb&attachment={{ attachment.id|url_encode }}" alt="" width="100">
{% if not canViewAttachments %}
<span class="attachment-lock fa fa-ban" aria-hidden="true"></span>
{% elseif attachment.mimeType starts with "video/" %}
<span class="video-player-icon fa fa-play-circle" aria-hidden="true"></span>
{% endif %}
</a>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
{% if fileAttachments|length > 0 %}
<div class="panel-footer">
<div class="btn-group">
{% for attachment in fileAttachments %}
{% if hide_actions %}
<button class="btn btn-default">{{ attachment.name }}</button>
{% else %}
<a class="btn btn-default attachment" href="?_action=attachment&attachment={{ attachment.id|url_encode }}">
{% if not canViewAttachments %}
<span class="fa fa-ban" aria-hidden="true"></span>
{% endif %}
{{ attachment.name }}
</a>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
|