aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZettat123 <zettat123@gmail.com>2023-04-04 05:08:29 +0800
committerGitHub <noreply@github.com>2023-04-03 17:08:29 -0400
commitcb6ed84c4be5256badf5e99537ca304e2884a26e (patch)
treecb7abdd3da2282a00fb6734ec524ec70362c698d
parent5ab1c7acecef981ab9f6ac43b245761efb0e8dbe (diff)
downloadgitea-cb6ed84c4be5256badf5e99537ca304e2884a26e.tar.gz
gitea-cb6ed84c4be5256badf5e99537ca304e2884a26e.zip
Disable editing tags (#23883)
Fixes #23865 In GitHub, users cannot edit a tag. <img src="https://user-images.githubusercontent.com/15528715/229409445-4233941b-3a37-4846-bc0c-efa94b90d9e0.png" width="600px" /> So in this PR the edit button will not be shown if the release's `IsTag` is `true`
-rw-r--r--models/repo/release.go2
-rw-r--r--templates/repo/release/list.tmpl2
2 files changed, 2 insertions, 2 deletions
diff --git a/models/repo/release.go b/models/repo/release.go
index f7b24044b9..c8dd7fbc7a 100644
--- a/models/repo/release.go
+++ b/models/repo/release.go
@@ -79,7 +79,7 @@ type Release struct {
RenderedNote string `xorm:"-"`
IsDraft bool `xorm:"NOT NULL DEFAULT false"`
IsPrerelease bool `xorm:"NOT NULL DEFAULT false"`
- IsTag bool `xorm:"NOT NULL DEFAULT false"`
+ IsTag bool `xorm:"NOT NULL DEFAULT false"` // will be true only if the record is a tag and has no related releases
Attachments []*Attachment `xorm:"-"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX"`
}
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 9bc87fa80b..12aaa0bd71 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -93,7 +93,7 @@
{{end}}
</h4>
<div class="gt-df gt-ac">
- {{if $.CanCreateRelease}}
+ {{if and $.CanCreateRelease (not .IsTag)}}
<a class="muted gt-ml-3 gt-df gt-ac" data-tooltip-content="{{$.locale.Tr "repo.release.edit"}}" href="{{$.RepoLink}}/releases/edit/{{.TagName | PathEscapeSegments}}" rel="nofollow">
{{svg "octicon-pencil"}}
</a>