diff options
author | a1012112796 <1012112796@qq.com> | 2020-11-28 23:52:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-28 17:52:29 +0200 |
commit | 1e5247d424de7f8a480c73b0b72119ae5482edf1 (patch) | |
tree | 350de4758a29357766273d049bc830535448e5d4 /routers/repo/issue.go | |
parent | 48c9865fce915c28fe3759cfb1b75c65feac2f55 (diff) | |
download | gitea-1e5247d424de7f8a480c73b0b72119ae5482edf1.tar.gz gitea-1e5247d424de7f8a480c73b0b72119ae5482edf1.zip |
ui: show 'owner' tag for real owner (#13689)
* ui: show 'owner' tag for real owner
Signed-off-by: a1012112796 <1012112796@qq.com>
* Update custom/conf/app.example.ini
* simplify logic
fix logic
fix a small bug about original author
* remove system manager tag
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r-- | routers/repo/issue.go | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 159cc5b9f0..ded9b3c208 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -980,8 +980,27 @@ func commentTag(repo *models.Repository, poster *models.User, issue *models.Issu return models.CommentTagNone, err } if perm.IsOwner() { - return models.CommentTagOwner, nil - } else if perm.CanWrite(models.UnitTypeCode) { + if !poster.IsAdmin { + return models.CommentTagOwner, nil + } + + ok, err := models.IsUserRealRepoAdmin(repo, poster) + if err != nil { + return models.CommentTagNone, err + } + + if ok { + return models.CommentTagOwner, nil + } + + if ok, err = repo.IsCollaborator(poster.ID); ok && err == nil { + return models.CommentTagWriter, nil + } + + return models.CommentTagNone, err + } + + if perm.CanWrite(models.UnitTypeCode) { return models.CommentTagWriter, nil } |