From 6f3c162f482b395d2635a26777fb8d3c5c43712d Mon Sep 17 00:00:00 2001 From: Hester Gong Date: Tue, 18 Apr 2023 19:26:57 +0800 Subject: [PATCH 001/101] Fix wrong scopes of locale.PrettyNumber (#24181) --- templates/repo/projects/list.tmpl | 4 ++-- templates/user/dashboard/milestones.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl index bbcc20dd7c..8cf5d716f1 100644 --- a/templates/repo/projects/list.tmpl +++ b/templates/repo/projects/list.tmpl @@ -48,9 +48,9 @@ {{end}} {{svg "octicon-issue-opened" 16 "gt-mr-3"}} - {{.locale.PrettyNumber .NumOpenIssues}} {{$.locale.Tr "repo.issues.open_title"}} + {{$.locale.PrettyNumber .NumOpenIssues}} {{$.locale.Tr "repo.issues.open_title"}} {{svg "octicon-check" 16 "gt-mr-3"}} - {{.locale.PrettyNumber .NumClosedIssues}} {{$.locale.Tr "repo.issues.closed_title"}} + {{$.locale.PrettyNumber .NumClosedIssues}} {{$.locale.Tr "repo.issues.closed_title"}} {{if and $.CanWriteProjects (not $.Repository.IsArchived)}} diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index 39eea2fc75..09519ce005 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -104,9 +104,9 @@ {{end}} {{svg "octicon-issue-opened" 16 "gt-mr-3"}} - {{.locale.PrettyNumber .NumOpenIssues}} {{$.locale.Tr "repo.issues.open_title"}} + {{$.locale.PrettyNumber .NumOpenIssues}} {{$.locale.Tr "repo.issues.open_title"}} {{svg "octicon-check" 16 "gt-mr-3"}} - {{.locale.PrettyNumber .NumClosedIssues}} {{$.locale.Tr "repo.issues.closed_title"}} + {{$.locale.PrettyNumber .NumClosedIssues}} {{$.locale.Tr "repo.issues.closed_title"}} {{if .TotalTrackedTime}} {{svg "octicon-clock"}} {{.TotalTrackedTime|Sec2Time}} {{end}} From 2002584986aa2e2cfdc66e2c4f85b5222c582e34 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Tue, 18 Apr 2023 19:00:01 +0300 Subject: [PATCH 002/101] Bump GitHub's `relative-time-element` to `v4.3.0` (#24187) https://github.com/github/relative-time-element/releases/tag/v4.3.0 I checked and everything still works --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3766898043..88a0ca3b0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@citation-js/plugin-software-formats": "0.6.1", "@claviska/jquery-minicolors": "2.3.6", "@github/markdown-toolbar-element": "2.1.1", - "@github/relative-time-element": "4.2.4", + "@github/relative-time-element": "4.3.0", "@github/text-expander-element": "2.3.0", "@mcaptcha/vanilla-glue": "0.1.0-alpha-3", "@primer/octicons": "18.3.0", @@ -853,9 +853,9 @@ "integrity": "sha512-J++rpd5H9baztabJQB82h26jtueOeBRSTqetk9Cri+Lj/s28ndu6Tovn0uHQaOKtBWDobFunk9b5pP5vcqt7cA==" }, "node_modules/@github/relative-time-element": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/@github/relative-time-element/-/relative-time-element-4.2.4.tgz", - "integrity": "sha512-18qgH9FYUHYN9K3z4s35auDHww1dKTU6TacI8JkA5OuvHVa1lTMuSTZ4hIoJngD5+mizcoRMOs6p/yZYMIjsyg==" + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@github/relative-time-element/-/relative-time-element-4.3.0.tgz", + "integrity": "sha512-+tFjX9//HRS1HnBa5cNgfEtE52arwiutYg1TOF+Trk40SPxst9Q8Rtc3BKD6aKsvfbtub68vfhipgchGjj9o7g==" }, "node_modules/@github/text-expander-element": { "version": "2.3.0", diff --git a/package.json b/package.json index 57dcfc2f7f..310daaed3e 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@citation-js/plugin-software-formats": "0.6.1", "@claviska/jquery-minicolors": "2.3.6", "@github/markdown-toolbar-element": "2.1.1", - "@github/relative-time-element": "4.2.4", + "@github/relative-time-element": "4.3.0", "@github/text-expander-element": "2.3.0", "@mcaptcha/vanilla-glue": "0.1.0-alpha-3", "@primer/octicons": "18.3.0", From 7ca7590c39dd63b2f812ce3a85ef82c2f4797aea Mon Sep 17 00:00:00 2001 From: Hester Gong Date: Wed, 19 Apr 2023 00:49:49 +0800 Subject: [PATCH 003/101] Fix duplicate modals when clicking on "remove all" repository button (#24129) Under Team tab of an organization, click on "remove all" repositories button will trigger two modals. Because `data-modal-id` is not proerly added. Before: https://user-images.githubusercontent.com/17645053/231988545-ac690b86-e3fe-4bf5-81c6-5ef09302e849.mov After: https://user-images.githubusercontent.com/17645053/231989678-53be4f91-fdc9-4bc5-ba11-a08aa4548e37.mov --- templates/org/team/repositories.tmpl | 8 ++++---- web_src/js/features/common-global.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl index ac863f3a7b..0ffd50226f 100644 --- a/templates/org/team/repositories.tmpl +++ b/templates/org/team/repositories.tmpl @@ -25,8 +25,8 @@
- - + +
@@ -64,7 +64,7 @@ -
- {{$.locale.Tr "settings.add_on"}} {{DateTime "short" .CreatedUnix.FormatLong .CreatedUnix.FormatShort}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{DateTime "short" .UpdatedUnix.FormatLong .UpdatedUnix.FormatShort}}{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} + {{$.locale.Tr "settings.add_on"}} {{DateTime "short" .CreatedUnix}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{DateTime "short" .UpdatedUnix.FormatLong .UpdatedUnix.FormatShort}}{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}
diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css index 750ec44229..70ac8ff469 100644 --- a/web_src/css/helpers.css +++ b/web_src/css/helpers.css @@ -23,15 +23,6 @@ Gitea's private styles use `g-` prefix. .gt-h-100 { height: 100% !important; } .gt-br-0 { border-radius: 0 !important; } -/* below class names match Tailwind CSS */ -.gt-pointer-events-none { pointer-events: none !important; } -.gt-relative { position: relative !important; } -.gt-overflow-x-scroll { overflow-x: scroll !important; } -.gt-cursor-default { cursor: default !important; } -.gt-items-start { align-items: flex-start !important; } -.gt-whitespace-pre { white-space: pre !important; } -.gt-invisible { visibility: hidden !important; } - .gt-mono { font-family: var(--fonts-monospace) !important; font-size: .95em !important; /* compensate for monospace fonts being usually slightly larger */ @@ -51,6 +42,19 @@ Gitea's private styles use `g-` prefix. text-overflow: ellipsis !important; } +/* below class names match Tailwind CSS */ +.gt-break-all { word-break: break-all !important; } +.gt-content-center { align-content: center !important; } +.gt-cursor-default { cursor: default !important; } +.gt-invisible { visibility: hidden !important; } +.gt-items-start { align-items: flex-start !important; } +.gt-overflow-x-scroll { overflow-x: scroll !important; } +.gt-pointer-events-none { pointer-events: none !important; } +.gt-relative { position: relative !important; } +.gt-whitespace-nowrap { white-space: nowrap !important; } +.gt-whitespace-pre { white-space: pre !important; } +.gt-whitespace-pre-wrap { white-space: pre-wrap !important; } + .gt-w-screen { width: 100vw !important; } .gt-h-screen { height: 100vh !important; } @@ -203,11 +207,7 @@ Gitea's private styles use `g-` prefix. .gt-gap-y-4 { row-gap: 1rem !important; } .gt-gap-y-5 { row-gap: 2rem !important; } -.gt-content-center { align-content: center !important; } - .gt-shrink-0 { flex-shrink: 0 !important; } -.gt-whitespace-nowrap { white-space: nowrap !important; } -.gt-whitespace-pre-wrap { white-space: pre-wrap !important; } @media (max-width: 767px) { .gt-db-small { display: block !important; } From ee6fa8d63347707739f343fac8f3a459ab6de2d1 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 25 Apr 2023 23:19:22 +0200 Subject: [PATCH 092/101] Restore bold on repolist (#24337) Looking at it again, it does look a bit "odd" without bold, so revert the repolist change done in https://github.com/go-gitea/gitea/pull/24307. image --- web_src/js/components/DashboardRepoList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue index a3a02ecadb..1af53aac90 100644 --- a/web_src/js/components/DashboardRepoList.vue +++ b/web_src/js/components/DashboardRepoList.vue @@ -74,7 +74,7 @@
-
{{ repo.full_name }}
+
{{ repo.full_name }}
From fa86a1b74af69ea6b0611013152d81954caedcd9 Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Wed, 26 Apr 2023 00:07:58 +0000 Subject: [PATCH 093/101] [skip ci] Updated translations via Crowdin --- options/locale/locale_el-GR.ini | 7 +++++++ options/locale/locale_zh-CN.ini | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini index 09b0af0dec..f0c8efda74 100644 --- a/options/locale/locale_el-GR.ini +++ b/options/locale/locale_el-GR.ini @@ -462,6 +462,7 @@ team_invite.text_3=Σημείωση: Αυτή η πρόσκληση προορι [modal] yes=Ναι no=Όχι +confirm=Επιβεβαίωση cancel=Ακύρωση modify=Ενημέρωση @@ -1622,7 +1623,10 @@ pulls.tab_files=Αρχεία Με Αλλαγές pulls.reopen_to_merge=Παρακαλώ ανοίξτε ξανά αυτό το pull request για να εκτελέσετε μια συγχώνευση. pulls.cant_reopen_deleted_branch=Αυτό το pull request δεν μπορεί να ανοίξει ξανά επειδή ο κλάδος διαγράφηκε. pulls.merged=Συγχωνευμένο +pulls.merged_success=Το pull request συγχωνεύτηκε και έκλεισε επιτυχώς +pulls.closed=Το pull request έκλεισε pulls.manually_merged=Συγχωνεύτηκαν χειροκίνητα +pulls.merged_info_text=Ο κλάδος %s μπορεί τώρα να διαγραφεί. pulls.is_closed=Το pull request έχει κλείσει. pulls.title_wip_desc=`
Ξεκινήστε τον τίτλο με %s για να αποτρέψετε την τυχαία συγχώνευση του pull request.` pulls.cannot_merge_work_in_progress=Αυτό το pull request επισημαίνεται ως μια εργασία σε εξέλιξη. @@ -3414,4 +3418,7 @@ runs.no_matching_runner_helper=Δε ταιριάζει εκτελεστής: %s need_approval_desc=Πρέπει να εγκριθεί η εκτέλεση ροών εργασίας για pull request από fork. [projects] +type-1.display_name=Ατομικό Έργο +type-2.display_name=Έργο Αποθετηρίου +type-3.display_name=Έργο Οργανισμού diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index e70cb1ea50..41f987bb72 100644 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -284,7 +284,7 @@ show_only_public=只显示公开的 issues.in_your_repos=在您的仓库中 [explore] -repos=仓库管理 +repos=仓库 users=用户 organizations=组织管理 search=搜索 From 61a73edbf36ebf795241ee818316701d2ca7364b Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Tue, 25 Apr 2023 21:32:49 -0400 Subject: [PATCH 094/101] switch to use Actions from drone for cron (#24314) Move drone cron pipelines to (GitHub) Actions. As these are mostly compatible with Gitea Actions, when we start to dogfood, these will already be migrated. --- .drone.yml | 103 ------------------------ .github/workflows/cron-licenses.yml | 28 +++++++ .github/workflows/cron-translations.yml | 47 +++++++++++ 3 files changed, 75 insertions(+), 103 deletions(-) create mode 100644 .github/workflows/cron-licenses.yml create mode 100644 .github/workflows/cron-translations.yml diff --git a/.drone.yml b/.drone.yml index 087ddd6166..5096ce781f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -773,109 +773,6 @@ steps: - name: deps path: /go ---- -kind: pipeline -name: update_translations - -platform: - os: linux - arch: arm64 - -trigger: - branch: - - main - event: - - cron - cron: - - update_translations - -steps: - - name: download - image: jonasfranz/crowdin - pull: always - settings: - download: true - export_dir: options/locale/ - ignore_branch: true - project_identifier: gitea - environment: - CROWDIN_KEY: - from_secret: crowdin_key - - - name: update - image: alpine:3.17 - pull: always - commands: - - ./build/update-locales.sh - - - name: push - image: appleboy/drone-git-push - pull: always - settings: - author_email: "teabot@gitea.io" - author_name: GiteaBot - branch: main - commit: true - commit_message: "[skip ci] Updated translations via Crowdin" - remote: "git@github.com:go-gitea/gitea.git" - environment: - DRONE_COMMIT_AUTHOR_EMAIL: "teabot@gitea.io" - DRONE_COMMIT_AUTHOR: GiteaBot - GIT_PUSH_SSH_KEY: - from_secret: git_push_ssh_key - - - name: upload_translations - image: jonasfranz/crowdin - pull: always - settings: - files: - locale_en-US.ini: options/locale/locale_en-US.ini - ignore_branch: true - project_identifier: gitea - environment: - CROWDIN_KEY: - from_secret: crowdin_key - ---- -kind: pipeline -type: docker -name: update_gitignore_and_licenses - -platform: - os: linux - arch: arm64 - -trigger: - branch: - - main - event: - - cron - cron: - - update_gitignore_and_licenses - -steps: - - name: download - image: gitea/test_env:linux-1.20-amd64 - pull: always - commands: - - timeout -s ABRT 40m make generate-license generate-gitignore - - - name: push - image: appleboy/drone-git-push - pull: always - settings: - author_email: "teabot@gitea.io" - author_name: "GiteaBot" - branch: main - commit: true - commit_message: "[skip ci] Updated licenses and gitignores" - remote: "git@github.com:go-gitea/gitea.git" - environment: - DRONE_COMMIT_AUTHOR_EMAIL: "teabot@gitea.io" - DRONE_COMMIT_AUTHOR: "GiteaBot" - GIT_PUSH_SSH_KEY: - from_secret: git_push_ssh_key - --- kind: pipeline type: docker diff --git a/.github/workflows/cron-licenses.yml b/.github/workflows/cron-licenses.yml new file mode 100644 index 0000000000..21ab72a5e9 --- /dev/null +++ b/.github/workflows/cron-licenses.yml @@ -0,0 +1,28 @@ +on: + cron: + # weekly on Monday at 0:07 UTC + - cron: "7 0 * * 1" + +name: Update licenses and gitignores + +jobs: + cron: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: '>=1.20.1' + - name: update licenses and gitignores + run: timeout -s ABRT 40m make generate-license generate-gitignore + - name: push translations to repo + uses: appleboy/git-push-action@v0.0.2 + with: + author_email: "teabot@gitea.io" + author_name: GiteaBot + branch: main + commit: true + commit_message: "[skip ci] Updated licenses and gitignores" + remote: "git@github.com:go-gitea/gitea.git" + ssh_key: ${{ secrets.DEPLOY_KEY }} diff --git a/.github/workflows/cron-translations.yml b/.github/workflows/cron-translations.yml new file mode 100644 index 0000000000..937a7a59a1 --- /dev/null +++ b/.github/workflows/cron-translations.yml @@ -0,0 +1,47 @@ +on: + cron: + - cron: "7 0 * * *" # every day at 0:07 UTC + +name: Pull translations from Crowdin + +jobs: + crowdin_pull: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: download from crowdin + uses: docker://jonasfranz/crowdin + env: + CROWDIN_KEY: ${{ secrets.CROWDIN_KEY }} + PLUGIN_DOWNLOAD: true + PLUGIN_EXPORT_DIR: options/locale/ + PLUGIN_IGNORE_BRANCH: true + PLUGIN_PROJECT_IDENTIFIER: gitea + - name: update locales + run: ./build/update-locales.sh + - name: push translations to repo + uses: appleboy/git-push-action@v0.0.2 + with: + author_email: "teabot@gitea.io" + author_name: GiteaBot + branch: main + commit: true + commit_message: "[skip ci] Updated translations via Crowdin" + remote: "git@github.com:go-gitea/gitea.git" + ssh_key: ${{ secrets.DEPLOY_KEY }} + crowdin_push: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: push translations to crowdin + uses: docker://jonasfranz/crowdin + env: + CROWDIN_KEY: ${{ secrets.CROWDIN_KEY }} + PLUGIN_UPLOAD: true + PLUGIN_IGNORE_BRANCH: true + PLUGIN_PROJECT_IDENTIFIER: gitea + PLUGIN_FILES: | + locale_en-US.ini: options/locale/locale_en-US.ini + PLUGIN_BRANCH: main From abc5f8c235f5de617b729eb9de9e5c355f52ba7c Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Tue, 25 Apr 2023 21:38:33 -0400 Subject: [PATCH 095/101] on schedule --- .github/workflows/cron-licenses.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cron-licenses.yml b/.github/workflows/cron-licenses.yml index 21ab72a5e9..116b8dd095 100644 --- a/.github/workflows/cron-licenses.yml +++ b/.github/workflows/cron-licenses.yml @@ -1,5 +1,5 @@ on: - cron: + schedule: # weekly on Monday at 0:07 UTC - cron: "7 0 * * 1" From 2ec2d065316a488c4748061fe7b19f0b57f3546f Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Tue, 25 Apr 2023 21:38:49 -0400 Subject: [PATCH 096/101] on schedule --- .github/workflows/cron-translations.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cron-translations.yml b/.github/workflows/cron-translations.yml index 937a7a59a1..31262fd3dd 100644 --- a/.github/workflows/cron-translations.yml +++ b/.github/workflows/cron-translations.yml @@ -1,5 +1,5 @@ on: - cron: + schedule: - cron: "7 0 * * *" # every day at 0:07 UTC name: Pull translations from Crowdin From 5f21e0f8eb66791fc86c07baac80b485fd5965fc Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Wed, 26 Apr 2023 11:25:29 +0900 Subject: [PATCH 097/101] Automatically select the org when click create repo from org dashboard (#24325) ![image](https://user-images.githubusercontent.com/18380374/234209941-d661b07f-e963-427b-a673-78c46043a792.png) In org dashboard, the create repo link will be `repo/create?org={orgId}` --- templates/user/dashboard/repolist.tmpl | 6 ++++-- web_src/js/components/DashboardRepoList.vue | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl index 0a8f427f9d..20638aab41 100644 --- a/templates/user/dashboard/repolist.tmpl +++ b/templates/user/dashboard/repolist.tmpl @@ -44,8 +44,10 @@ data.teamId = {{.Team.ID}}; {{if not .ContextUser.IsOrganization}} data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'num_repos': {{.NumRepos}}},{{end}}]; data.isOrganization = false; -data.organizationsTotalCount = {{.UserOrgsCount}} -data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}} +data.organizationsTotalCount = {{.UserOrgsCount}}; +data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}}; +{{else}} +data.organizationId = {{.ContextUser.ID}}; {{end}} window.config.pageData.dashboardRepoList = data; diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue index 1af53aac90..33b312aa6e 100644 --- a/web_src/js/components/DashboardRepoList.vue +++ b/web_src/js/components/DashboardRepoList.vue @@ -10,7 +10,7 @@ {{ textMyRepos }} {{ reposTotalCount }}
- + {{ textNewRepo }} @@ -199,6 +199,7 @@ const sfc = { isOrganization: true, canCreateOrganization: false, organizationsTotalCount: 0, + organizationId: 0, subUrl: appSubUrl, ...pageData.dashboardRepoList, From 59d060622d375c4123ea88e2fa6c4f34d4fea4d3 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 26 Apr 2023 10:53:44 +0800 Subject: [PATCH 098/101] Improve RSS (#24335) Follow #22719 ### Major changes 1. `ServerError` doesn't do format, so remove the `%s` 2. Simplify `RenderBranchFeed` (slightly) 3. Remove unused `BranchFeedRSS` 4. Make `feed.RenderBranchFeed` respect `EnableFeed` config 5. Make `RepoBranchTagSelector.vue` respect `EnableFeed` setting, otherwise there is always RSS icon 6. The `(branchURLPrefix + item.url).replace('src', 'rss')` doesn't seem right for all cases, for example, the string `src` could appear in `branchURLPrefix`, so we need a separate `rssURLPrefix` 7. The `` in Vue menu needs `@click.stop`, otherwise the menu itself would be triggered at the same time 8. Change `` to `` 9. Use `{{PathEscapeSegments .TreePath}}` instead of `{{range $i, $v := .TreeNames}}/{{$v}}{{end}}` Screenshot of changed parts:
![image](https://user-images.githubusercontent.com/2114189/234315538-66603694-9093-48a8-af33-83575fd7a018.png) ![image](https://user-images.githubusercontent.com/2114189/234315786-f1efa60b-012e-490b-8ce2-d448dc6fe5c9.png) ![image](https://user-images.githubusercontent.com/2114189/234334941-446941bc-1baa-4256-8850-ccc439476cda.png)
### Other thoughts Should we remove the RSS icon from the branch dropdown list? It seems too complex for a list UI, and users already have the chance to get the RSS feed URL from "branches" page. --------- Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: silverwind --- routers/web/feed/branch.go | 2 +- routers/web/feed/file.go | 2 +- routers/web/feed/render.go | 12 ++++-------- routers/web/repo/branch.go | 6 ------ routers/web/web.go | 4 ++-- templates/repo/branch_dropdown.tmpl | 2 ++ templates/repo/home.tmpl | 5 +++-- templates/repo/view_file.tmpl | 4 +--- tests/integration/pull_create_test.go | 2 +- web_src/js/components/RepoBranchTagSelector.vue | 11 ++++++++++- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/routers/web/feed/branch.go b/routers/web/feed/branch.go index fb9d2a7351..22b6e2f14b 100644 --- a/routers/web/feed/branch.go +++ b/routers/web/feed/branch.go @@ -18,7 +18,7 @@ import ( func ShowBranchFeed(ctx *context.Context, repo *repo.Repository, formatType string) { commits, err := ctx.Repo.Commit.CommitsByRange(0, 10) if err != nil { - ctx.ServerError("ShowBranchFeed %s", err) + ctx.ServerError("ShowBranchFeed", err) return } diff --git a/routers/web/feed/file.go b/routers/web/feed/file.go index 3dc9a4e27f..6a8d0c454d 100644 --- a/routers/web/feed/file.go +++ b/routers/web/feed/file.go @@ -23,7 +23,7 @@ func ShowFileFeed(ctx *context.Context, repo *repo.Repository, formatType string } commits, err := ctx.Repo.GitRepo.CommitsByFileAndRange(ctx.Repo.RefName, fileName, 1) if err != nil { - ctx.ServerError("ShowBranchFeed %s", err) + ctx.ServerError("ShowBranchFeed", err) return } diff --git a/routers/web/feed/render.go b/routers/web/feed/render.go index 0f327f87f2..8931dae8cc 100644 --- a/routers/web/feed/render.go +++ b/routers/web/feed/render.go @@ -4,19 +4,15 @@ package feed import ( - model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/context" ) // RenderBranchFeed render format for branch or file func RenderBranchFeed(ctx *context.Context) { _, _, showFeedType := GetFeedType(ctx.Params(":reponame"), ctx.Req) - var renderer func(ctx *context.Context, repo *model.Repository, formatType string) - switch { - case ctx.Repo.TreePath == "": - renderer = ShowBranchFeed - case ctx.Repo.TreePath != "": - renderer = ShowFileFeed + if ctx.Repo.TreePath == "" { + ShowBranchFeed(ctx, ctx.Repo.Repository, showFeedType) + } else { + ShowFileFeed(ctx, ctx.Repo.Repository, showFeedType) } - renderer(ctx, ctx.Repo.Repository, showFeedType) } diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go index 1014449f78..9f26634311 100644 --- a/routers/web/repo/branch.go +++ b/routers/web/repo/branch.go @@ -25,7 +25,6 @@ import ( "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/web" "code.gitea.io/gitea/routers/utils" - "code.gitea.io/gitea/routers/web/feed" "code.gitea.io/gitea/services/forms" release_service "code.gitea.io/gitea/services/release" repo_service "code.gitea.io/gitea/services/repository" @@ -341,11 +340,6 @@ func getDeletedBranches(ctx *context.Context) ([]*Branch, error) { return branches, nil } -// BranchFeedRSS get feeds for tags in RSS format -func BranchFeedRSS(ctx *context.Context) { - feed.ShowBranchFeed(ctx, ctx.Repo.Repository, "rss") -} - // CreateBranch creates new branch in repository func CreateBranch(ctx *context.Context) { form := web.GetForm(ctx).(*forms.NewBranchForm) diff --git a/routers/web/web.go b/routers/web/web.go index af39059325..779499889f 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1454,8 +1454,8 @@ func RegisterRoutes(m *web.Route) { m.Get("/cherry-pick/{sha:([a-f0-9]{7,40})$}", repo.SetEditorconfigIfExists, repo.CherryPick) }, repo.MustBeNotEmpty, context.RepoRef(), reqRepoCodeReader) - m.Get("/rss/branch/*", context.RepoRefByType(context.RepoRefBranch), feed.RenderBranchFeed) - m.Get("/atom/branch/*", context.RepoRefByType(context.RepoRefBranch), feed.RenderBranchFeed) + m.Get("/rss/branch/*", context.RepoRefByType(context.RepoRefBranch), feedEnabled, feed.RenderBranchFeed) + m.Get("/atom/branch/*", context.RepoRefByType(context.RepoRefBranch), feedEnabled, feed.RenderBranchFeed) m.Group("/src", func() { m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.Home) diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl index 1ec4b7ef16..0f79474d10 100644 --- a/templates/repo/branch_dropdown.tmpl +++ b/templates/repo/branch_dropdown.tmpl @@ -42,6 +42,8 @@ 'branches': {{.root.Branches}}, 'tags': {{.root.Tags}}, 'defaultBranch': {{$defaultBranch}}, + 'enableFeed': {{.root.EnableFeed}}, + 'rssURLPrefix': '{{$.root.RepoLink}}/rss/branch/', 'branchURLPrefix': '{{if .branchURLPrefix}}{{.branchURLPrefix}}{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/branch/{{end}}', 'branchURLSuffix': '{{if .branchURLSuffix}}{{.branchURLSuffix}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}', 'tagURLPrefix': '{{if .tagURLPrefix}}{{.tagURLPrefix}}{{else if .release}}{{$.root.RepoLink}}/compare/{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{end}}', diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 3f6cffbc8e..69f7f03880 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -64,8 +64,9 @@ {{$l := Eval $n "-" 1}} {{if and (eq $n 0) .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} -
- + + {{svg "octicon-git-pull-request"}} {{end}} {{if eq $n 0}} diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index fe67de5392..03f90d71f2 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -43,9 +43,7 @@ {{svg "octicon-download"}} {{svg "octicon-copy" 14}} {{if .EnableFeed}} - - {{svg "octicon-rss" 14}} - + {{svg "octicon-rss" 14}} {{end}} {{if .Repository.CanEnableEditor}} {{if .CanEditFile}} diff --git a/tests/integration/pull_create_test.go b/tests/integration/pull_create_test.go index 3a13fb4fcb..6e2d65ca0a 100644 --- a/tests/integration/pull_create_test.go +++ b/tests/integration/pull_create_test.go @@ -22,7 +22,7 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch, titl // Click the PR button to create a pull htmlDoc := NewHTMLParser(t, resp.Body) - link, exists := htmlDoc.doc.Find("#new-pull-request").Parent().Attr("href") + link, exists := htmlDoc.doc.Find("#new-pull-request").Attr("href") assert.True(t, exists, "The template has changed") if branch != "master" { link = strings.Replace(link, ":master", ":"+branch, 1) diff --git a/web_src/js/components/RepoBranchTagSelector.vue b/web_src/js/components/RepoBranchTagSelector.vue index 863da6206f..d8451e8399 100644 --- a/web_src/js/components/RepoBranchTagSelector.vue +++ b/web_src/js/components/RepoBranchTagSelector.vue @@ -39,7 +39,7 @@ - {{template "repo/clone_script" .}} {{end}} {{else}}
{{.locale.Tr "repo.empty_message"}}
{{end}} + {{template "repo/clone_script" .}} From 75e35fb03a86e66fbddda30ef2b4d2df892d2b11 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 26 Apr 2023 06:09:29 +0200 Subject: [PATCH 100/101] Fix runner button height (#24338) Fixes https://github.com/go-gitea/gitea/issues/24326. Set size class and downsize any such buttons that have a dropdown icon because the dropdown icon increases button height artificially. [`:has()`](https://developer.mozilla.org/en-US/docs/Web/CSS/:has) is not supported in Firefox yet, but works fine with the experimental pref enabled. I see this as a graceful degradation in unsupporting browsers. --- templates/shared/actions/runner_list.tmpl | 2 +- web_src/css/base.css | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/shared/actions/runner_list.tmpl b/templates/shared/actions/runner_list.tmpl index 536ae6b066..572bc5e34a 100644 --- a/templates/shared/actions/runner_list.tmpl +++ b/templates/shared/actions/runner_list.tmpl @@ -4,7 +4,7 @@ {{.locale.Tr "actions.runners.runner_manage_panel"}} ({{.locale.Tr "admin.total" .Total}})