aboutsummaryrefslogtreecommitdiff
path: root/templates/status.tmpl
blob: 6071b2fc803b220a0a966d16bd13ca443c611c92 (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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
{{with .Data}}
<div id="status-{{.ID}}" class="status-container-container">
	{{if .Reblog}}
	<div class="retweet-info">
		<a class="img-link" href="/user/{{.Account.ID}}">
			<img class="status-profile-img" src="{{.Account.AvatarStatic}}" title="@{{.Account.Acct}}" alt="avatar" height="24" />
		</a>
		<bdi class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </bdi>  
		<a href="/user/{{.Account.ID}}"> 
			<span class="status-uname"> @{{.Account.Acct}} </span> 
		</a>
		retweeted
	</div>
	{{template "status" (WithContext .Reblog $.Ctx)}}
	{{else}}
	{{block "status" (WithContext . $.Ctx)}}
	{{with $s := .Data}}
	<div class="status-container status-{{.ID}}" data-id="{{.ID}}">
		<div class="status-profile-img-container">
			<a class="img-link" href="/user/{{.Account.ID}}">
				<img class="status-profile-img" src="{{.Account.AvatarStatic}}" title="@{{.Account.Acct}}" alt="avatar" height="48" />
			</a>
		</div>
		<div class="status"> 
			<div class="status-name">
				<bdi class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </bdi> 
				<a href="/user/{{.Account.ID}}">
					<span class="status-uname"> @{{.Account.Acct}} </span>
				</a>
				<div class="more-container">
					<div class="remote-link">
						{{if .IDNumbers}}#{{index .IDNumbers .ID}}{{end}} {{.Visibility}}
					</div>
					<div class="more-content">
						<a class="more-link" href="{{.URL}}" target="_blank">
							source
						</a>
						{{if .Muted}}
						<form action="/unmuteconv/{{.ID}}" method="post" target="_self">
							<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
							<input type="submit" value="unmute" class="btn-link more-link">
						</form>
						{{else}}
						<form action="/muteconv/{{.ID}}" method="post" target="_self">
							<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
							<input type="submit" value="mute" class="btn-link more-link">
						</form>
						{{end}}
						{{if .Bookmarked}}
						<form action="/unbookmark/{{.ID}}" method="post" target="_self">
							<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
							<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
							<input type="submit" value="unbookmark" class="btn-link more-link">
						</form>
						{{else}}
						<form action="/bookmark/{{.ID}}" method="post" target="_self">
							<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
							<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
							<input type="submit" value="bookmark" class="btn-link more-link">
						</form>
						{{end}}
						{{if eq $.Ctx.UserID .Account.ID}}
						<form action="/delete/{{.ID}}" method="post" target="_self">
							<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
							<input type="submit" value="delete" class="btn-link more-link">
						</form>
						{{end}}
					</div>
				</div>
			</div>
			<div class="status-reply-container">
				{{if .InReplyToID}}
				<a class="status-reply-to-link" href="{{if not .ShowReplies}}/thread/{{.InReplyToID}}{{end}}#status-{{.InReplyToID}}"> 
					 in reply to {{if .IDNumbers}}#{{index .IDNumbers .InReplyToID}}{{end}} {{if .Pleroma.InReplyToAccountAcct}}@{{.Pleroma.InReplyToAccountAcct}}{{else if not .IDNumbers}}{{.InReplyToID}}{{end}}
				</a>
				{{if index .IDReplies .ID}} <span class="status-reply-info-divider"> - </span> {{end}}
				{{end}}
				{{if .ShowReplies}}
				{{if index .IDReplies .ID}} <span class="status-reply-text"> replies: </span> {{end}}
				{{range index .IDReplies .ID}}
				<a class="status-reply-link" href="#status-{{.ID}}">#{{.Number}}</a>
				{{end}}
				{{end}}
			</div>
			{{if .Content}}
			<div class="status-content"> {{StatusContentFilter .SpoilerText .Content .Emojis .Mentions}} </div>
			{{end}}
			{{if .MediaAttachments}}
			<div class="status-media-container">
				{{range .MediaAttachments}}

				{{if eq .Type "image"}}
				{{if $.Ctx.HideAttachments}}
				<a href="{{.URL}}" target="_blank" title="{{.Description}}"> [image] </a>
				{{else}}
				<a class="img-link" href="{{.URL}}" target="_blank" title="{{.Description}}">
					<img class="status-image" src="{{.URL}}" alt="status-image" height="240" />
					{{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
					<div class="status-nsfw-overlay"></div>
					{{end}}
				</a>
				{{end}}

				{{else if eq .Type "audio"}}
				{{if $.Ctx.HideAttachments}}
				<a href="{{.URL}}" target="_blank" title="{{.Description}}"> [audio] </a>
				{{else}}
				<audio class="status-audio" controls title="{{.Description}}">
					<source src="{{.URL}}">
					<a href="{{.URL}}" target="_blank"> [audio] </a>
				</audio>
				{{end}}

				{{else if eq .Type "video"}}
				{{if $.Ctx.HideAttachments}}
				<a href="{{.URL}}" target="_blank" title="{{.Description}}"> [video] </a>
				{{else}}
				<div class="status-video-container" title="{{.Description}}">
					<video class="status-video" controls height="240">
						<source src="{{.URL}}">
						<a href="{{.URL}}" target="_blank"> [video] </a>
					</video>
					{{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
					<div class="status-nsfw-overlay"></div>
					{{end}}
				</div>
				{{end}}

				{{else}}
				<a href="{{.URL}}" target="_blank" title="{{.Description}}"> [attachment] </a>
				{{end}}
				{{end}}
			</div>
			{{end}}
			{{if .Poll}}
			<form class="poll-form" action="/vote/{{.Poll.ID}}" method="POST" target="_self">
				<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
				<input type="hidden" name="status_id" value="{{$s.ID}}">
				{{range $i, $o := .Poll.Options}}
				<div class="poll-option">
					{{if (or $s.Poll.Expired $s.Poll.Voted)}}
					<div> {{$o.Title}} - {{$o.VotesCount}} votes </div>
					{{else}}
					<input type="{{if $s.Poll.Multiple}}checkbox{{else}}radio{{end}}" name="choices" 
						id="poll-{{$s.ID}}-{{$i}}" value="{{$i}}">
					<label for="poll-{{$s.ID}}-{{$i}}"> 
						{{$o.Title}} 
					</label>
					{{end}}
				</div>
				{{end}}
				{{if not (or .Poll.Expired .Poll.Voted)}}
				<button type="submit"> Vote </button>
				{{end}}
				<div class="poll-info">
					<span>{{.Poll.VotesCount}} votes</span>
					{{if .Poll.Expired}}
					<span> - poll expired </span>
					{{else if .Poll.ExpiresAt}}
					<span>
						- poll ends in
						<time datetime="{{FormatTimeRFC3339 .Poll.ExpiresAt}}" title="{{FormatTimeRFC822 .Poll.ExpiresAt}}"> 
							{{TimeUntil .Poll.ExpiresAt}} 
						</time> 
					</span>
					{{end}}
				</div>
			</form>
			{{end}}
			<div class="status-action-container"> 
				<div class="status-action">
					<a href="/thread/{{.ID}}?reply=true#status-{{.ID}}"> 
						reply
					</a>
					<a class="status-reply-count" href="/thread/{{.ID}}#status-{{.ID}}" {{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}>
						{{if and (not $.Ctx.AntiDopamineMode) .RepliesCount}}
							({{DisplayInteractionCount .RepliesCount}})
						{{end}}
					</a>
				</div>
				<div class="status-action">
					{{if or (eq .Visibility "private") (eq .Visibility "direct")}}
					<a class="status-retweet" href="" title="this status cannot be retweeted"> 
						retweet
					</a>
					{{else}}
					{{$rt := "retweet"}} {{if .Reblogged}} {{$rt = "unretweet"}} {{end}}
					<form class="status-retweet" data-action="{{$rt}}" action="/{{$rt}}/{{.ID}}" method="post" target="_self">
						<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
						<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
						<input type="submit" value="{{$rt}}" class="btn-link">
						<a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list"> 
							{{if and (not $.Ctx.AntiDopamineMode) .ReblogsCount}}
								({{DisplayInteractionCount .ReblogsCount}})
							{{end}}
						</a>
					</form>
					{{end}}
				</div>
				<div class="status-action">
					{{$like := "like"}} {{if .Favourited}} {{$like = "unlike"}} {{end}}
					<form class="status-like" data-action="{{$like}}" action="/{{$like}}/{{.ID}}" method="post" target="_self">
						<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
						<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
						<input type="submit" value="{{$like}}" class="btn-link">
						<a class="status-like-count" href="/likedby/{{.ID}}" title="click to see the the list"> 
							{{if and (not $.Ctx.AntiDopamineMode) .FavouritesCount}}
								({{DisplayInteractionCount .FavouritesCount}})
							{{end}}
						</a>
					</form>
				</div>
				<div class="status-action status-action-last">
					<a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}"
						{{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}> 
						<time datetime="{{FormatTimeRFC3339 .CreatedAt}}" title="{{FormatTimeRFC822 .CreatedAt}}"> 
							{{TimeSince .CreatedAt}}
						</time> 
					</a>
				</div>
			</div>
		</div>
	</div>
	{{end}}
	{{end}}
	{{end}}
</div>
{{end}}