@@ -1014,46 +1014,46 @@ func NewIssuePost(ctx *context.Context) {
10141014 }
10151015}
10161016
1017- // commentTag returns the CommentTag for a comment in/with the given repo, poster and issue
1018- func commentTag (repo * models.Repository , poster * models.User , issue * models.Issue ) (models.CommentTag , error ) {
1017+ // roleDescriptor returns the Role Decriptor for a comment in/with the given repo, poster and issue
1018+ func roleDescriptor (repo * models.Repository , poster * models.User , issue * models.Issue ) (models.RoleDescriptor , error ) {
10191019 perm , err := models .GetUserRepoPermission (repo , poster )
10201020 if err != nil {
1021- return models .CommentTagNone , err
1021+ return models .RoleDescriptorNone , err
10221022 }
10231023
1024- // By default the comment has no tags .
1025- commentTag := models .CommentTagNone
1024+ // By default the poster has no roles on the comment .
1025+ roleDescriptor := models .RoleDescriptorNone
10261026
10271027 // Check if the poster is owner of the repo.
10281028 if perm .IsOwner () {
1029- // If the poster isn't a admin, enable the owner Tag .
1029+ // If the poster isn't a admin, enable the owner role .
10301030 if ! poster .IsAdmin {
1031- commentTag = commentTag . WithTag (models .CommentTagOwner )
1031+ roleDescriptor = roleDescriptor . WithRole (models .RoleDescriptorOwner )
10321032 } else {
10331033
10341034 // Otherwise check if poster is the real repo admin.
10351035 ok , err := models .IsUserRealRepoAdmin (repo , poster )
10361036 if err != nil {
1037- return models .CommentTagNone , err
1037+ return models .RoleDescriptorNone , err
10381038 }
10391039 if ok {
1040- commentTag = commentTag . WithTag (models .CommentTagOwner )
1040+ roleDescriptor = roleDescriptor . WithRole (models .RoleDescriptorOwner )
10411041 }
10421042 }
10431043 }
10441044
1045- // Is the poster can write issues or pulls to the repo, enable the Writer tag .
1046- // Only enable this if the poster doesn't have the owner tag already.
1047- if ! commentTag . HasTag ("Owner" ) && perm .CanWriteIssuesOrPulls (issue .IsPull ) {
1048- commentTag = commentTag . WithTag (models .CommentTagWriter )
1045+ // Is the poster can write issues or pulls to the repo, enable the Writer role .
1046+ // Only enable this if the poster doesn't have the owner role already.
1047+ if ! roleDescriptor . HasRole ("Owner" ) && perm .CanWriteIssuesOrPulls (issue .IsPull ) {
1048+ roleDescriptor = roleDescriptor . WithRole (models .RoleDescriptorWriter )
10491049 }
1050-
1051- // If the poster is the actual poster of the issue, enable Poster tag .
1050+
1051+ // If the poster is the actual poster of the issue, enable Poster role .
10521052 if issue .IsPoster (poster .ID ) {
1053- commentTag = commentTag . WithTag (models .CommentTagPoster )
1053+ roleDescriptor = roleDescriptor . WithRole (models .RoleDescriptorPoster )
10541054 }
10551055
1056- return commentTag , nil
1056+ return roleDescriptor , nil
10571057}
10581058
10591059func getBranchData (ctx * context.Context , issue * models.Issue ) {
@@ -1256,9 +1256,9 @@ func ViewIssue(ctx *context.Context) {
12561256 }
12571257
12581258 var (
1259- tag models.CommentTag
1259+ tag models.RoleDescriptor
12601260 ok bool
1261- marked = make (map [int64 ]models.CommentTag )
1261+ marked = make (map [int64 ]models.RoleDescriptor )
12621262 comment * models.Comment
12631263 participants = make ([]* models.User , 1 , 10 )
12641264 )
@@ -1305,11 +1305,11 @@ func ViewIssue(ctx *context.Context) {
13051305 // check if dependencies can be created across repositories
13061306 ctx .Data ["AllowCrossRepositoryDependencies" ] = setting .Service .AllowCrossRepositoryDependencies
13071307
1308- if issue .ShowTag , err = commentTag (repo , issue .Poster , issue ); err != nil {
1309- ctx .ServerError ("commentTag " , err )
1308+ if issue .ShowRole , err = roleDescriptor (repo , issue .Poster , issue ); err != nil {
1309+ ctx .ServerError ("roleDescriptor " , err )
13101310 return
13111311 }
1312- marked [issue .PosterID ] = issue .ShowTag
1312+ marked [issue .PosterID ] = issue .ShowRole
13131313
13141314 // Render comments and and fetch participants.
13151315 participants [0 ] = issue .Poster
@@ -1340,16 +1340,16 @@ func ViewIssue(ctx *context.Context) {
13401340 // Check tag.
13411341 tag , ok = marked [comment .PosterID ]
13421342 if ok {
1343- comment .ShowTag = tag
1343+ comment .ShowRole = tag
13441344 continue
13451345 }
13461346
1347- comment .ShowTag , err = commentTag (repo , comment .Poster , issue )
1347+ comment .ShowRole , err = roleDescriptor (repo , comment .Poster , issue )
13481348 if err != nil {
1349- ctx .ServerError ("commentTag " , err )
1349+ ctx .ServerError ("roleDescriptor " , err )
13501350 return
13511351 }
1352- marked [comment .PosterID ] = comment .ShowTag
1352+ marked [comment .PosterID ] = comment .ShowRole
13531353 participants = addParticipant (comment .Poster , participants )
13541354 } else if comment .Type == models .CommentTypeLabel {
13551355 if err = comment .LoadLabel (); err != nil {
@@ -1439,16 +1439,16 @@ func ViewIssue(ctx *context.Context) {
14391439 // Check tag.
14401440 tag , ok = marked [c .PosterID ]
14411441 if ok {
1442- c .ShowTag = tag
1442+ c .ShowRole = tag
14431443 continue
14441444 }
14451445
1446- c .ShowTag , err = commentTag (repo , c .Poster , issue )
1446+ c .ShowRole , err = roleDescriptor (repo , c .Poster , issue )
14471447 if err != nil {
1448- ctx .ServerError ("commentTag " , err )
1448+ ctx .ServerError ("roleDescriptor " , err )
14491449 return
14501450 }
1451- marked [c .PosterID ] = c .ShowTag
1451+ marked [c .PosterID ] = c .ShowRole
14521452 participants = addParticipant (c .Poster , participants )
14531453 }
14541454 }
0 commit comments