Skip to content

Commit cb6ed84

Browse files
authored
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`
1 parent 5ab1c7a commit cb6ed84

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

models/repo/release.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type Release struct {
7979
RenderedNote string `xorm:"-"`
8080
IsDraft bool `xorm:"NOT NULL DEFAULT false"`
8181
IsPrerelease bool `xorm:"NOT NULL DEFAULT false"`
82-
IsTag bool `xorm:"NOT NULL DEFAULT false"`
82+
IsTag bool `xorm:"NOT NULL DEFAULT false"` // will be true only if the record is a tag and has no related releases
8383
Attachments []*Attachment `xorm:"-"`
8484
CreatedUnix timeutil.TimeStamp `xorm:"INDEX"`
8585
}

templates/repo/release/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
{{end}}
9494
</h4>
9595
<div class="gt-df gt-ac">
96-
{{if $.CanCreateRelease}}
96+
{{if and $.CanCreateRelease (not .IsTag)}}
9797
<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">
9898
{{svg "octicon-pencil"}}
9999
</a>

0 commit comments

Comments
 (0)