Simplify retweet/like form

This commit is contained in:
r 2020-10-19 06:05:22 +00:00
parent d7e0db7498
commit 2ee5c1709d
1 changed files with 16 additions and 30 deletions

View File

@ -187,45 +187,31 @@
retweet retweet
</a> </a>
{{else}} {{else}}
{{if .Reblogged}} {{$rt := "retweet"}} {{if .Reblogged}} {{$rt = "unretweet"}} {{end}}
<form class="status-retweet" data-action="unretweet" action="/unretweet/{{.ID}}" method="post" target="_self"> <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="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}"> <input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="unretweet" class="btn-link"> <input type="submit" value="{{$rt}}" class="btn-link">
</form> <a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list">
{{else}} {{if and (not $.Ctx.AntiDopamineMode) .ReblogsCount}}
<form class="status-retweet" data-action="retweet" action="/retweet/{{.ID}}" method="post" target="_self"> ({{DisplayInteractionCount .ReblogsCount}})
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}"> {{end}}
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}"> </a>
<input type="submit" value="retweet" class="btn-link">
</form> </form>
{{end}} {{end}}
{{end}}
<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>
</div> </div>
<div class="status-action"> <div class="status-action">
{{if .Favourited}} {{$like := "like"}} {{if .Favourited}} {{$like = "unlike"}} {{end}}
<form class="status-like" data-action="unlike" action="/unlike/{{.ID}}" method="post" target="_self"> <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="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}"> <input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="unlike" class="btn-link"> <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> </form>
{{else}}
<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">
</form>
{{end}}
<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>
</div> </div>
<div class="status-action status-action-last"> <div class="status-action status-action-last">
<a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}" <a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}"