From cb6ed84c4be5256badf5e99537ca304e2884a26e Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Tue, 4 Apr 2023 05:08:29 +0800 Subject: [PATCH] Disable editing tags (#23883) Fixes #23865 In GitHub, users cannot edit a tag. So in this PR the edit button will not be shown if the release's `IsTag` is `true` --- models/repo/release.go | 2 +- templates/repo/release/list.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/repo/release.go b/models/repo/release.go index f7b24044b9c2c..c8dd7fbc7a368 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 9bc87fa80b384..12aaa0bd71723 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -93,7 +93,7 @@ {{end}}
- {{if $.CanCreateRelease}} + {{if and $.CanCreateRelease (not .IsTag)}} {{svg "octicon-pencil"}}