예제 #1
0
  /** Setup the message headers and envelope (TO, CC, BCC). */
  protected void init() throws EmailException {
    if (args.projectCache != null) {
      projectState = args.projectCache.get(change.getProject());
    } else {
      projectState = null;
    }

    if (patchSet == null) {
      try {
        patchSet = args.db.get().patchSets().get(change.currentPatchSetId());
      } catch (OrmException err) {
        patchSet = null;
      }
    }

    if (patchSet != null && patchSetInfo == null) {
      try {
        patchSetInfo = args.patchSetInfoFactory.get(patchSet.getId());
      } catch (PatchSetInfoNotAvailableException err) {
        patchSetInfo = null;
      }
    }
    authors = getAuthors();

    super.init();

    if (changeMessage != null && changeMessage.getWrittenOn() != null) {
      setHeader("Date", new Date(changeMessage.getWrittenOn().getTime()));
    }
    setChangeSubjectHeader();
    setHeader("X-Gerrit-Change-Id", "" + change.getKey().get());
    setListIdHeader();
    setChangeUrlHeader();
    setCommitIdHeader();
  }
예제 #2
0
  public void setFrom(final Account.Id id) {
    super.setFrom(id);

    /** Is the from user in an email squelching group? */
    final IdentifiedUser user = args.identifiedUserFactory.create(id);
    final Set<AccountGroup.UUID> gids = user.getEffectiveGroups();
    for (final AccountGroup.UUID gid : gids) {
      if (args.groupCache.get(gid).isEmailOnlyAuthors()) {
        emailOnlyAuthors = true;
        break;
      }
    }
  }
예제 #3
0
 @Override
 protected void setupVelocityContext() {
   super.setupVelocityContext();
   velocityContext.put("change", change);
   velocityContext.put("changeId", change.getKey());
   velocityContext.put("coverLetter", getCoverLetter());
   velocityContext.put("branch", change.getDest());
   velocityContext.put("fromName", getNameFor(fromId));
   velocityContext.put(
       "projectName", //
       projectState != null ? projectState.getProject().getName() : null);
   velocityContext.put("patchSet", patchSet);
   velocityContext.put("patchSetInfo", patchSetInfo);
 }
예제 #4
0
 protected void add(final RecipientType rt, final Account.Id to) {
   if (!emailOnlyAuthors || authors.contains(to)) {
     super.add(rt, to);
   }
 }