Skip to content

Commit

Permalink
Disable editing tags (#23883)
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
Zettat123 authored Apr 3, 2023
1 parent 5ab1c7a commit cb6ed84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion models/repo/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/release/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit cb6ed84

Please sign in to comment.