From ced34bab1a7d5bfdc2bf67d67ff447e9d8b7a9d3 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 15 Aug 2023 10:31:25 +0800 Subject: [PATCH 01/20] Detect ogg mime-type as audio or video (#26494) "ogg" is just a "container" format for audio and video. Golang's `DetectContentType` only reports "application/ogg" for potential ogg files. Actually it could do more "guess" to see whether it is a audio file or a video file. --- modules/typesniffer/typesniffer.go | 13 ++++++++++++- modules/typesniffer/typesniffer_test.go | 13 +++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/typesniffer/typesniffer.go b/modules/typesniffer/typesniffer.go index 7887fd42b72ef..6aec5c285e2d5 100644 --- a/modules/typesniffer/typesniffer.go +++ b/modules/typesniffer/typesniffer.go @@ -71,7 +71,7 @@ func (ct SniffedType) IsRepresentableAsText() bool { return ct.IsText() || ct.IsSvgImage() } -// IsBrowsableType returns whether a non-text type can be displayed in a browser +// IsBrowsableBinaryType returns whether a non-text type can be displayed in a browser func (ct SniffedType) IsBrowsableBinaryType() bool { return ct.IsImage() || ct.IsSvgImage() || ct.IsPDF() || ct.IsVideo() || ct.IsAudio() } @@ -116,6 +116,17 @@ func DetectContentType(data []byte) SniffedType { } } + if ct == "application/ogg" { + dataHead := data + if len(dataHead) > 256 { + dataHead = dataHead[:256] // only need to do a quick check for the file header + } + if bytes.Contains(dataHead, []byte("theora")) || bytes.Contains(dataHead, []byte("dirac")) { + ct = "video/ogg" // ogg is only used for some video formats, and it's not popular + } else { + ct = "audio/ogg" // for most cases, it is used as an audio container + } + } return SniffedType{ct} } diff --git a/modules/typesniffer/typesniffer_test.go b/modules/typesniffer/typesniffer_test.go index 6c6da34aa006a..731fac11e714a 100644 --- a/modules/typesniffer/typesniffer_test.go +++ b/modules/typesniffer/typesniffer_test.go @@ -6,6 +6,7 @@ package typesniffer import ( "bytes" "encoding/base64" + "encoding/hex" "strings" "testing" @@ -121,3 +122,15 @@ func TestDetectContentTypeFromReader(t *testing.T) { assert.NoError(t, err) assert.True(t, st.IsAudio()) } + +func TestDetectContentTypeOgg(t *testing.T) { + oggAudio, _ := hex.DecodeString("4f67675300020000000000000000352f0000000000007dc39163011e01766f72626973000000000244ac0000000000000071020000000000b8014f6767530000") + st, err := DetectContentTypeFromReader(bytes.NewReader(oggAudio)) + assert.NoError(t, err) + assert.True(t, st.IsAudio()) + + oggVideo, _ := hex.DecodeString("4f676753000200000000000000007d9747ef000000009b59daf3012a807468656f7261030201001e00110001e000010e00020000001e00000001000001000001") + st, err = DetectContentTypeFromReader(bytes.NewReader(oggVideo)) + assert.NoError(t, err) + assert.True(t, st.IsVideo()) +} From e9d631ec039957d5ea2563285a516c37607c9fc7 Mon Sep 17 00:00:00 2001 From: CaiCandong <50507092+CaiCandong@users.noreply.github.com> Date: Tue, 15 Aug 2023 17:30:06 +0800 Subject: [PATCH 02/20] Apply to become a maintainer (#26514) Here is my PR list:- [go-gitea/gitea/pulls (author:caicandong is:merged)](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+sort%3Aupdated-desc+author%3ACaiCandong+is%3Amerged) --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index ac7fb6d05a58c..2d55254b03fb7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -54,3 +54,4 @@ Gary Moon (@garymoon) Philip Peterson (@philip-peterson) Denys Konovalov (@denyskon) Punit Inani (@puni9869) +CaiCandong <1290147055@qq.com> (@caicandong) From d317c983bc877d3286f9dc3decb53d534a56a6d0 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 15 Aug 2023 19:31:48 +0800 Subject: [PATCH 03/20] Set "type=button" for editor's toolbar buttons (#26510) The editor usually is in a form, so the buttons should have "type=button", avoid conflicting with the form's submit. --- web_src/js/features/comp/ComboMarkdownEditor.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web_src/js/features/comp/ComboMarkdownEditor.js b/web_src/js/features/comp/ComboMarkdownEditor.js index d61b6b43cc0ce..9826f2f2bf246 100644 --- a/web_src/js/features/comp/ComboMarkdownEditor.js +++ b/web_src/js/features/comp/ComboMarkdownEditor.js @@ -79,6 +79,8 @@ class ComboMarkdownEditor { for (const el of this.textareaMarkdownToolbar.querySelectorAll('.markdown-toolbar-button')) { // upstream bug: The role code is never executed in base MarkdownButtonElement https://github.com/github/markdown-toolbar-element/issues/70 el.setAttribute('role', 'button'); + // the editor usually is in a form, so the buttons should have "type=button", avoiding conflicting with the form's submit. + if (el.nodeName === 'BUTTON' && !el.getAttribute('type')) el.setAttribute('type', 'button'); } const monospaceButton = this.container.querySelector('.markdown-switch-monospace'); From 79d74d208fe5cf9a5cdcb701cc48f115569a96d0 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 15 Aug 2023 20:32:43 +0800 Subject: [PATCH 04/20] Add API route to list org secrets (#26485) - Add a new function `CountOrgSecrets` in the file `models/secret/secret.go` - Add a new file `modules/structs/secret.go` - Add a new function `ListActionsSecrets` in the file `routers/api/v1/api.go` - Add a new file `routers/api/v1/org/action.go` - Add a new function `listActionsSecrets` in the file `routers/api/v1/org/action.go` go-sdk: https://gitea.com/gitea/go-sdk/pulls/629 --------- Signed-off-by: Bo-Yi Wu Co-authored-by: Lunny Xiao Co-authored-by: techknowlogick Co-authored-by: Giteabot --- models/secret/secret.go | 5 +++ modules/structs/secret.go | 15 +++++++ routers/api/v1/api.go | 3 ++ routers/api/v1/org/action.go | 72 ++++++++++++++++++++++++++++++++ routers/api/v1/swagger/action.go | 13 ++++++ templates/swagger/v1_json.tmpl | 64 ++++++++++++++++++++++++++++ 6 files changed, 172 insertions(+) create mode 100644 modules/structs/secret.go create mode 100644 routers/api/v1/org/action.go create mode 100644 routers/api/v1/swagger/action.go diff --git a/models/secret/secret.go b/models/secret/secret.go index 5a17cc37a5dc0..c9c95e82d3024 100644 --- a/models/secret/secret.go +++ b/models/secret/secret.go @@ -88,3 +88,8 @@ func FindSecrets(ctx context.Context, opts FindSecretsOptions) ([]*Secret, error Where(opts.toConds()). Find(&secrets) } + +// CountSecrets counts the secrets +func CountSecrets(ctx context.Context, opts *FindSecretsOptions) (int64, error) { + return db.GetEngine(ctx).Where(opts.toConds()).Count(new(Secret)) +} diff --git a/modules/structs/secret.go b/modules/structs/secret.go new file mode 100644 index 0000000000000..6a41db4cd2f58 --- /dev/null +++ b/modules/structs/secret.go @@ -0,0 +1,15 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package structs + +import "time" + +// User represents a secret +// swagger:model +type Secret struct { + // the secret's name + Name string `json:"name"` + // swagger:strfmt date-time + Created time.Time `json:"created_at"` +} diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 397eb105582b0..ccae83a940b07 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -1298,6 +1298,9 @@ func Routes() *web.Route { m.Combo("/{username}").Get(reqToken(), org.IsMember). Delete(reqToken(), reqOrgOwnership(), org.DeleteMember) }) + m.Group("/actions/secrets", func() { + m.Get("", reqToken(), reqOrgOwnership(), org.ListActionsSecrets) + }) m.Group("/public_members", func() { m.Get("", org.ListPublicMembers) m.Combo("/{username}").Get(org.IsPublicMember). diff --git a/routers/api/v1/org/action.go b/routers/api/v1/org/action.go new file mode 100644 index 0000000000000..9deda2209c207 --- /dev/null +++ b/routers/api/v1/org/action.go @@ -0,0 +1,72 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package org + +import ( + "net/http" + + "code.gitea.io/gitea/models/secret" + "code.gitea.io/gitea/modules/context" + api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/routers/api/v1/utils" +) + +// ListActionsSecrets list an organization's actions secrets +func ListActionsSecrets(ctx *context.APIContext) { + // swagger:operation GET /orgs/{org}/actions/secrets organization orgListActionsSecrets + // --- + // summary: List an organization's actions secrets + // produces: + // - application/json + // parameters: + // - name: org + // in: path + // description: name of the organization + // type: string + // required: true + // - name: page + // in: query + // description: page number of results to return (1-based) + // type: integer + // - name: limit + // in: query + // description: page size of results + // type: integer + // responses: + // "200": + // "$ref": "#/responses/SecretList" + + listActionsSecrets(ctx) +} + +// listActionsSecrets list an organization's actions secrets +func listActionsSecrets(ctx *context.APIContext) { + opts := &secret.FindSecretsOptions{ + OwnerID: ctx.Org.Organization.ID, + ListOptions: utils.GetListOptions(ctx), + } + + count, err := secret.CountSecrets(ctx, opts) + if err != nil { + ctx.InternalServerError(err) + return + } + + secrets, err := secret.FindSecrets(ctx, *opts) + if err != nil { + ctx.InternalServerError(err) + return + } + + apiSecrets := make([]*api.Secret, len(secrets)) + for k, v := range secrets { + apiSecrets[k] = &api.Secret{ + Name: v.Name, + Created: v.CreatedUnix.AsTime(), + } + } + + ctx.SetTotalCountHeader(count) + ctx.JSON(http.StatusOK, apiSecrets) +} diff --git a/routers/api/v1/swagger/action.go b/routers/api/v1/swagger/action.go new file mode 100644 index 0000000000000..493b167f725a1 --- /dev/null +++ b/routers/api/v1/swagger/action.go @@ -0,0 +1,13 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package swagger + +import api "code.gitea.io/gitea/modules/structs" + +// SecretList +// swagger:response SecretList +type swaggerResponseSecretList struct { + // in:body + Body []api.Secret `json:"body"` +} diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index a5bea8a4cb941..da43c530af1f5 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -1550,6 +1550,44 @@ } } }, + "/orgs/{org}/actions/secrets": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List an organization's actions secrets", + "operationId": "orgListActionsSecrets", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/SecretList" + } + } + } + }, "/orgs/{org}/activities/feeds": { "get": { "produces": [ @@ -21291,6 +21329,23 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "Secret": { + "description": "User represents a secret", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "name": { + "description": "the secret's name", + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "ServerVersion": { "description": "ServerVersion wraps the version of the server", "type": "object", @@ -22862,6 +22917,15 @@ "$ref": "#/definitions/SearchResults" } }, + "SecretList": { + "description": "SecretList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Secret" + } + } + }, "ServerVersion": { "description": "ServerVersion", "schema": { From 27e4ac3e40265722abf9f99d519cb5985eebd1c7 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 15 Aug 2023 15:23:51 +0200 Subject: [PATCH 05/20] Use `hidden` over `clip` for text truncation (#26520) Avoid browser bugs: - Firefox not cutting off - https://github.com/go-gitea/gitea/pull/26354#issuecomment-1678456052 - Safari not showing ellipsis - https://github.com/go-gitea/gitea/pull/26354#issuecomment-1678812801 --- web_src/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index eca08fa1b910a..bdc1234bc9a8d 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1235,7 +1235,7 @@ img.ui.avatar, } .ui .text.truncate { - overflow-x: clip; + overflow-x: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; From 7f8028e5a1ee5e99ef491bf037a7171998322bd2 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Tue, 15 Aug 2023 23:00:35 +0900 Subject: [PATCH 06/20] Fix display problems of members and teams unit (#26363) Fix: - display member count and team count in the menu bar ![image](https://github.com/go-gitea/gitea/assets/18380374/7f03ced4-67e2-41ce-b19f-a992823726bb) - Also display member unit in the menu bar if there are no hidden members in public org ![image](https://github.com/go-gitea/gitea/assets/18380374/31422ad6-7190-438d-8e99-8a4af9cce908) - hidden member board when there's no seeable members. In this org, we only have hidden members: ![image](https://github.com/go-gitea/gitea/assets/18380374/d749420b-554a-4483-8cd2-221df61b5ca7) We will hidden the member board when doer is not the member of this org ![image](https://github.com/go-gitea/gitea/assets/18380374/93bb782e-7d4d-4ad3-a096-133afbc51f8a) Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/eafc0b3e-6218-42ab-a892-39645d08a5eb) If you click the number in the members board, you will access the members page, which is not expected. ![image](https://github.com/go-gitea/gitea/assets/18380374/73d6dadc-0ef2-4ca9-8485-c5f4211bffb2) --------- Co-authored-by: delvh Co-authored-by: Giteabot --- modules/context/org.go | 14 ++++++++++++++ routers/web/org/home.go | 21 +++------------------ templates/org/home.tmpl | 29 ++++++++++++++++------------- templates/org/menu.tmpl | 8 ++++---- 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/modules/context/org.go b/modules/context/org.go index 835c761372fa9..2d7cf5185c506 100644 --- a/modules/context/org.go +++ b/modules/context/org.go @@ -24,6 +24,7 @@ type Organization struct { Organization *organization.Organization OrgLink string CanCreateOrgRepo bool + PublicMemberOnly bool // Only display public members Team *organization.Team Teams []*organization.Team @@ -172,6 +173,18 @@ func HandleOrgAssignment(ctx *Context, args ...bool) { ctx.Org.OrgLink = org.AsUser().OrganisationLink() ctx.Data["OrgLink"] = ctx.Org.OrgLink + // Member + ctx.Org.PublicMemberOnly = ctx.Doer == nil || !ctx.Org.IsMember && !ctx.Doer.IsAdmin + opts := &organization.FindOrgMembersOpts{ + OrgID: org.ID, + PublicOnly: ctx.Org.PublicMemberOnly, + } + ctx.Data["NumMembers"], err = organization.CountOrgMembers(opts) + if err != nil { + ctx.ServerError("CountOrgMembers", err) + return + } + // Team. if ctx.Org.IsMember { shouldSeeAllTeams := false @@ -203,6 +216,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) { return } } + ctx.Data["NumTeams"] = len(ctx.Org.Teams) } teamName := ctx.Params(":team") diff --git a/routers/web/org/home.go b/routers/web/org/home.go index 9104c15f949bc..613dff2182bda 100644 --- a/routers/web/org/home.go +++ b/routers/web/org/home.go @@ -120,31 +120,15 @@ func Home(ctx *context.Context) { opts := &organization.FindOrgMembersOpts{ OrgID: org.ID, - PublicOnly: true, + PublicOnly: ctx.Org.PublicMemberOnly, ListOptions: db.ListOptions{Page: 1, PageSize: 25}, } - - if ctx.Doer != nil { - isMember, err := org.IsOrgMember(ctx.Doer.ID) - if err != nil { - ctx.Error(http.StatusInternalServerError, "IsOrgMember") - return - } - opts.PublicOnly = !isMember && !ctx.Doer.IsAdmin - } - members, _, err := organization.FindOrgMembers(opts) if err != nil { ctx.ServerError("FindOrgMembers", err) return } - membersCount, err := organization.CountOrgMembers(opts) - if err != nil { - ctx.ServerError("CountOrgMembers", err) - return - } - var isFollowing bool if ctx.Doer != nil { isFollowing = user_model.IsFollowing(ctx.Doer.ID, ctx.ContextUser.ID) @@ -152,7 +136,6 @@ func Home(ctx *context.Context) { ctx.Data["Repos"] = repos ctx.Data["Total"] = count - ctx.Data["MembersTotal"] = membersCount ctx.Data["Members"] = members ctx.Data["Teams"] = ctx.Org.Teams ctx.Data["DisableNewPullMirrors"] = setting.Mirror.DisableNewPull @@ -171,5 +154,7 @@ func Home(ctx *context.Context) { ctx.Data["Page"] = pager ctx.Data["ContextUser"] = ctx.ContextUser + ctx.Data["ShowMemberAndTeamTab"] = ctx.Org.IsMember || len(members) > 0 + ctx.HTML(http.StatusOK, tplOrgHome) } diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 766dd5b7a65f7..0bd744d2b87da 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -37,12 +37,13 @@
-
+
{{template "explore/repo_search" .}} {{template "explore/repo_list" .}} {{template "base/paginate" .}}
+ {{if .ShowMemberAndTeamTab}}
{{if .CanCreateOrgRepo}}
@@ -53,19 +54,20 @@
{{end}} -

- {{.locale.Tr "org.members"}} - {{.MembersTotal}} {{svg "octicon-chevron-right"}} -

-
- {{$isMember := .IsOrganizationMember}} - {{range .Members}} - {{if or $isMember (call $.IsPublicMember .ID)}} - {{ctx.AvatarUtils.Avatar . 48}} + {{if .NumMembers}} +

+ {{.locale.Tr "org.members"}} + {{.NumMembers}} {{svg "octicon-chevron-right"}} +

+
+ {{$isMember := .IsOrganizationMember}} + {{range .Members}} + {{if or $isMember (call $.IsPublicMember .ID)}} + {{ctx.AvatarUtils.Avatar . 48}} + {{end}} {{end}} - {{end}} -
- +
+ {{end}} {{if .IsOrganizationMember}}
{{.locale.Tr "org.teams"}} @@ -89,6 +91,7 @@ {{end}} {{end}}
+ {{end}}
diff --git a/templates/org/menu.tmpl b/templates/org/menu.tmpl index a4f602730a503..26c9f980a5a11 100644 --- a/templates/org/menu.tmpl +++ b/templates/org/menu.tmpl @@ -21,13 +21,13 @@ {{svg "octicon-code"}} {{$.locale.Tr "org.code"}} {{end}} - {{if .IsOrganizationMember}} + {{if .NumMembers}} {{svg "octicon-person"}} {{$.locale.Tr "org.members"}} - {{if .NumMembers}} -
{{.NumMembers}}
- {{end}} +
{{.NumMembers}}
+ {{end}} + {{if .IsOrganizationMember}} {{svg "octicon-people"}} {{$.locale.Tr "org.teams"}} {{if .NumTeams}} From 0e74fc4a84fb27ad7b3aab87e1ef2b9be9d74815 Mon Sep 17 00:00:00 2001 From: CaiCandong <50507092+CaiCandong@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:50:12 +0800 Subject: [PATCH 07/20] Fix project filter bugs (#26490) related: #26012 ### Bugs 1. missing project filter on the issue page. https://github.com/go-gitea/gitea/blob/1e76a824bcd71acd59cdfb2c4547806bc34b3d86/modules/indexer/issues/dboptions.go#L11-L15 3. incorrect SQL condition: some issue does not belong to a project but exists on the project_issue table. https://github.com/go-gitea/gitea/blob/f5dbac9d36f1678b928bee04e85fbd045c725698/models/issues/issue_search.go#L233 ### Before: ![before](https://github.com/go-gitea/gitea/assets/50507092/1dcde39e-3e2f-4151-b2c6-4d67bf493c2f) ### After: ![after](https://github.com/go-gitea/gitea/assets/50507092/badfb81f-056d-4a2f-9838-1cba9c15768d) --------- Co-authored-by: Giteabot --- models/issues/issue_search.go | 19 +++++++++++++------ models/issues/issue_stats.go | 5 +---- modules/indexer/issues/dboptions.go | 4 ++++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/models/issues/issue_search.go b/models/issues/issue_search.go index 281339044b801..3640351a4d467 100644 --- a/models/issues/issue_search.go +++ b/models/issues/issue_search.go @@ -168,6 +168,18 @@ func applyMilestoneCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.Sess return sess } +func applyProjectCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.Session { + if opts.ProjectID > 0 { // specific project + sess.Join("INNER", "project_issue", "issue.id = project_issue.issue_id"). + And("project_issue.project_id=?", opts.ProjectID) + } else if opts.ProjectID == db.NoConditionID { // show those that are in no project + sess.And(builder.NotIn("issue.id", builder.Select("issue_id").From("project_issue").And(builder.Neq{"project_id": 0}))) + } + // opts.ProjectID == 0 means all projects, + // do not need to apply any condition + return sess +} + func applyRepoConditions(sess *xorm.Session, opts *IssuesOptions) *xorm.Session { if len(opts.RepoIDs) == 1 { opts.RepoCond = builder.Eq{"issue.repo_id": opts.RepoIDs[0]} @@ -226,12 +238,7 @@ func applyConditions(sess *xorm.Session, opts *IssuesOptions) *xorm.Session { sess.And(builder.Lte{"issue.updated_unix": opts.UpdatedBeforeUnix}) } - if opts.ProjectID > 0 { - sess.Join("INNER", "project_issue", "issue.id = project_issue.issue_id"). - And("project_issue.project_id=?", opts.ProjectID) - } else if opts.ProjectID == db.NoConditionID { // show those that are in no project - sess.And(builder.NotIn("issue.id", builder.Select("issue_id").From("project_issue"))) - } + applyProjectCondition(sess, opts) if opts.ProjectBoardID != 0 { if opts.ProjectBoardID > 0 { diff --git a/models/issues/issue_stats.go b/models/issues/issue_stats.go index d86123a824d6d..6c249c2244160 100644 --- a/models/issues/issue_stats.go +++ b/models/issues/issue_stats.go @@ -133,10 +133,7 @@ func getIssueStatsChunk(opts *IssuesOptions, issueIDs []int64) (*IssueStats, err applyMilestoneCondition(sess, opts) - if opts.ProjectID > 0 { - sess.Join("INNER", "project_issue", "issue.id = project_issue.issue_id"). - And("project_issue.project_id=?", opts.ProjectID) - } + applyProjectCondition(sess, opts) if opts.AssigneeID > 0 { applyAssigneeCondition(sess, opts.AssigneeID) diff --git a/modules/indexer/issues/dboptions.go b/modules/indexer/issues/dboptions.go index 6a41afadd7077..d0ef1c96b4487 100644 --- a/modules/indexer/issues/dboptions.go +++ b/modules/indexer/issues/dboptions.go @@ -17,6 +17,10 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp IsClosed: opts.IsClosed, } + if opts.ProjectID != 0 { + searchOpt.ProjectID = &opts.ProjectID + } + if len(opts.LabelIDs) == 1 && opts.LabelIDs[0] == 0 { searchOpt.NoLabelOnly = true } else { From 7563891cc4a607adc67de57c373ee67dc9e7d298 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 15 Aug 2023 23:13:56 +0200 Subject: [PATCH 08/20] Remove duplicate CSS import for chroma/base.css (#26523) --- web_src/css/themes/theme-arc-green.css | 1 - 1 file changed, 1 deletion(-) diff --git a/web_src/css/themes/theme-arc-green.css b/web_src/css/themes/theme-arc-green.css index cdf49362375bd..31752ccad6cea 100644 --- a/web_src/css/themes/theme-arc-green.css +++ b/web_src/css/themes/theme-arc-green.css @@ -1,4 +1,3 @@ -@import "../chroma/base.css"; @import "../chroma/dark.css"; @import "../codemirror/dark.css"; From c7fd9ad8b462c64f0eda600e58e0e06259ad116b Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 16 Aug 2023 06:10:10 +0800 Subject: [PATCH 09/20] Fix dark theme highlight for "NameNamespace" (#26519) The color is taken from "Name" Before: ![image](https://github.com/go-gitea/gitea/assets/2114189/b94d7521-770c-4e14-a63b-f30c44fe883f) After: ![image](https://github.com/go-gitea/gitea/assets/2114189/d99c1f13-a0c0-4dc8-82ab-bfdd451e46ec) Co-authored-by: Giteabot --- web_src/css/chroma/dark.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/css/chroma/dark.css b/web_src/css/chroma/dark.css index 1b0c722a164c5..2ac816435c0ee 100644 --- a/web_src/css/chroma/dark.css +++ b/web_src/css/chroma/dark.css @@ -45,7 +45,7 @@ .chroma .nf { color: #fabd2f; } /* NameFunction */ .chroma .ni { color: #fabd2f; } /* NameEntity */ .chroma .nl { color: #ff7540; } /* NameLabel */ -.chroma .nn { color: #ffaa10; } /* NameNamespace */ +.chroma .nn { color: #c9d1d9; } /* NameNamespace */ .chroma .no { color: #649bc4; } /* NameConstant */ .chroma .nt { color: #ff7540; } /* NameTag */ .chroma .nv { color: #ebdbb2; } /* NameVariable */ From 8703b6c954893b74a0f97aaa8079c968a4d245cc Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Wed, 16 Aug 2023 07:44:43 +0900 Subject: [PATCH 10/20] Improve clickable area in repo action view page (#26115) Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/52e4dda1-0221-440b-93e1-242db8bd5885) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/dda5e72b-205e-44f7-b4a9-83703021f2d1) In current design, the clickable area is too small, and it is hard to find the correct clickable area as the area with background color (div with class name `job-brief-item selected`) is bigger than it. --------- Co-authored-by: Giteabot --- web_src/js/components/RepoActionView.vue | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue index 929e971b6c7f3..2318e7fc7a286 100644 --- a/web_src/js/components/RepoActionView.vue +++ b/web_src/js/components/RepoActionView.vue @@ -32,16 +32,16 @@
-
- + + + {{ job.duration }} -
+
@@ -575,6 +575,7 @@ export function initRepositoryActionView() { flex-wrap: nowrap; justify-content: space-between; align-items: center; + color: var(--color-text); } .job-brief-item:hover { @@ -599,28 +600,23 @@ export function initRepositoryActionView() { transform: scale(130%); } -.job-brief-item .job-brief-link { +.job-brief-item .job-brief-item-left { display: flex; width: 100%; min-width: 0; } -.job-brief-item .job-brief-link span { +.job-brief-item .job-brief-item-left span { display: flex; align-items: center; } -.job-brief-item .job-brief-link .job-brief-name { +.job-brief-item .job-brief-item-left .job-brief-name { display: block; width: 70%; - color: var(--color-text); -} - -.job-brief-item .job-brief-link:hover { - text-decoration: none; } -.job-brief-item .job-brief-info { +.job-brief-item .job-brief-item-right { display: flex; align-items: center; } From bc930f332f70ed2259740325592f054cc01a01cf Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Wed, 16 Aug 2023 08:10:40 +0900 Subject: [PATCH 11/20] Fix typo of RunerOwnerID (#26508) --- routers/web/shared/actions/runners.go | 2 +- templates/shared/actions/runner_list.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/web/shared/actions/runners.go b/routers/web/shared/actions/runners.go index eb84cc4a2ef48..cab3d78cac6de 100644 --- a/routers/web/shared/actions/runners.go +++ b/routers/web/shared/actions/runners.go @@ -51,7 +51,7 @@ func RunnersList(ctx *context.Context, opts actions_model.FindRunnerOptions) { ctx.Data["Runners"] = runners ctx.Data["Total"] = count ctx.Data["RegistrationToken"] = token.Token - ctx.Data["RunnerOnwerID"] = opts.OwnerID + ctx.Data["RunnerOwnerID"] = opts.OwnerID ctx.Data["RunnerRepoID"] = opts.RepoID pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5) diff --git a/templates/shared/actions/runner_list.tmpl b/templates/shared/actions/runner_list.tmpl index 36210af6d8e8f..c4b70282aedb0 100644 --- a/templates/shared/actions/runner_list.tmpl +++ b/templates/shared/actions/runner_list.tmpl @@ -71,7 +71,7 @@ {{if .LastOnline}}{{TimeSinceUnix .LastOnline $.locale}}{{else}}{{$.locale.Tr "never"}}{{end}} - {{if .Editable $.RunnerOnwerID $.RunnerRepoID}} + {{if .Editable $.RunnerOwnerID $.RunnerRepoID}} {{svg "octicon-pencil"}} {{end}} From 3e044d2c9fea7c197aa0476e2c9735320c112e03 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 16 Aug 2023 02:08:23 +0200 Subject: [PATCH 12/20] Use unique class for breadcrumb divider (#26524) Fix regression from https://github.com/go-gitea/gitea/pull/25539: https://github.com/go-gitea/gitea/pull/26519#issuecomment-1678825200. Before: Screenshot 2023-08-15 at 15 46 12 After: Screenshot 2023-08-15 at 15 46 19 Screenshot 2023-08-15 at 15 56 11 --- templates/repo/editor/cherry_pick.tmpl | 2 +- templates/repo/editor/edit.tmpl | 2 +- templates/repo/editor/patch.tmpl | 2 +- templates/repo/editor/upload.tmpl | 2 +- templates/repo/home.tmpl | 2 +- web_src/css/modules/breadcrumb.css | 11 ++++++++--- web_src/js/features/repo-editor.js | 4 ++-- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/templates/repo/editor/cherry_pick.tmpl b/templates/repo/editor/cherry_pick.tmpl index 828addb75a102..59948f28371d3 100644 --- a/templates/repo/editor/cherry_pick.tmpl +++ b/templates/repo/editor/cherry_pick.tmpl @@ -18,7 +18,7 @@ {{.locale.Tr "repo.editor.cherry_pick" $shalink | Str2html}} {{end}} {{.Repository.FullName}} -
:
+ {{.BranchName}} {{.locale.Tr "repo.editor.or"}} {{.locale.Tr "repo.editor.cancel_lower"}}
diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl index 988b11911dbbb..3b5a63f3aa854 100644 --- a/templates/repo/editor/edit.tmpl +++ b/templates/repo/editor/edit.tmpl @@ -13,7 +13,7 @@ {{$n := len .TreeNames}} {{$l := Eval $n "-" 1}} {{range $i, $v := .TreeNames}} -
/
+ {{if eq $i $l}} {{svg "octicon-info"}} diff --git a/templates/repo/editor/patch.tmpl b/templates/repo/editor/patch.tmpl index 581a80e827c93..1f948fbb1904e 100644 --- a/templates/repo/editor/patch.tmpl +++ b/templates/repo/editor/patch.tmpl @@ -11,7 +11,7 @@