Make "link-action" backend code respond correct JSON content (#26680)
Otherwise the `link-action` JS code couldn't parse the response. Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
af33a1187b
commit
e8b990999f
|
@ -480,5 +480,5 @@ func DeleteAvatar(ctx *context.Context) {
|
||||||
ctx.Flash.Error(err.Error())
|
ctx.Flash.Error(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Redirect(setting.AppSubURL + "/admin/users/" + strconv.FormatInt(u.ID, 10))
|
ctx.JSONRedirect(setting.AppSubURL + "/admin/users/" + strconv.FormatInt(u.ID, 10))
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ func SettingsDeleteAvatar(ctx *context.Context) {
|
||||||
ctx.Flash.Error(err.Error())
|
ctx.Flash.Error(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
ctx.JSONRedirect(ctx.Org.OrgLink + "/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SettingsDelete response for deleting an organization
|
// SettingsDelete response for deleting an organization
|
||||||
|
|
|
@ -72,5 +72,5 @@ func SettingsDeleteAvatar(ctx *context.Context) {
|
||||||
if err := repo_service.DeleteAvatar(ctx, ctx.Repo.Repository); err != nil {
|
if err := repo_service.DeleteAvatar(ctx, ctx.Repo.Repository); err != nil {
|
||||||
ctx.Flash.Error(fmt.Sprintf("DeleteAvatar: %v", err))
|
ctx.Flash.Error(fmt.Sprintf("DeleteAvatar: %v", err))
|
||||||
}
|
}
|
||||||
ctx.Redirect(ctx.Repo.RepoLink + "/settings")
|
ctx.JSONRedirect(ctx.Repo.RepoLink + "/settings")
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ func DeleteAvatar(ctx *context.Context) {
|
||||||
ctx.Flash.Error(err.Error())
|
ctx.Flash.Error(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/settings")
|
ctx.JSONRedirect(setting.AppSubURL + "/user/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Organization render all the organization of the user
|
// Organization render all the organization of the user
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
|
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
|
||||||
<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete" data-redirect="{{.Link}}">{{$.locale.Tr "settings.delete_current_avatar"}}</button>
|
<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{$.locale.Tr "settings.delete_current_avatar"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
|
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
|
||||||
<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete" data-redirect="{{.Link}}">{{$.locale.Tr "settings.delete_current_avatar"}}</button>
|
<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{$.locale.Tr "settings.delete_current_avatar"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
|
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
|
||||||
<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete" data-redirect="{{.Link}}">{{$.locale.Tr "settings.delete_current_avatar"}}</button>
|
<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{$.locale.Tr "settings.delete_current_avatar"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -126,7 +126,7 @@
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
|
<button class="ui green button">{{$.locale.Tr "settings.update_avatar"}}</button>
|
||||||
<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete" data-redirect="{{.Link}}">{{$.locale.Tr "settings.delete_current_avatar"}}</button>
|
<button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{$.locale.Tr "settings.delete_current_avatar"}}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue