From 9068c784c8af1c76f88f94ada1bf5ee21c3cd25b Mon Sep 17 00:00:00 2001 From: oGi4i Date: Fri, 17 Jun 2022 01:29:54 +0300 Subject: [PATCH 01/19] Use DisplayName() instead of FullName in Oauth provider (#19991) Use DisplayName() in Oauth as this provides a fallback if FullName is not set. Closes #19382 --- routers/web/auth/oauth.go | 2 +- routers/web/auth/oauth_test.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go index f64661596..d868b05a4 100644 --- a/routers/web/auth/oauth.go +++ b/routers/web/auth/oauth.go @@ -215,7 +215,7 @@ func newAccessTokenResponse(ctx stdContext.Context, grant *auth.OAuth2Grant, ser Nonce: grant.Nonce, } if grant.ScopeContains("profile") { - idToken.Name = user.FullName + idToken.Name = user.GetDisplayName() idToken.PreferredUsername = user.Name idToken.Profile = user.HTMLURL() idToken.Picture = user.AvatarLink() diff --git a/routers/web/auth/oauth_test.go b/routers/web/auth/oauth_test.go index 5a09a9510..57f2477db 100644 --- a/routers/web/auth/oauth_test.go +++ b/routers/web/auth/oauth_test.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/services/auth/source/oauth2" "github.com/golang-jwt/jwt/v4" @@ -64,6 +65,24 @@ func TestNewAccessTokenResponse_OIDCToken(t *testing.T) { assert.NoError(t, err) assert.Len(t, grants, 1) + // Scopes: openid profile email + oidcToken = createAndParseToken(t, grants[0]) + assert.Equal(t, user.Name, oidcToken.Name) + assert.Equal(t, user.Name, oidcToken.PreferredUsername) + assert.Equal(t, user.HTMLURL(), oidcToken.Profile) + assert.Equal(t, user.AvatarLink(), oidcToken.Picture) + assert.Equal(t, user.Website, oidcToken.Website) + assert.Equal(t, user.UpdatedUnix, oidcToken.UpdatedAt) + assert.Equal(t, user.Email, oidcToken.Email) + assert.Equal(t, user.IsActive, oidcToken.EmailVerified) + + // set DefaultShowFullName to true + oldDefaultShowFullName := setting.UI.DefaultShowFullName + setting.UI.DefaultShowFullName = true + defer func() { + setting.UI.DefaultShowFullName = oldDefaultShowFullName + }() + // Scopes: openid profile email oidcToken = createAndParseToken(t, grants[0]) assert.Equal(t, user.FullName, oidcToken.Name) From 1e05adfc3eeeeee04be48c683185886fa4b00dee Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 17 Jun 2022 12:52:06 +0800 Subject: [PATCH 02/19] Delete duplicated update btn on pull request view page (#19993) Fix #19987 --- templates/repo/issue/view_content/pull.tmpl | 40 +-------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index d2282f07f..5a23bfa33 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -283,7 +283,7 @@ {{end}} {{end}} - {{if (gt .Issue.PullRequest.CommitsBehind 0)}} + {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
@@ -481,44 +481,6 @@ {{end}} {{end}} - {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}} -
-
- {{svg "octicon-alert"}} - {{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}} -
-
- {{if and .UpdateAllowed .UpdateByRebaseAllowed }} -
-
- - - -
-
- {{end}} - {{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}} -
- {{.CsrfTokenHtml}} - -
- {{end}} -
-
- {{end}} - {{if $.StillCanManualMerge}}