use of com.google.gerrit.extensions.api.changes.NotifyHandling in project gerrit by GerritCodeReview.
the class PostReviewers method prepareApplication.
public Addition prepareApplication(ChangeResource rsrc, AddReviewerInput input, boolean allowGroup) throws OrmException, IOException, PermissionBackendException {
String reviewer = input.reviewer;
ReviewerState state = input.state();
NotifyHandling notify = input.notify;
ListMultimap<RecipientType, Account.Id> accountsToNotify = null;
try {
accountsToNotify = notifyUtil.resolveAccounts(input.notifyDetails);
} catch (BadRequestException e) {
return fail(reviewer, e.getMessage());
}
boolean confirmed = input.confirmed();
boolean allowByEmail = projectCache.checkedGet(rsrc.getProject()).isEnableReviewerByEmail();
Addition byAccountId = addByAccountId(reviewer, rsrc, state, notify, accountsToNotify, allowGroup, allowByEmail);
if (byAccountId != null) {
return byAccountId;
}
Addition wholeGroup = addWholeGroup(reviewer, rsrc, state, notify, accountsToNotify, confirmed, allowGroup, allowByEmail);
if (wholeGroup != null) {
return wholeGroup;
}
return addByEmail(reviewer, rsrc, state, notify, accountsToNotify);
}
use of com.google.gerrit.extensions.api.changes.NotifyHandling in project gerrit by GerritCodeReview.
the class ReplaceOp method postUpdate.
@Override
public void postUpdate(Context ctx) throws Exception {
if (changeKind != ChangeKind.TRIVIAL_REBASE) {
// TODO(dborowitz): Merge email templates so we only have to send one.
Runnable e = new ReplaceEmailTask(ctx);
if (requestScopePropagator != null) {
@SuppressWarnings("unused") Future<?> possiblyIgnoredError = sendEmailExecutor.submit(requestScopePropagator.wrap(e));
} else {
e.run();
}
}
NotifyHandling notify = magicBranch != null && magicBranch.notify != null ? magicBranch.notify : NotifyHandling.ALL;
if (shouldPublishComments()) {
emailCommentsFactory.create(notify, magicBranch != null ? magicBranch.getAccountsToNotify() : ImmutableListMultimap.of(), notes, newPatchSet, ctx.getUser().asIdentifiedUser(), msg, comments, msg.getMessage(), // TODO(dborowitz): Include labels.
ImmutableList.of()).sendAsync();
}
revisionCreated.fire(notes.getChange(), newPatchSet, ctx.getAccount(), ctx.getWhen(), notify);
try {
fireCommentAddedEvent(ctx);
} catch (Exception e) {
log.warn("comment-added event invocation failed", e);
}
if (mergedByPushOp != null) {
mergedByPushOp.postUpdate(ctx);
}
}
Aggregations