@@ -1014,46 +1014,46 @@ func NewIssuePost(ctx *context.Context) {
1014
1014
}
1015
1015
}
1016
1016
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 ) {
1019
1019
perm , err := models .GetUserRepoPermission (repo , poster )
1020
1020
if err != nil {
1021
- return models .CommentTagNone , err
1021
+ return models .RoleDescriptorNone , err
1022
1022
}
1023
1023
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
1026
1026
1027
1027
// Check if the poster is owner of the repo.
1028
1028
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 .
1030
1030
if ! poster .IsAdmin {
1031
- commentTag = commentTag . WithTag (models .CommentTagOwner )
1031
+ roleDescriptor = roleDescriptor . WithRole (models .RoleDescriptorOwner )
1032
1032
} else {
1033
1033
1034
1034
// Otherwise check if poster is the real repo admin.
1035
1035
ok , err := models .IsUserRealRepoAdmin (repo , poster )
1036
1036
if err != nil {
1037
- return models .CommentTagNone , err
1037
+ return models .RoleDescriptorNone , err
1038
1038
}
1039
1039
if ok {
1040
- commentTag = commentTag . WithTag (models .CommentTagOwner )
1040
+ roleDescriptor = roleDescriptor . WithRole (models .RoleDescriptorOwner )
1041
1041
}
1042
1042
}
1043
1043
}
1044
1044
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 )
1049
1049
}
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 .
1052
1052
if issue .IsPoster (poster .ID ) {
1053
- commentTag = commentTag . WithTag (models .CommentTagPoster )
1053
+ roleDescriptor = roleDescriptor . WithRole (models .RoleDescriptorPoster )
1054
1054
}
1055
1055
1056
- return commentTag , nil
1056
+ return roleDescriptor , nil
1057
1057
}
1058
1058
1059
1059
func getBranchData (ctx * context.Context , issue * models.Issue ) {
@@ -1256,9 +1256,9 @@ func ViewIssue(ctx *context.Context) {
1256
1256
}
1257
1257
1258
1258
var (
1259
- tag models.CommentTag
1259
+ tag models.RoleDescriptor
1260
1260
ok bool
1261
- marked = make (map [int64 ]models.CommentTag )
1261
+ marked = make (map [int64 ]models.RoleDescriptor )
1262
1262
comment * models.Comment
1263
1263
participants = make ([]* models.User , 1 , 10 )
1264
1264
)
@@ -1305,11 +1305,11 @@ func ViewIssue(ctx *context.Context) {
1305
1305
// check if dependencies can be created across repositories
1306
1306
ctx .Data ["AllowCrossRepositoryDependencies" ] = setting .Service .AllowCrossRepositoryDependencies
1307
1307
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 )
1310
1310
return
1311
1311
}
1312
- marked [issue .PosterID ] = issue .ShowTag
1312
+ marked [issue .PosterID ] = issue .ShowRole
1313
1313
1314
1314
// Render comments and and fetch participants.
1315
1315
participants [0 ] = issue .Poster
@@ -1340,16 +1340,16 @@ func ViewIssue(ctx *context.Context) {
1340
1340
// Check tag.
1341
1341
tag , ok = marked [comment .PosterID ]
1342
1342
if ok {
1343
- comment .ShowTag = tag
1343
+ comment .ShowRole = tag
1344
1344
continue
1345
1345
}
1346
1346
1347
- comment .ShowTag , err = commentTag (repo , comment .Poster , issue )
1347
+ comment .ShowRole , err = roleDescriptor (repo , comment .Poster , issue )
1348
1348
if err != nil {
1349
- ctx .ServerError ("commentTag " , err )
1349
+ ctx .ServerError ("roleDescriptor " , err )
1350
1350
return
1351
1351
}
1352
- marked [comment .PosterID ] = comment .ShowTag
1352
+ marked [comment .PosterID ] = comment .ShowRole
1353
1353
participants = addParticipant (comment .Poster , participants )
1354
1354
} else if comment .Type == models .CommentTypeLabel {
1355
1355
if err = comment .LoadLabel (); err != nil {
@@ -1439,16 +1439,16 @@ func ViewIssue(ctx *context.Context) {
1439
1439
// Check tag.
1440
1440
tag , ok = marked [c .PosterID ]
1441
1441
if ok {
1442
- c .ShowTag = tag
1442
+ c .ShowRole = tag
1443
1443
continue
1444
1444
}
1445
1445
1446
- c .ShowTag , err = commentTag (repo , c .Poster , issue )
1446
+ c .ShowRole , err = roleDescriptor (repo , c .Poster , issue )
1447
1447
if err != nil {
1448
- ctx .ServerError ("commentTag " , err )
1448
+ ctx .ServerError ("roleDescriptor " , err )
1449
1449
return
1450
1450
}
1451
- marked [c .PosterID ] = c .ShowTag
1451
+ marked [c .PosterID ] = c .ShowRole
1452
1452
participants = addParticipant (c .Poster , participants )
1453
1453
}
1454
1454
}
0 commit comments