forked from forgejo/forgejo
fix missing data on redirects (#3975)
This commit is contained in:
parent
6e39f3d422
commit
69bfd81b1c
6 changed files with 90 additions and 86 deletions
|
@ -22,12 +22,7 @@ func Applications(ctx *context.Context) {
|
|||
ctx.Data["Title"] = ctx.Tr("settings")
|
||||
ctx.Data["PageIsSettingsApplications"] = true
|
||||
|
||||
tokens, err := models.ListAccessTokens(ctx.User.ID)
|
||||
if err != nil {
|
||||
ctx.ServerError("ListAccessTokens", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Tokens"] = tokens
|
||||
loadApplicationsData(ctx)
|
||||
|
||||
ctx.HTML(200, tplSettingsApplications)
|
||||
}
|
||||
|
@ -38,12 +33,8 @@ func ApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm) {
|
|||
ctx.Data["PageIsSettingsApplications"] = true
|
||||
|
||||
if ctx.HasError() {
|
||||
tokens, err := models.ListAccessTokens(ctx.User.ID)
|
||||
if err != nil {
|
||||
ctx.ServerError("ListAccessTokens", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Tokens"] = tokens
|
||||
loadApplicationsData(ctx)
|
||||
|
||||
ctx.HTML(200, tplSettingsApplications)
|
||||
return
|
||||
}
|
||||
|
@ -75,3 +66,12 @@ func DeleteApplication(ctx *context.Context) {
|
|||
"redirect": setting.AppSubURL + "/user/settings/applications",
|
||||
})
|
||||
}
|
||||
|
||||
func loadApplicationsData(ctx *context.Context) {
|
||||
tokens, err := models.ListAccessTokens(ctx.User.ID)
|
||||
if err != nil {
|
||||
ctx.ServerError("ListAccessTokens", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Tokens"] = tokens
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue