From ef44b777f41c547f6f5fc23eea614a5f8dcff716 Mon Sep 17 00:00:00 2001 From: Robert Wolff Date: Sat, 30 May 2026 14:02:33 +0200 Subject: [PATCH] fix: hide some disallowed actions that lead to 404 errors in archived repos (#12773) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This 1. hides the “New issue” button, which currently leads to a 404 page, because it is not useful to have it, e.g., here: https://code.forgejo.org/forgejo/act/issues/169 2. removes the UI ability on projects in archived repos to move around issues and project columns. When a user performs such an action, currently it is shown as it were successful, but actually all requests lead to 404s without warning. 3. hides the hints for synching a fork or creating a pull request for recently pushed branches (which again would lead to 404s) 4. hides the branch selector (only shows the branch) on single issue/PR pages, which is disfunctional on archived repos Thus, both these changes do not change anything related to what happens to issues or projects in archived repos, but only reduces 404 errors. I don’t think this needs to be tested more than manually. ## Test Create first a repository with at least **one issue** in **one project** and edit a file by creating a **new branch**. Then, perform following actions, once in the state where the repository is normal and once when it is archived: action|unarchived|archived ---|---|--- \1. go to the issue|“New issue” button functional|“New issue” button removed \2. click on the branch selector|menu opens|menu is now disabled and shows the branch \3. go to the project|“New issue” button functional|“New issue” button removed \4. try to move around columns|modifies columns|not possible anymore \5. try to move around the issue|modifies issue location|not possible anymore \6. go to the code view|see hint "You pushed …"|do not see this hint anymore Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12773 Reviewed-by: Gusted --- templates/projects/view.tmpl | 4 ++-- templates/repo/home.tmpl | 6 ++++-- .../issue/view_content/sidebar/branch_selector_field.tmpl | 7 ++++--- templates/repo/issue/view_title.tmpl | 2 +- templates/repo/projects/view.tmpl | 4 +++- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/templates/projects/view.tmpl b/templates/projects/view.tmpl index 3f7c91b35d..0e05c3d48f 100644 --- a/templates/projects/view.tmpl +++ b/templates/projects/view.tmpl @@ -63,7 +63,7 @@
-
+
{{range .Columns}}
@@ -165,7 +165,7 @@
-{{if .CanWriteProjects}} +{{if $canWriteProject}} - {{template "repo/code/recently_pushed_new_branches" .}} - {{template "repo/code/fork_sync_message" .}} + {{if (not .Repository.IsArchived)}} + {{template "repo/code/recently_pushed_new_branches" .}} + {{template "repo/code/fork_sync_message" .}} + {{end}} {{if .IsViewFile}} {{template "repo/view_file" .}} diff --git a/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl b/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl index 373be61026..d865a407aa 100644 --- a/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl +++ b/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl @@ -1,13 +1,14 @@ {{if and (not .Issue.IsPull) (not .PageIsComparePull)}} +{{$hasIssuesOrPullsWritePermission := and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} - +
{{/* TODO: share this branch selector dropdown with the same in repo page */}} -