From b25e80bb1bae924f2eefd791f677f4d97903c2bd Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Tue, 24 Mar 2020 09:07:27 -0400 Subject: [PATCH] Show configured GitLab name on Account page This includes the chosen GitLab display name in the button text. --- account.go | 40 +++++++++++++++++++----------------- templates/user/settings.tmpl | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/account.go b/account.go index e6ddc7b..d32f503 100644 --- a/account.go +++ b/account.go @@ -1067,26 +1067,28 @@ func viewSettings(app *App, u *User, w http.ResponseWriter, r *http.Request) err obj := struct { *UserPage - Email string - HasPass bool - IsLogOut bool - Silenced bool - OauthSection bool - OauthAccounts []oauthAccountInfo - OauthSlack bool - OauthWriteAs bool - OauthGitLab bool + Email string + HasPass bool + IsLogOut bool + Silenced bool + OauthSection bool + OauthAccounts []oauthAccountInfo + OauthSlack bool + OauthWriteAs bool + OauthGitLab bool + GitLabDisplayName string }{ - UserPage: NewUserPage(app, r, u, "Account Settings", flashes), - Email: fullUser.EmailClear(app.keys), - HasPass: passIsSet, - IsLogOut: r.FormValue("logout") == "1", - Silenced: fullUser.IsSilenced(), - OauthSection: displayOauthSection, - OauthAccounts: oauthAccounts, - OauthSlack: enableOauthSlack, - OauthWriteAs: enableOauthWriteAs, - OauthGitLab: enableOauthGitLab, + UserPage: NewUserPage(app, r, u, "Account Settings", flashes), + Email: fullUser.EmailClear(app.keys), + HasPass: passIsSet, + IsLogOut: r.FormValue("logout") == "1", + Silenced: fullUser.IsSilenced(), + OauthSection: displayOauthSection, + OauthAccounts: oauthAccounts, + OauthSlack: enableOauthSlack, + OauthWriteAs: enableOauthWriteAs, + OauthGitLab: enableOauthGitLab, + GitLabDisplayName: config.OrDefaultString(app.Config().GitlabOauth.DisplayName, gitlabDisplayName), } showUserPage(w, "settings", obj) diff --git a/templates/user/settings.tmpl b/templates/user/settings.tmpl index 14f8e47..e4209d7 100644 --- a/templates/user/settings.tmpl +++ b/templates/user/settings.tmpl @@ -93,7 +93,7 @@ h3 { font-weight: normal; } Link your Write.as account. {{ end }} {{ if .OauthGitLab }} - Link your GitLab account. + Link your {{.GitLabDisplayName}} account {{ end }}

{{ end }}