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>
{{else}}
<form class="status-retweet" data-action="retweet" action="/retweet/{{.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="retweet" class="btn-link">
</form>
{{end}}
{{end}}
<a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list"> <a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list">
{{if and (not $.Ctx.AntiDopamineMode) .ReblogsCount}} {{if and (not $.Ctx.AntiDopamineMode) .ReblogsCount}}
({{DisplayInteractionCount .ReblogsCount}}) ({{DisplayInteractionCount .ReblogsCount}})
{{end}} {{end}}
</a> </a>
</div>
<div class="status-action">
{{if .Favourited}}
<form class="status-like" data-action="unlike" action="/unlike/{{.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="unlike" class="btn-link">
</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> </form>
{{end}} {{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"> <a class="status-like-count" href="/likedby/{{.ID}}" title="click to see the the list">
{{if and (not $.Ctx.AntiDopamineMode) .FavouritesCount}} {{if and (not $.Ctx.AntiDopamineMode) .FavouritesCount}}
({{DisplayInteractionCount .FavouritesCount}}) ({{DisplayInteractionCount .FavouritesCount}})
{{end}} {{end}}
</a> </a>
</form>
</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}}"