瀏覽代碼

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`
tags/v1.20.0-rc0
Zettat123 1 年之前
父節點
當前提交
cb6ed84c4b
No account linked to committer's email address
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1
    1
      models/repo/release.go
  2. 1
    1
      templates/repo/release/list.tmpl

+ 1
- 1
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"`
}

+ 1
- 1
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>

Loading…
取消
儲存