File tree 3 files changed +16
-21
lines changed 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) {
287
287
}
288
288
289
289
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" )))
291
292
return
292
293
}
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 ()
295
295
}
Original file line number Diff line number Diff line change 20
20
</div>
21
21
</div>
22
22
<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>
33
30
</div>
34
31
</div>
35
32
Original file line number Diff line number Diff line change 99
99
{{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
100
100
<li class="follow">
101
101
{{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>
106
105
{{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>
111
109
{{end}}
112
110
</li>
113
111
{{end}}
You can’t perform that action at this time.
0 commit comments