From 9035b400a6b07b0206e3b90903236b6999a4bfae Mon Sep 17 00:00:00 2001 From: Beowulf Date: Thu, 25 Apr 2024 00:19:28 +0200 Subject: [PATCH 01/81] UI: use full screen height for displaying pdf files --- release-notes/8.0.0/feat/3434.md | 1 + web_src/css/repo.css | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 release-notes/8.0.0/feat/3434.md diff --git a/release-notes/8.0.0/feat/3434.md b/release-notes/8.0.0/feat/3434.md new file mode 100644 index 0000000000..a8b28eb1c3 --- /dev/null +++ b/release-notes/8.0.0/feat/3434.md @@ -0,0 +1 @@ +When PDFs are displayed in the repository, the [full height of the screen](https://codeberg.org/forgejo/forgejo/pulls/3434) is now used instead of a predefined fixed height diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 87dbeb5bba..d443ee0575 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -402,7 +402,7 @@ td .commit-summary { .pdf-content { width: 100%; - height: 600px; + height: 100vh; border: none !important; display: flex; align-items: center; From 01d9faefa5cf76c8ddbab6156547d615d5c5b8b3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 27 Apr 2024 00:07:16 +0000 Subject: [PATCH 02/81] Update module connectrpc.com/connect to v1.16.1 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2f4c64b2da..2492285502 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( code.gitea.io/gitea-vet v0.2.3 code.gitea.io/sdk/gitea v0.17.1 codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570 - connectrpc.com/connect v1.15.0 + connectrpc.com/connect v1.16.1 gitea.com/go-chi/binding v0.0.0-20230415142243-04b515c6d669 gitea.com/go-chi/cache v0.2.0 gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098 diff --git a/go.sum b/go.sum index ce55e89399..3ada0845c4 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,8 @@ code.gitea.io/sdk/gitea v0.17.1 h1:3jCPOG2ojbl8AcfaUCRYLT5MUcBMFwS0OSK2mA5Zok8= code.gitea.io/sdk/gitea v0.17.1/go.mod h1:aCnBqhHpoEWA180gMbaCtdX9Pl6BWBAuuP2miadoTNM= codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570 h1:TXbikPqa7YRtfU9vS6QJBg77pUvbEb6StRdZO8t1bEY= codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570/go.mod h1:IIAjsijsd8q1isWX8MACefDEgTQslQ4stk2AeeTt3kM= -connectrpc.com/connect v1.15.0 h1:lFdeCbZrVVDydAqwr4xGV2y+ULn+0Z73s5JBj2LikWo= -connectrpc.com/connect v1.15.0/go.mod h1:bQmjpDY8xItMnttnurVgOkHUBMRT9cpsNi2O4AjKhmA= +connectrpc.com/connect v1.16.1 h1:rOdrK/RTI/7TVnn3JsVxt3n028MlTRwmK5Q4heSpjis= +connectrpc.com/connect v1.16.1/go.mod h1:XpZAduBQUySsb4/KO5JffORVkDI4B6/EYPi7N8xpNZw= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= From 162b8401008b9a9a111a32187a20f494858ab84b Mon Sep 17 00:00:00 2001 From: Beowulf Date: Sun, 28 Apr 2024 00:33:03 +0200 Subject: [PATCH 03/81] Add inline attachments to comments If incoming email is configured and an email is sent, inline attachments are currently not added to the comment if it has the `Content-Disposition: inline` instead of `Content-Disposition: attachment` as e.g. with Apple Mail. This adds inline attachments (`Content-Disposition: inline`) that have a filename as attachment to the comment. Fixes #3496 --- services/mailer/incoming/incoming.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/mailer/incoming/incoming.go b/services/mailer/incoming/incoming.go index eade0cf271..a2352773ae 100644 --- a/services/mailer/incoming/incoming.go +++ b/services/mailer/incoming/incoming.go @@ -367,6 +367,14 @@ func getContentFromMailReader(env *enmime.Envelope) *MailContent { Content: attachment.Content, }) } + for _, inline := range env.Inlines { + if inline.FileName != "" { + attachments = append(attachments, &Attachment{ + Name: inline.FileName, + Content: inline.Content, + }) + } + } return &MailContent{ Content: reply.FromText(env.Text), From 95f8b1bbc59ce92322730c2a81b01f6155643c5c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 28 Apr 2024 00:05:53 +0000 Subject: [PATCH 04/81] Update module github.com/urfave/cli/v2 to v2.27.2 --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index f32e871921..a7ca6c202c 100644 --- a/go.mod +++ b/go.mod @@ -92,7 +92,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.0 github.com/ulikunitz/xz v0.5.11 - github.com/urfave/cli/v2 v2.27.1 + github.com/urfave/cli/v2 v2.27.2 github.com/xanzy/go-gitlab v0.96.0 github.com/yohcop/openid-go v1.0.1 github.com/yuin/goldmark v1.7.0 @@ -161,7 +161,7 @@ require ( github.com/couchbase/go-couchbase v0.1.1 // indirect github.com/couchbase/gomemcached v0.3.0 // indirect github.com/couchbase/goutils v0.1.2 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davidmz/go-pageant v1.0.2 // indirect @@ -269,7 +269,7 @@ require ( github.com/x448/float16 v0.8.4 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect - github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect + github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect github.com/zeebo/blake3 v0.2.3 // indirect go.etcd.io/bbolt v1.3.9 // indirect go.mongodb.org/mongo-driver v1.13.1 // indirect diff --git a/go.sum b/go.sum index 95e400e40e..79d348cec5 100644 --- a/go.sum +++ b/go.sum @@ -203,8 +203,8 @@ github.com/couchbase/gomemcached v0.3.0 h1:XkMDdP6w7rtvLijDE0/RhcccX+XvAk5cboyBv github.com/couchbase/gomemcached v0.3.0/go.mod h1:mxliKQxOv84gQ0bJWbI+w9Wxdpt9HjDvgW9MjCym5Vo= github.com/couchbase/goutils v0.1.2 h1:gWr8B6XNWPIhfalHNog3qQKfGiYyh4K4VhO3P2o9BCs= github.com/couchbase/goutils v0.1.2/go.mod h1:h89Ek/tiOxxqjz30nPPlwZdQbdB8BwgnuBxeoUe/ViE= -github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= @@ -800,8 +800,8 @@ github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs= github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= -github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= -github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI= +github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.37.1-0.20220607072126-8a320890c08d/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= @@ -823,8 +823,8 @@ github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgk github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= -github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e h1:+SOyEddqYF09QP7vr7CgJ1eti3pY9Fn3LHO1M1r/0sI= -github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw= +github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk= github.com/yardenshoham/feeds v0.0.0-20240110072658-f3d0c21c0bd5 h1:3seWKGVhGoc66Ht5QlhQsr4xT2caDnFegsnh2NqvENU= github.com/yardenshoham/feeds v0.0.0-20240110072658-f3d0c21c0bd5/go.mod h1:WMib8uJP3BbY+X8Szd1rA5Pzhdfh+HCCAYT2z7Fza6Y= github.com/yohcop/openid-go v1.0.1 h1:DPRd3iPO5F6O5zX2e62XpVAbPT6wV51cuucH0z9g3js= From b796694cd5df688105b490edd43aa923743b3113 Mon Sep 17 00:00:00 2001 From: Beowulf Date: Sun, 28 Apr 2024 14:11:17 +0200 Subject: [PATCH 05/81] Skip already handled incoming emails It seems like (at least on my machine) that every mail is processed twice. Added a check if the email is already handled and if so, skip it. --- services/mailer/incoming/incoming.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/mailer/incoming/incoming.go b/services/mailer/incoming/incoming.go index a2352773ae..555cdfee8b 100644 --- a/services/mailer/incoming/incoming.go +++ b/services/mailer/incoming/incoming.go @@ -219,6 +219,11 @@ loop: } err := func() error { + if handledSet.Contains(msg.SeqNum) { + log.Debug("Skipping already handled message") + return nil + } + r := msg.GetBody(section) if r == nil { return fmt.Errorf("could not get body from message: %w", err) From 2ec0c5e28454413856a6de48d197fa29170dd79b Mon Sep 17 00:00:00 2001 From: Cheng <36215014+ChengenH@users.noreply.github.com> Date: Mon, 22 Apr 2024 03:44:03 +0800 Subject: [PATCH 06/81] chore: use errors.New to replace fmt.Errorf with no parameters will much better (#30621) use errors.New to replace fmt.Errorf with no parameters will much better (cherry picked from commit 9de443ced2c328d9b58a5e144a765f402aab859d) --- cmd/admin_auth.go | 3 ++- cmd/admin_auth_oauth.go | 3 ++- cmd/admin_auth_stmp.go | 3 +-- cmd/admin_user_delete.go | 3 ++- cmd/admin_user_generate_access_token.go | 5 +++-- cmd/embedded.go | 6 +++--- cmd/manager_logging.go | 3 ++- models/auth/oauth2.go | 3 ++- models/git/lfs_lock.go | 4 ++-- models/repo_transfer.go | 3 ++- 10 files changed, 21 insertions(+), 15 deletions(-) diff --git a/cmd/admin_auth.go b/cmd/admin_auth.go index ec92e342d4..4777a92908 100644 --- a/cmd/admin_auth.go +++ b/cmd/admin_auth.go @@ -4,6 +4,7 @@ package cmd import ( + "errors" "fmt" "os" "text/tabwriter" @@ -91,7 +92,7 @@ func runListAuth(c *cli.Context) error { func runDeleteAuth(c *cli.Context) error { if !c.IsSet("id") { - return fmt.Errorf("--id flag is missing") + return errors.New("--id flag is missing") } ctx, cancel := installSignals() diff --git a/cmd/admin_auth_oauth.go b/cmd/admin_auth_oauth.go index c151c0af27..8e6239ac33 100644 --- a/cmd/admin_auth_oauth.go +++ b/cmd/admin_auth_oauth.go @@ -4,6 +4,7 @@ package cmd import ( + "errors" "fmt" "net/url" @@ -193,7 +194,7 @@ func runAddOauth(c *cli.Context) error { func runUpdateOauth(c *cli.Context) error { if !c.IsSet("id") { - return fmt.Errorf("--id flag is missing") + return errors.New("--id flag is missing") } ctx, cancel := installSignals() diff --git a/cmd/admin_auth_stmp.go b/cmd/admin_auth_stmp.go index 58a6e2ac22..d724746905 100644 --- a/cmd/admin_auth_stmp.go +++ b/cmd/admin_auth_stmp.go @@ -5,7 +5,6 @@ package cmd import ( "errors" - "fmt" "strings" auth_model "code.gitea.io/gitea/models/auth" @@ -166,7 +165,7 @@ func runAddSMTP(c *cli.Context) error { func runUpdateSMTP(c *cli.Context) error { if !c.IsSet("id") { - return fmt.Errorf("--id flag is missing") + return errors.New("--id flag is missing") } ctx, cancel := installSignals() diff --git a/cmd/admin_user_delete.go b/cmd/admin_user_delete.go index 1cbc6f7527..520557554a 100644 --- a/cmd/admin_user_delete.go +++ b/cmd/admin_user_delete.go @@ -4,6 +4,7 @@ package cmd import ( + "errors" "fmt" "strings" @@ -42,7 +43,7 @@ var microcmdUserDelete = &cli.Command{ func runDeleteUser(c *cli.Context) error { if !c.IsSet("id") && !c.IsSet("username") && !c.IsSet("email") { - return fmt.Errorf("You must provide the id, username or email of a user to delete") + return errors.New("You must provide the id, username or email of a user to delete") } ctx, cancel := installSignals() diff --git a/cmd/admin_user_generate_access_token.go b/cmd/admin_user_generate_access_token.go index 6e78939680..6c2c10494e 100644 --- a/cmd/admin_user_generate_access_token.go +++ b/cmd/admin_user_generate_access_token.go @@ -4,6 +4,7 @@ package cmd import ( + "errors" "fmt" auth_model "code.gitea.io/gitea/models/auth" @@ -42,7 +43,7 @@ var microcmdUserGenerateAccessToken = &cli.Command{ func runGenerateAccessToken(c *cli.Context) error { if !c.IsSet("username") { - return fmt.Errorf("You must provide a username to generate a token for") + return errors.New("You must provide a username to generate a token for") } ctx, cancel := installSignals() @@ -68,7 +69,7 @@ func runGenerateAccessToken(c *cli.Context) error { return err } if exist { - return fmt.Errorf("access token name has been used already") + return errors.New("access token name has been used already") } // make sure the scopes are valid diff --git a/cmd/embedded.go b/cmd/embedded.go index 71d483d11c..9f03f7be7c 100644 --- a/cmd/embedded.go +++ b/cmd/embedded.go @@ -157,9 +157,9 @@ func runViewDo(c *cli.Context) error { } if len(matchedAssetFiles) == 0 { - return fmt.Errorf("no files matched the given pattern") + return errors.New("no files matched the given pattern") } else if len(matchedAssetFiles) > 1 { - return fmt.Errorf("too many files matched the given pattern, try to be more specific") + return errors.New("too many files matched the given pattern, try to be more specific") } data, err := matchedAssetFiles[0].fs.ReadFile(matchedAssetFiles[0].name) @@ -180,7 +180,7 @@ func runExtractDo(c *cli.Context) error { } if c.NArg() == 0 { - return fmt.Errorf("a list of pattern of files to extract is mandatory (e.g. '**' for all)") + return errors.New("a list of pattern of files to extract is mandatory (e.g. '**' for all)") } destdir := "." diff --git a/cmd/manager_logging.go b/cmd/manager_logging.go index 2c701f2672..6049b00d5e 100644 --- a/cmd/manager_logging.go +++ b/cmd/manager_logging.go @@ -4,6 +4,7 @@ package cmd import ( + "errors" "fmt" "os" @@ -249,7 +250,7 @@ func runAddFileLogger(c *cli.Context) error { if c.IsSet("filename") { vals["filename"] = c.String("filename") } else { - return fmt.Errorf("filename must be set when creating a file logger") + return errors.New("filename must be set when creating a file logger") } if c.IsSet("rotate") { vals["rotate"] = c.Bool("rotate") diff --git a/models/auth/oauth2.go b/models/auth/oauth2.go index 5eabc7d9b4..125d64b36f 100644 --- a/models/auth/oauth2.go +++ b/models/auth/oauth2.go @@ -8,6 +8,7 @@ import ( "crypto/sha256" "encoding/base32" "encoding/base64" + "errors" "fmt" "net" "net/url" @@ -301,7 +302,7 @@ func UpdateOAuth2Application(ctx context.Context, opts UpdateOAuth2ApplicationOp return nil, err } if app.UID != opts.UserID { - return nil, fmt.Errorf("UID mismatch") + return nil, errors.New("UID mismatch") } builtinApps := BuiltinApplications() if _, builtin := builtinApps[app.ClientID]; builtin { diff --git a/models/git/lfs_lock.go b/models/git/lfs_lock.go index 261c73032a..2f65833fe3 100644 --- a/models/git/lfs_lock.go +++ b/models/git/lfs_lock.go @@ -5,7 +5,7 @@ package git import ( "context" - "fmt" + "errors" "strings" "time" @@ -148,7 +148,7 @@ func DeleteLFSLockByID(ctx context.Context, id int64, repo *repo_model.Repositor } if !force && u.ID != lock.OwnerID { - return nil, fmt.Errorf("user doesn't own lock and force flag is not set") + return nil, errors.New("user doesn't own lock and force flag is not set") } if _, err := db.GetEngine(dbCtx).ID(id).Delete(new(LFSLock)); err != nil { diff --git a/models/repo_transfer.go b/models/repo_transfer.go index f20c5bcdc0..0c23d759f9 100644 --- a/models/repo_transfer.go +++ b/models/repo_transfer.go @@ -5,6 +5,7 @@ package models import ( "context" + "errors" "fmt" "code.gitea.io/gitea/models/db" @@ -120,7 +121,7 @@ func DeleteRepositoryTransfer(ctx context.Context, repoID int64) error { func TestRepositoryReadyForTransfer(status repo_model.RepositoryStatus) error { switch status { case repo_model.RepositoryBeingMigrated: - return fmt.Errorf("repo is not ready, currently migrating") + return errors.New("repo is not ready, currently migrating") case repo_model.RepositoryPendingTransfer: return ErrRepoTransferInProgress{} } From e64e8d24ace06910aab574eb073b429f3717cc0a Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 21 Apr 2024 22:24:56 +0200 Subject: [PATCH 07/81] Fix flash on dashboard (#30572) Fixes https://github.com/go-gitea/gitea/issues/30566, regression from https://github.com/go-gitea/gitea/pull/30214. (cherry picked from commit 1b1b8500aea0a17e999093e65b573ce54ae080ae) Conflicts: web_src/css/base.css the conflict is because https://codeberg.org/forgejo/forgejo/pulls/3350 skipped Remove fomantic menu module (gitea#30325) and it was not ported. --- templates/user/dashboard/dashboard.tmpl | 2 +- web_src/css/base.css | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/user/dashboard/dashboard.tmpl b/templates/user/dashboard/dashboard.tmpl index 030fd49940..415423d436 100644 --- a/templates/user/dashboard/dashboard.tmpl +++ b/templates/user/dashboard/dashboard.tmpl @@ -1,8 +1,8 @@ {{template "base/head" .}}
{{template "user/dashboard/navbar" .}} + {{template "base/alert" .}}
- {{template "base/alert" .}}
{{template "user/heatmap" .}} {{template "user/dashboard/feeds" .}} diff --git a/web_src/css/base.css b/web_src/css/base.css index c571280ee0..ce0b0f569a 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -636,6 +636,12 @@ img.ui.avatar, background: var(--color-active); } +/* add horizontal margin to elements that are outside top-level of .flex-container or .ui.container */ +.page-content > .flash-message { + margin-left: var(--page-margin-x); + margin-right: var(--page-margin-x); +} + .ui.form .fields.error .field textarea, .ui.form .fields.error .field select, .ui.form .fields.error .field input:not([type]), From 4e2de8bdc62b3bb8c0a63358573985ec2ab87b5e Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 22 Apr 2024 06:19:59 +0800 Subject: [PATCH 08/81] fix(api): refactor branch and tag existence checks (#30618) - Update branch existence check to also include tag existence check - Adjust error message for branch/tag existence check ref: https://github.com/go-gitea/gitea/pull/30349 --------- Signed-off-by: appleboy Co-authored-by: wxiaoguang Co-authored-by: Giteabot (cherry picked from commit 6459c50278906893f3cbc2bf3e52eff65e739b37) --- routers/api/v1/repo/pull.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index eec3c49bc4..e982b5a450 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -1079,11 +1079,10 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption) } ctx.Repo.PullRequest.SameRepo = isSameRepo - log.Info("Base branch: %s", baseBranch) - log.Info("Repo path: %s", ctx.Repo.GitRepo.Path) + log.Trace("Repo path: %q, base branch: %q, head branch: %q", ctx.Repo.GitRepo.Path, baseBranch, headBranch) // Check if base branch is valid. - if !ctx.Repo.GitRepo.IsBranchExist(baseBranch) { - ctx.NotFound("IsBranchExist") + if !ctx.Repo.GitRepo.IsBranchExist(baseBranch) && !ctx.Repo.GitRepo.IsTagExist(baseBranch) { + ctx.NotFound("BaseNotExist") return nil, nil, nil, nil, "", "" } @@ -1146,7 +1145,7 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption) } // Check if head branch is valid. - if !headGitRepo.IsBranchExist(headBranch) { + if !headGitRepo.IsBranchExist(headBranch) && !headGitRepo.IsTagExist(headBranch) { headGitRepo.Close() ctx.NotFound() return nil, nil, nil, nil, "", "" From 2b45aa42f564d25d952ecc9b517a2b8713a6d5ff Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Mon, 22 Apr 2024 00:25:56 +0000 Subject: [PATCH 09/81] [skip ci] Updated licenses and gitignores (cherry picked from commit 31386dc2bb94346b5a1039f009021a4e2f5eb166) --- options/license/HPND-UC-export-US | 10 ++++++++++ options/license/NCL | 32 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 options/license/HPND-UC-export-US create mode 100644 options/license/NCL diff --git a/options/license/HPND-UC-export-US b/options/license/HPND-UC-export-US new file mode 100644 index 0000000000..015556c5f9 --- /dev/null +++ b/options/license/HPND-UC-export-US @@ -0,0 +1,10 @@ +Copyright (C) 1985, 1990 Regents of the University of California. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies. The University of California +makes no representations about the suitability of this +software for any purpose. It is provided "as is" without +express or implied warranty. Export of this software outside +of the United States of America may require an export license. diff --git a/options/license/NCL b/options/license/NCL new file mode 100644 index 0000000000..3bfb658c26 --- /dev/null +++ b/options/license/NCL @@ -0,0 +1,32 @@ +Copyright (c) 2004 the University Corporation for Atmospheric +Research ("UCAR"). All rights reserved. Developed by NCAR's +Computational and Information Systems Laboratory, UCAR, +www.cisl.ucar.edu. + +Redistribution and use of the Software in source and binary forms, +with or without modification, is permitted provided that the +following conditions are met: + +- Neither the names of NCAR's Computational and Information Systems +Laboratory, the University Corporation for Atmospheric Research, +nor the names of its sponsors or contributors may be used to +endorse or promote products derived from this Software without +specific prior written permission. + +- Redistributions of source code must retain the above copyright +notices, this list of conditions, and the disclaimer below. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions, and the disclaimer below in the +documentation and/or other materials provided with the +distribution. + +THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. From 02316e1e408bdfcf95a0c5ae0d174e8241c17e8a Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 22 Apr 2024 12:48:14 +0200 Subject: [PATCH 10/81] Hide diff stats on empty PRs (#30629) When a PR is empty, e.g. has neither additions nor deletions, we don't need to show this: Screenshot 2024-04-21 at 23 25 38 (cherry picked from commit 0386a42f70d1026c50697b12378f5026a63182b9) --- templates/repo/pulls/tab_menu.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/repo/pulls/tab_menu.tmpl b/templates/repo/pulls/tab_menu.tmpl index c0e48928f9..a6d058f160 100644 --- a/templates/repo/pulls/tab_menu.tmpl +++ b/templates/repo/pulls/tab_menu.tmpl @@ -15,12 +15,14 @@ {{ctx.Locale.Tr "repo.pulls.tab_files"}} {{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}} + {{if or .Diff.TotalAddition .Diff.TotalDeletion}} {{if .Diff.TotalAddition}}+{{.Diff.TotalAddition}}{{end}} {{if .Diff.TotalDeletion}}-{{.Diff.TotalDeletion}}{{end}}
+ {{end}}
From 31b608a1e9c0e1602b7b0242e0c35b89b8921a57 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 22 Apr 2024 13:21:06 +0200 Subject: [PATCH 11/81] Remove obsolete CSS text classes (#30576) - `.text-thin` and `.text-italic` are not present in CSS so were doing nothing and I removed them. - `.text.middle` was unused so I removed it. - `.text.italic` is replaced with `tw-italic`. - `.text.normal` had exactly one use and it wasn't even needed. - add a `muted` class to the link to `org_profile_avatar.tmpl`. --------- Co-authored-by: wxiaoguang (cherry picked from commit aff7b7bdd285cc1fcabea774f153886e11ae9f5d) --- templates/org/team/members.tmpl | 2 +- templates/org/team/repositories.tmpl | 2 +- templates/org/team/sidebar.tmpl | 2 +- templates/repo/create.tmpl | 6 +++--- templates/repo/file_info.tmpl | 2 +- templates/repo/settings/collaboration.tmpl | 4 ++-- templates/repo/settings/options.tmpl | 2 +- templates/shared/user/org_profile_avatar.tmpl | 2 +- web_src/css/base.css | 16 ---------------- 9 files changed, 11 insertions(+), 27 deletions(-) diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index 5719328a27..7e9a59a6bf 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -46,7 +46,7 @@
{{else}}
- {{ctx.Locale.Tr "org.teams.members.none"}} + {{ctx.Locale.Tr "org.teams.members.none"}}
{{end}} diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl index 98b4854eb8..f5d68ce416 100644 --- a/templates/org/team/repositories.tmpl +++ b/templates/org/team/repositories.tmpl @@ -48,7 +48,7 @@ {{else}}
- {{ctx.Locale.Tr "org.teams.repos.none"}} + {{ctx.Locale.Tr "org.teams.repos.none"}}
{{end}} diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl index 9311a46e38..c9f80259e2 100644 --- a/templates/org/team/sidebar.tmpl +++ b/templates/org/team/sidebar.tmpl @@ -22,7 +22,7 @@ {{if .Team.Description}} {{.Team.Description}} {{else}} - {{ctx.Locale.Tr "org.teams.no_desc"}} + {{ctx.Locale.Tr "org.teams.no_desc"}} {{end}} {{if eq .Team.LowerName "owners"}} diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index bcd3c16b6a..c1c8c2185e 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -65,7 +65,7 @@
-