@ -77,7 +77,7 @@ func MustAllowUserComment(ctx *context.Context) {
return
}
if issue . IsLocked && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) && ! ctx . Us er. IsAdmin {
if issue . IsLocked && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) && ! ctx . Do er. IsAdmin {
ctx . Flash . Error ( ctx . Tr ( "repo.issues.comment_on_locked" ) )
ctx . Redirect ( issue . HTMLURL ( ) )
return
@ -107,9 +107,9 @@ func MustAllowPulls(ctx *context.Context) {
}
// User can send pull request if owns a forked repository.
if ctx . IsSigned && repo_model . HasForkedRepo ( ctx . Us er. ID , ctx . Repo . Repository . ID ) {
if ctx . IsSigned && repo_model . HasForkedRepo ( ctx . Do er. ID , ctx . Repo . Repository . ID ) {
ctx . Repo . PullRequest . Allowed = true
ctx . Repo . PullRequest . HeadInfoSubURL = url . PathEscape ( ctx . Us er. Name ) + ":" + util . PathEscapeSegments ( ctx . Repo . BranchName )
ctx . Repo . PullRequest . HeadInfoSubURL = url . PathEscape ( ctx . Do er. Name ) + ":" + util . PathEscapeSegments ( ctx . Repo . BranchName )
}
}
@ -133,13 +133,13 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
if ctx . IsSigned {
switch viewType {
case "created_by" :
posterID = ctx . Us er. ID
posterID = ctx . Do er. ID
case "mentioned" :
mentionedID = ctx . Us er. ID
mentionedID = ctx . Do er. ID
case "assigned" :
assigneeID = ctx . Us er. ID
assigneeID = ctx . Do er. ID
case "review_requested" :
reviewRequestedID = ctx . Us er. ID
reviewRequestedID = ctx . Do er. ID
}
}
@ -259,7 +259,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
// Check read status
if ! ctx . IsSigned {
issues [ i ] . IsRead = true
} else if err = issues [ i ] . GetIsRead ( ctx . Us er. ID ) ; err != nil {
} else if err = issues [ i ] . GetIsRead ( ctx . Do er. ID ) ; err != nil {
ctx . ServerError ( "GetIsRead" , err )
return
}
@ -514,7 +514,7 @@ func RetrieveRepoReviewers(ctx *context.Context, repo *repo_model.Repository, is
posterID = 0
}
reviewers , err = models . GetReviewers ( repo , ctx . Us er. ID , posterID )
reviewers , err = models . GetReviewers ( repo , ctx . Do er. ID , posterID )
if err != nil {
ctx . ServerError ( "GetReviewers" , err )
return
@ -551,11 +551,11 @@ func RetrieveRepoReviewers(ctx *context.Context, repo *repo_model.Repository, is
if ctx . Repo . IsAdmin ( ) {
// Admin can dismiss or re-request any review requests
tmp . CanChange = true
} else if ctx . Us er != nil && ctx . Us er. ID == review . ReviewerID && review . Type == models . ReviewTypeRequest {
} else if ctx . Do er != nil && ctx . Do er. ID == review . ReviewerID && review . Type == models . ReviewTypeRequest {
// A user can refuse review requests
tmp . CanChange = true
} else if ( canChooseReviewer || ( ctx . Us er != nil && ctx . Us er. ID == issue . PosterID ) ) && review . Type != models . ReviewTypeRequest &&
ctx . Us er. ID != review . ReviewerID {
} else if ( canChooseReviewer || ( ctx . Do er != nil && ctx . Do er. ID == issue . PosterID ) ) && review . Type != models . ReviewTypeRequest &&
ctx . Do er. ID != review . ReviewerID {
// The poster of the PR, a manager, or official reviewers can re-request review from other reviewers
tmp . CanChange = true
}
@ -699,7 +699,7 @@ func RetrieveRepoMetas(ctx *context.Context, repo *repo_model.Repository, isPull
ctx . Data [ "Branches" ] = brs
// Contains true if the user can create issue dependencies
ctx . Data [ "CanCreateIssueDependencies" ] = ctx . Repo . CanCreateIssueDependencies ( ctx . Us er, isPull )
ctx . Data [ "CanCreateIssueDependencies" ] = ctx . Repo . CanCreateIssueDependencies ( ctx . Do er, isPull )
return labels
}
@ -859,7 +859,7 @@ func DeleteIssue(ctx *context.Context) {
return
}
if err := issue_service . DeleteIssue ( ctx . Us er, ctx . Repo . GitRepo , issue ) ; err != nil {
if err := issue_service . DeleteIssue ( ctx . Do er, ctx . Repo . GitRepo , issue ) ; err != nil {
ctx . ServerError ( "DeleteIssueByID" , err )
return
}
@ -1008,8 +1008,8 @@ func NewIssuePost(ctx *context.Context) {
RepoID : repo . ID ,
Repo : repo ,
Title : form . Title ,
PosterID : ctx . Us er. ID ,
Poster : ctx . Us er,
PosterID : ctx . Do er. ID ,
Poster : ctx . Do er,
MilestoneID : milestoneID ,
Content : form . Content ,
Ref : form . Ref ,
@ -1025,7 +1025,7 @@ func NewIssuePost(ctx *context.Context) {
}
if projectID > 0 {
if err := models . ChangeProjectAssign ( issue , ctx . Us er, projectID ) ; err != nil {
if err := models . ChangeProjectAssign ( issue , ctx . Do er, projectID ) ; err != nil {
ctx . ServerError ( "ChangeProjectAssign" , err )
return
}
@ -1177,10 +1177,10 @@ func ViewIssue(ctx *context.Context) {
ctx . Data [ "Title" ] = fmt . Sprintf ( "#%d - %s" , issue . Index , issue . Title )
iw := new ( models . IssueWatch )
if ctx . Us er != nil {
iw . UserID = ctx . Us er. ID
if ctx . Do er != nil {
iw . UserID = ctx . Do er. ID
iw . IssueID = issue . ID
iw . IsWatching , err = models . CheckIssueWatch ( ctx . Us er, issue )
iw . IsWatching , err = models . CheckIssueWatch ( ctx . Do er, issue )
if err != nil {
ctx . ServerError ( "CheckIssueWatch" , err )
return
@ -1260,8 +1260,8 @@ func ViewIssue(ctx *context.Context) {
if issue . IsPull {
canChooseReviewer := ctx . Repo . CanWrite ( unit . TypePullRequests )
if ! canChooseReviewer && ctx . Us er != nil && ctx . IsSigned {
canChooseReviewer , err = models . IsOfficialReviewer ( issue , ctx . Us er)
if ! canChooseReviewer && ctx . Do er != nil && ctx . IsSigned {
canChooseReviewer , err = models . IsOfficialReviewer ( issue , ctx . Do er)
if err != nil {
ctx . ServerError ( "IsOfficialReviewer" , err )
return
@ -1276,7 +1276,7 @@ func ViewIssue(ctx *context.Context) {
if ctx . IsSigned {
// Update issue-user.
if err = issue . ReadBy ( ctx . Us er. ID ) ; err != nil {
if err = issue . ReadBy ( ctx . Do er. ID ) ; err != nil {
ctx . ServerError ( "ReadBy" , err )
return
}
@ -1292,11 +1292,11 @@ func ViewIssue(ctx *context.Context) {
if ctx . Repo . Repository . IsTimetrackerEnabled ( ) {
if ctx . IsSigned {
// Deal with the stopwatch
ctx . Data [ "IsStopwatchRunning" ] = models . StopwatchExists ( ctx . Us er. ID , issue . ID )
ctx . Data [ "IsStopwatchRunning" ] = models . StopwatchExists ( ctx . Do er. ID , issue . ID )
if ! ctx . Data [ "IsStopwatchRunning" ] . ( bool ) {
var exists bool
var sw * models . Stopwatch
if exists , sw , err = models . HasUserStopwatch ( ctx . Us er. ID ) ; err != nil {
if exists , sw , err = models . HasUserStopwatch ( ctx . Do er. ID ) ; err != nil {
ctx . ServerError ( "HasUserStopwatch" , err )
return
}
@ -1316,7 +1316,7 @@ func ViewIssue(ctx *context.Context) {
ctx . Data [ "OtherStopwatchURL" ] = otherIssue . HTMLURL ( )
}
}
ctx . Data [ "CanUseTimetracker" ] = ctx . Repo . CanUseTimetracker ( issue , ctx . Us er)
ctx . Data [ "CanUseTimetracker" ] = ctx . Repo . CanUseTimetracker ( issue , ctx . Do er)
} else {
ctx . Data [ "CanUseTimetracker" ] = false
}
@ -1327,7 +1327,7 @@ func ViewIssue(ctx *context.Context) {
}
// Check if the user can use the dependencies
ctx . Data [ "CanCreateIssueDependencies" ] = ctx . Repo . CanCreateIssueDependencies ( ctx . Us er, issue . IsPull )
ctx . Data [ "CanCreateIssueDependencies" ] = ctx . Repo . CanCreateIssueDependencies ( ctx . Do er, issue . IsPull )
// check if dependencies can be created across repositories
ctx . Data [ "AllowCrossRepositoryDependencies" ] = setting . Service . AllowCrossRepositoryDependencies
@ -1511,7 +1511,7 @@ func ViewIssue(ctx *context.Context) {
if err := pull . LoadHeadRepo ( ) ; err != nil {
log . Error ( "LoadHeadRepo: %v" , err )
} else if pull . HeadRepo != nil && pull . HeadBranch != pull . HeadRepo . DefaultBranch {
perm , err := models . GetUserRepoPermission ( pull . HeadRepo , ctx . Us er)
perm , err := models . GetUserRepoPermission ( pull . HeadRepo , ctx . Do er)
if err != nil {
ctx . ServerError ( "GetUserRepoPermission" , err )
return
@ -1530,18 +1530,18 @@ func ViewIssue(ctx *context.Context) {
if err := pull . LoadBaseRepo ( ) ; err != nil {
log . Error ( "LoadBaseRepo: %v" , err )
}
perm , err := models . GetUserRepoPermission ( pull . BaseRepo , ctx . Us er)
perm , err := models . GetUserRepoPermission ( pull . BaseRepo , ctx . Do er)
if err != nil {
ctx . ServerError ( "GetUserRepoPermission" , err )
return
}
ctx . Data [ "AllowMerge" ] , err = pull_service . IsUserAllowedToMerge ( pull , perm , ctx . Us er)
ctx . Data [ "AllowMerge" ] , err = pull_service . IsUserAllowedToMerge ( pull , perm , ctx . Do er)
if err != nil {
ctx . ServerError ( "IsUserAllowedToMerge" , err )
return
}
if ctx . Data [ "CanMarkConversation" ] , err = models . CanMarkConversation ( issue , ctx . Us er) ; err != nil {
if ctx . Data [ "CanMarkConversation" ] , err = models . CanMarkConversation ( issue , ctx . Do er) ; err != nil {
ctx . ServerError ( "CanMarkConversation" , err )
return
}
@ -1581,8 +1581,8 @@ func ViewIssue(ctx *context.Context) {
ctx . Data [ "ShowMergeInstructions" ] = true
if pull . ProtectedBranch != nil {
var showMergeInstructions bool
if ctx . Us er != nil {
showMergeInstructions = pull . ProtectedBranch . CanUserPush ( ctx . Us er. ID )
if ctx . Do er != nil {
showMergeInstructions = pull . ProtectedBranch . CanUserPush ( ctx . Do er. ID )
}
cnt := pull . ProtectedBranch . GetGrantedApprovalsCount ( pull )
ctx . Data [ "IsBlockedByApprovals" ] = ! pull . ProtectedBranch . HasEnoughApprovals ( pull )
@ -1597,8 +1597,8 @@ func ViewIssue(ctx *context.Context) {
ctx . Data [ "ShowMergeInstructions" ] = showMergeInstructions
}
ctx . Data [ "WillSign" ] = false
if ctx . Us er != nil {
sign , key , _ , err := asymkey_service . SignMerge ( ctx , pull , ctx . Us er, pull . BaseRepo . RepoPath ( ) , pull . BaseBranch , pull . GetGitRefName ( ) )
if ctx . Do er != nil {
sign , key , _ , err := asymkey_service . SignMerge ( ctx , pull , ctx . Do er, pull . BaseRepo . RepoPath ( ) , pull . BaseBranch , pull . GetGitRefName ( ) )
ctx . Data [ "WillSign" ] = sign
ctx . Data [ "SigningKey" ] = key
if err != nil {
@ -1636,7 +1636,7 @@ func ViewIssue(ctx *context.Context) {
if pull . CanAutoMerge ( ) || pull . IsWorkInProgress ( ) || pull . IsChecking ( ) {
return false
}
if ( ctx . Us er. IsAdmin || ctx . Repo . IsAdmin ( ) ) && prConfig . AllowManualMerge {
if ( ctx . Do er. IsAdmin || ctx . Repo . IsAdmin ( ) ) && prConfig . AllowManualMerge {
return true
}
@ -1663,16 +1663,16 @@ func ViewIssue(ctx *context.Context) {
ctx . Data [ "Issue" ] = issue
ctx . Data [ "Reference" ] = issue . Ref
ctx . Data [ "SignInLink" ] = setting . AppSubURL + "/user/login?redirect_to=" + url . QueryEscape ( ctx . Data [ "Link" ] . ( string ) )
ctx . Data [ "IsIssuePoster" ] = ctx . IsSigned && issue . IsPoster ( ctx . Us er. ID )
ctx . Data [ "IsIssuePoster" ] = ctx . IsSigned && issue . IsPoster ( ctx . Do er. ID )
ctx . Data [ "HasIssuesOrPullsWritePermission" ] = ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull )
ctx . Data [ "HasProjectsWritePermission" ] = ctx . Repo . CanWrite ( unit . TypeProjects )
ctx . Data [ "IsRepoAdmin" ] = ctx . IsSigned && ( ctx . Repo . IsAdmin ( ) || ctx . Us er. IsAdmin )
ctx . Data [ "IsRepoAdmin" ] = ctx . IsSigned && ( ctx . Repo . IsAdmin ( ) || ctx . Do er. IsAdmin )
ctx . Data [ "LockReasons" ] = setting . Repository . Issue . LockReasons
ctx . Data [ "RefEndName" ] = git . RefEndName ( issue . Ref )
var hiddenCommentTypes * big . Int
if ctx . IsSigned {
val , err := user_model . GetUserSetting ( ctx . Us er. ID , user_model . SettingsKeyHiddenCommentTypes )
val , err := user_model . GetUserSetting ( ctx . Do er. ID , user_model . SettingsKeyHiddenCommentTypes )
if err != nil {
ctx . ServerError ( "GetUserSetting" , err )
return
@ -1754,7 +1754,7 @@ func UpdateIssueTitle(ctx *context.Context) {
return
}
if ! ctx . IsSigned || ( ! issue . IsPoster ( ctx . Us er. ID ) && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) ) {
if ! ctx . IsSigned || ( ! issue . IsPoster ( ctx . Do er. ID ) && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) ) {
ctx . Error ( http . StatusForbidden )
return
}
@ -1765,7 +1765,7 @@ func UpdateIssueTitle(ctx *context.Context) {
return
}
if err := issue_service . ChangeTitle ( issue , ctx . Us er, title ) ; err != nil {
if err := issue_service . ChangeTitle ( issue , ctx . Do er, title ) ; err != nil {
ctx . ServerError ( "ChangeTitle" , err )
return
}
@ -1782,14 +1782,14 @@ func UpdateIssueRef(ctx *context.Context) {
return
}
if ! ctx . IsSigned || ( ! issue . IsPoster ( ctx . Us er. ID ) && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) ) || issue . IsPull {
if ! ctx . IsSigned || ( ! issue . IsPoster ( ctx . Do er. ID ) && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) ) || issue . IsPull {
ctx . Error ( http . StatusForbidden )
return
}
ref := ctx . FormTrim ( "ref" )
if err := issue_service . ChangeIssueRef ( issue , ctx . Us er, ref ) ; err != nil {
if err := issue_service . ChangeIssueRef ( issue , ctx . Do er, ref ) ; err != nil {
ctx . ServerError ( "ChangeRef" , err )
return
}
@ -1806,12 +1806,12 @@ func UpdateIssueContent(ctx *context.Context) {
return
}
if ! ctx . IsSigned || ( ctx . Us er. ID != issue . PosterID && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) ) {
if ! ctx . IsSigned || ( ctx . Do er. ID != issue . PosterID && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) ) {
ctx . Error ( http . StatusForbidden )
return
}
if err := issue_service . ChangeContent ( issue , ctx . Us er, ctx . Req . FormValue ( "content" ) ) ; err != nil {
if err := issue_service . ChangeContent ( issue , ctx . Do er, ctx . Req . FormValue ( "content" ) ) ; err != nil {
ctx . ServerError ( "ChangeContent" , err )
return
}
@ -1855,7 +1855,7 @@ func UpdateIssueMilestone(ctx *context.Context) {
continue
}
issue . MilestoneID = milestoneID
if err := issue_service . ChangeMilestoneAssign ( issue , ctx . Us er, oldMilestoneID ) ; err != nil {
if err := issue_service . ChangeMilestoneAssign ( issue , ctx . Do er, oldMilestoneID ) ; err != nil {
ctx . ServerError ( "ChangeMilestoneAssign" , err )
return
}
@ -1879,7 +1879,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
for _ , issue := range issues {
switch action {
case "clear" :
if err := issue_service . DeleteNotPassedAssignee ( issue , ctx . Us er, [ ] * user_model . User { } ) ; err != nil {
if err := issue_service . DeleteNotPassedAssignee ( issue , ctx . Do er, [ ] * user_model . User { } ) ; err != nil {
ctx . ServerError ( "ClearAssignees" , err )
return
}
@ -1900,7 +1900,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
return
}
_ , _ , err = issue_service . ToggleAssignee ( issue , ctx . Us er, assigneeID )
_ , _ , err = issue_service . ToggleAssignee ( issue , ctx . Do er, assigneeID )
if err != nil {
ctx . ServerError ( "ToggleAssignee" , err )
return
@ -1972,7 +1972,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
return
}
err = issue_service . IsValidTeamReviewRequest ( team , ctx . Us er, action == "attach" , issue )
err = issue_service . IsValidTeamReviewRequest ( team , ctx . Do er, action == "attach" , issue )
if err != nil {
if models . IsErrNotValidReviewRequest ( err ) {
log . Warn (
@ -1987,7 +1987,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
return
}
_ , err = issue_service . TeamReviewRequest ( issue , ctx . Us er, team , action == "attach" )
_ , err = issue_service . TeamReviewRequest ( issue , ctx . Do er, team , action == "attach" )
if err != nil {
ctx . ServerError ( "TeamReviewRequest" , err )
return
@ -2010,7 +2010,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
return
}
err = issue_service . IsValidReviewRequest ( reviewer , ctx . Us er, action == "attach" , issue , nil )
err = issue_service . IsValidReviewRequest ( reviewer , ctx . Do er, action == "attach" , issue , nil )
if err != nil {
if models . IsErrNotValidReviewRequest ( err ) {
log . Warn (
@ -2025,7 +2025,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
return
}
_ , err = issue_service . ReviewRequest ( issue , ctx . Us er, reviewer , action == "attach" )
_ , err = issue_service . ReviewRequest ( issue , ctx . Do er, reviewer , action == "attach" )
if err != nil {
ctx . ServerError ( "ReviewRequest" , err )
return
@ -2060,7 +2060,7 @@ func UpdateIssueStatus(ctx *context.Context) {
}
for _ , issue := range issues {
if issue . IsClosed != isClosed {
if err := issue_service . ChangeStatus ( issue , ctx . Us er, isClosed ) ; err != nil {
if err := issue_service . ChangeStatus ( issue , ctx . Do er, isClosed ) ; err != nil {
if models . IsErrDependenciesLeft ( err ) {
ctx . JSON ( http . StatusPreconditionFailed , map [ string ] interface { } {
"error" : "cannot close this issue because it still has open dependencies" ,
@ -2085,7 +2085,7 @@ func NewComment(ctx *context.Context) {
return
}
if ! ctx . IsSigned || ( ctx . Us er. ID != issue . PosterID && ! ctx . Repo . CanReadIssuesOrPulls ( issue . IsPull ) ) {
if ! ctx . IsSigned || ( ctx . Do er. ID != issue . PosterID && ! ctx . Repo . CanReadIssuesOrPulls ( issue . IsPull ) ) {
if log . IsTrace ( ) {
if ctx . IsSigned {
issueType := "issues"
@ -2094,7 +2094,7 @@ func NewComment(ctx *context.Context) {
}
log . Trace ( "Permission Denied: User %-v not the Poster (ID: %d) and cannot read %s in Repo %-v.\n" +
"User in Repo has Permissions: %-+v" ,
ctx . Us er,
ctx . Do er,
log . NewColoredIDValue ( issue . PosterID ) ,
issueType ,
ctx . Repo . Repository ,
@ -2108,7 +2108,7 @@ func NewComment(ctx *context.Context) {
return
}
if issue . IsLocked && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) && ! ctx . Us er. IsAdmin {
if issue . IsLocked && ! ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) && ! ctx . Do er. IsAdmin {
ctx . Flash . Error ( ctx . Tr ( "repo.issues.comment_on_locked" ) )
ctx . Redirect ( issue . HTMLURL ( ) , http . StatusSeeOther )
return
@ -2128,7 +2128,7 @@ func NewComment(ctx *context.Context) {
var comment * models . Comment
defer func ( ) {
// Check if issue admin/poster changes the status of issue.
if ( ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) || ( ctx . IsSigned && issue . IsPoster ( ctx . Us er. ID ) ) ) &&
if ( ctx . Repo . CanWriteIssuesOrPulls ( issue . IsPull ) || ( ctx . IsSigned && issue . IsPoster ( ctx . Do er. ID ) ) ) &&
( form . Status == "reopen" || form . Status == "close" ) &&
! ( issue . IsPull && issue . PullRequest . HasMerged ) {
@ -2157,7 +2157,7 @@ func NewComment(ctx *context.Context) {
ctx . Flash . Info ( ctx . Tr ( "repo.pulls.open_unmerged_pull_exists" , pr . Index ) )
} else {
isClosed := form . Status == "close"
if err := issue_service . ChangeStatus ( issue , ctx . Us er, isClosed ) ; err != nil {
if err := issue_service . ChangeStatus ( issue , ctx . Do er, isClosed ) ; err != nil {
log . Error ( "ChangeStatus: %v" , err )
if models . IsErrDependenciesLeft ( err ) {
@ -2171,7 +2171,7 @@ func NewComment(ctx *context.Context) {
return
}
} else {
if err := stopTimerIfAvailable ( ctx . Us er, issue ) ; err != nil {
if err := stopTimerIfAvailable ( ctx . Do er, issue ) ; err != nil {
ctx . ServerError ( "CreateOrStopIssueStopwatch" , err )
return
}
@ -2198,7 +2198,7 @@ func NewComment(ctx *context.Context) {
return
}
comment , err := comment_service . CreateIssueComment ( ctx . Us er, ctx . Repo . Repository , issue , form . Content , attachments )
comment , err := comment_service . CreateIssueComment ( ctx . Do er, ctx . Repo . Repository , issue , form . Content , attachments )
if err != nil {
ctx . ServerError ( "CreateIssueComment" , err )
return
@ -2220,7 +2220,7 @@ func UpdateCommentContent(ctx *context.Context) {
return
}
if ! ctx . IsSigned || ( ctx . Us er. ID != comment . PosterID && ! ctx . Repo . CanWriteIssuesOrPulls ( comment . Issue . IsPull ) ) {
if ! ctx . IsSigned || ( ctx . Do er. ID != comment . PosterID && ! ctx . Repo . CanWriteIssuesOrPulls ( comment . Issue . IsPull ) ) {
ctx . Error ( http . StatusForbidden )
return
}
@ -2238,7 +2238,7 @@ func UpdateCommentContent(ctx *context.Context) {
} )
return
}
if err = comment_service . UpdateComment ( comment , ctx . Us er, oldContent ) ; err != nil {
if err = comment_service . UpdateComment ( comment , ctx . Do er, oldContent ) ; err != nil {
ctx . ServerError ( "UpdateComment" , err )
return
}
@ -2286,7 +2286,7 @@ func DeleteComment(ctx *context.Context) {
return
}
if ! ctx . IsSigned || ( ctx . Us er. ID != comment . PosterID && ! ctx . Repo . CanWriteIssuesOrPulls ( comment . Issue . IsPull ) ) {
if ! ctx . IsSigned || ( ctx . Do er. ID != comment . PosterID && ! ctx . Repo . CanWriteIssuesOrPulls ( comment . Issue . IsPull ) ) {
ctx . Error ( http . StatusForbidden )
return
} else if comment . Type != models . CommentTypeComment && comment . Type != models . CommentTypeCode {
@ -2294,7 +2294,7 @@ func DeleteComment(ctx *context.Context) {
return
}
if err = comment_service . DeleteComment ( ctx . Us er, comment ) ; err != nil {
if err = comment_service . DeleteComment ( ctx . Do er, comment ) ; err != nil {
ctx . ServerError ( "DeleteCommentByID" , err )
return
}
@ -2310,7 +2310,7 @@ func ChangeIssueReaction(ctx *context.Context) {
return
}
if ! ctx . IsSigned || ( ctx . Us er. ID != issue . PosterID && ! ctx . Repo . CanReadIssuesOrPulls ( issue . IsPull ) ) {
if ! ctx . IsSigned || ( ctx . Do er. ID != issue . PosterID && ! ctx . Repo . CanReadIssuesOrPulls ( issue . IsPull ) ) {
if log . IsTrace ( ) {
if ctx . IsSigned {
issueType := "issues"
@ -2319,7 +2319,7 @@ func ChangeIssueReaction(ctx *context.Context) {
}
log . Trace ( "Permission Denied: User %-v not the Poster (ID: %d) and cannot read %s in Repo %-v.\n" +
"User in Repo has Permissions: %-+v" ,
ctx . Us er,
ctx . Do er,
log . NewColoredIDValue ( issue . PosterID ) ,
issueType ,
ctx . Repo . Repository ,
@ -2340,7 +2340,7 @@ func ChangeIssueReaction(ctx *context.Context) {
switch ctx . Params ( ":action" ) {
case "react" :
reaction , err := models . CreateIssueReaction ( ctx . Us er, issue , form . Content )
reaction , err := models . CreateIssueReaction ( ctx . Do er, issue , form . Content )
if err != nil {
if models . IsErrForbiddenIssueReaction ( err ) {
ctx . ServerError ( "ChangeIssueReaction" , err )
@ -2358,7 +2358,7 @@ func ChangeIssueReaction(ctx *context.Context) {
log . Trace ( "Reaction for issue created: %d/%d/%d" , ctx . Repo . Repository . ID , issue . ID , reaction . ID )
case "unreact" :
if err := models . DeleteIssueReaction ( ctx . Us er, issue , form . Content ) ; err != nil {
if err := models . DeleteIssueReaction ( ctx . Do er, issue , form . Content ) ; err != nil {
ctx . ServerError ( "DeleteIssueReaction" , err )
return
}
@ -2412,7 +2412,7 @@ func ChangeCommentReaction(ctx *context.Context) {
return
}
if ! ctx . IsSigned || ( ctx . Us er. ID != comment . PosterID && ! ctx . Repo . CanReadIssuesOrPulls ( comment . Issue . IsPull ) ) {
if ! ctx . IsSigned || ( ctx . Do er. ID != comment . PosterID && ! ctx . Repo . CanReadIssuesOrPulls ( comment . Issue . IsPull ) ) {
if log . IsTrace ( ) {
if ctx . IsSigned {
issueType := "issues"
@ -2421,7 +2421,7 @@ func ChangeCommentReaction(ctx *context.Context) {
}
log . Trace ( "Permission Denied: User %-v not the Poster (ID: %d) and cannot read %s in Repo %-v.\n" +
"User in Repo has Permissions: %-+v" ,
ctx . Us er,
ctx . Do er,
log . NewColoredIDValue ( comment . Issue . PosterID ) ,
issueType ,
ctx . Repo . Repository ,
@ -2442,7 +2442,7 @@ func ChangeCommentReaction(ctx *context.Context) {
switch ctx . Params ( ":action" ) {
case "react" :
reaction , err := models . CreateCommentReaction ( ctx . Us er, comment . Issue , comment , form . Content )
reaction , err := models . CreateCommentReaction ( ctx . Do er, comment . Issue , comment , form . Content )
if err != nil {
if models . IsErrForbiddenIssueReaction ( err ) {
ctx . ServerError ( "ChangeIssueReaction" , err )
@ -2460,7 +2460,7 @@ func ChangeCommentReaction(ctx *context.Context) {
log . Trace ( "Reaction for comment created: %d/%d/%d/%d" , ctx . Repo . Repository . ID , comment . Issue . ID , comment . ID , reaction . ID )
case "unreact" :
if err := models . DeleteCommentReaction ( ctx . Us er, comment . Issue , comment , form . Content ) ; err != nil {
if err := models . DeleteCommentReaction ( ctx . Do er, comment . Issue , comment , form . Content ) ; err != nil {
ctx . ServerError ( "DeleteCommentReaction" , err )
return
}
@ -2520,7 +2520,7 @@ func filterXRefComments(ctx *context.Context, issue *models.Issue) error {
if err != nil {
return err
}
perm , err := models . GetUserRepoPermission ( c . RefRepo , ctx . Us er)
perm , err := models . GetUserRepoPermission ( c . RefRepo , ctx . Do er)
if err != nil {
return err
}
@ -2689,7 +2689,7 @@ func combineLabelComments(issue *models.Issue) {
// get all teams that current user can mention
func handleTeamMentions ( ctx * context . Context ) {
if ctx . Us er == nil || ! ctx . Repo . Owner . IsOrganization ( ) {
if ctx . Do er == nil || ! ctx . Repo . Owner . IsOrganization ( ) {
return
}
@ -2698,10 +2698,10 @@ func handleTeamMentions(ctx *context.Context) {
var teams [ ] * models . Team
org := models . OrgFromUser ( ctx . Repo . Owner )
// Admin has super access.
if ctx . Us er. IsAdmin {
if ctx . Do er. IsAdmin {
isAdmin = true
} else {
isAdmin , err = org . IsOwnedBy ( ctx . Us er. ID )
isAdmin , err = org . IsOwnedBy ( ctx . Do er. ID )
if err != nil {
ctx . ServerError ( "IsOwnedBy" , err )
return
@ -2715,7 +2715,7 @@ func handleTeamMentions(ctx *context.Context) {
return
}
} else {
teams , err = org . GetUserTeams ( ctx . Us er. ID )
teams , err = org . GetUserTeams ( ctx . Do er. ID )
if err != nil {
ctx . ServerError ( "GetUserTeams" , err )
return