File tree Expand file tree Collapse file tree 3 files changed +16
-21
lines changed Expand file tree Collapse file tree 3 files changed +16
-21
lines changed Original file line number Diff line number Diff line change @@ -287,9 +287,9 @@ func Action(ctx *context.Context) {
287287 }
288288
289289 if err != nil {
290- ctx .ServerError (fmt .Sprintf ("Action (%s)" , ctx .FormString ("action" )), err )
290+ log .Error ("Failed to apply action %q: %v" , ctx .FormString ("action" ), err )
291+ ctx .JSONError (fmt .Sprintf ("Action %q failed" , ctx .FormString ("action" )))
291292 return
292293 }
293- // FIXME: We should check this URL and make sure that it's a valid Gitea URL
294- ctx .RedirectToFirst (ctx .FormString ("redirect_to" ), ctx .ContextUser .HomeLink ())
294+ ctx .JSONOK ()
295295}
Original file line number Diff line number Diff line change 2020 </div>
2121 </div>
2222 <div class="right menu">
23- <form method="post" action="{{.Link}}?action={{if $.IsFollowing}}unfollow{{else}}follow{{end}}&redirect_to={{$.Link}}">
24- {{$.CsrfTokenHtml}}
25- <button type="submit" class="ui basic button gt-mr-0">
26- {{if $.IsFollowing}}
27- {{.locale.Tr "user.unfollow"}}
28- {{else}}
29- {{.locale.Tr "user.follow"}}
30- {{end}}
31- </button>
32- </form>
23+ <button class="link-action ui basic button gt-mr-0" data-url="{{.Org.HomeLink}}?action={{if $.IsFollowing}}unfollow{{else}}follow{{end}}">
24+ {{if $.IsFollowing}}
25+ {{.locale.Tr "user.unfollow"}}
26+ {{else}}
27+ {{.locale.Tr "user.follow"}}
28+ {{end}}
29+ </button>
3330 </div>
3431 </div>
3532
Original file line number Diff line number Diff line change 9999 {{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
100100 <li class="follow">
101101 {{if $.IsFollowing}}
102- <form method="post" action="{{.ContextUser.HomeLink}}?action=unfollow&redirect_to={{$.Link}}">
103- {{$.CsrfTokenHtml}}
104- <button type="submit" class="ui basic red button">{{svg "octicon-person"}} {{.locale.Tr "user.unfollow"}}</button>
105- </form>
102+ <button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unfollow">
103+ {{svg "octicon-person"}} {{.locale.Tr "user.unfollow"}}
104+ </button>
106105 {{else}}
107- <form method="post" action="{{.ContextUser.HomeLink}}?action=follow&redirect_to={{$.Link}}">
108- {{$.CsrfTokenHtml}}
109- <button type="submit" class="ui basic green button">{{svg "octicon-person"}} {{.locale.Tr "user.follow"}}</button>
110- </form>
106+ <button class="ui basic green button link-action" data-url="{{.ContextUser.HomeLink}}?action=follow">
107+ {{svg "octicon-person"}} {{.locale.Tr "user.follow"}}
108+ </button>
111109 {{end}}
112110 </li>
113111 {{end}}
You can’t perform that action at this time.
0 commit comments