|
|
@ -1185,7 +1185,7 @@ func UpdateIssueStatus(ctx *context.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
for _, issue := range issues { |
|
|
|
for _, issue := range issues { |
|
|
|
if issue.IsClosed != isClosed { |
|
|
|
if issue.IsClosed != isClosed { |
|
|
|
if err := issue.ChangeStatus(ctx.User, isClosed); err != nil { |
|
|
|
if err := issue_service.ChangeStatus(issue, ctx.User, isClosed); err != nil { |
|
|
|
if models.IsErrDependenciesLeft(err) { |
|
|
|
if models.IsErrDependenciesLeft(err) { |
|
|
|
ctx.JSON(http.StatusPreconditionFailed, map[string]interface{}{ |
|
|
|
ctx.JSON(http.StatusPreconditionFailed, map[string]interface{}{ |
|
|
|
"error": "cannot close this issue because it still has open dependencies", |
|
|
|
"error": "cannot close this issue because it still has open dependencies", |
|
|
@ -1195,8 +1195,6 @@ func UpdateIssueStatus(ctx *context.Context) { |
|
|
|
ctx.ServerError("ChangeStatus", err) |
|
|
|
ctx.ServerError("ChangeStatus", err) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
notification.NotifyIssueChangeStatus(ctx.User, issue, isClosed) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ctx.JSON(200, map[string]interface{}{ |
|
|
|
ctx.JSON(200, map[string]interface{}{ |
|
|
@ -1286,7 +1284,7 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) { |
|
|
|
ctx.Flash.Info(ctx.Tr("repo.pulls.open_unmerged_pull_exists", pr.Index)) |
|
|
|
ctx.Flash.Info(ctx.Tr("repo.pulls.open_unmerged_pull_exists", pr.Index)) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
isClosed := form.Status == "close" |
|
|
|
isClosed := form.Status == "close" |
|
|
|
if err := issue.ChangeStatus(ctx.User, isClosed); err != nil { |
|
|
|
if err := issue_service.ChangeStatus(issue, ctx.User, isClosed); err != nil { |
|
|
|
log.Error("ChangeStatus: %v", err) |
|
|
|
log.Error("ChangeStatus: %v", err) |
|
|
|
|
|
|
|
|
|
|
|
if models.IsErrDependenciesLeft(err) { |
|
|
|
if models.IsErrDependenciesLeft(err) { |
|
|
@ -1300,15 +1298,12 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
if err := stopTimerIfAvailable(ctx.User, issue); err != nil { |
|
|
|
if err := stopTimerIfAvailable(ctx.User, issue); err != nil { |
|
|
|
ctx.ServerError("CreateOrStopIssueStopwatch", err) |
|
|
|
ctx.ServerError("CreateOrStopIssueStopwatch", err) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
log.Trace("Issue [%d] status changed to closed: %v", issue.ID, issue.IsClosed) |
|
|
|
log.Trace("Issue [%d] status changed to closed: %v", issue.ID, issue.IsClosed) |
|
|
|
|
|
|
|
|
|
|
|
notification.NotifyIssueChangeStatus(ctx.User, issue, isClosed) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|