Date: prev next · Thread: first prev next last
2018 Archives by date, by thread · List index



I just saw mail from Christian, where he is claiming that Jenkins user
can send mail to reviewers (I said the opposite), and is referencing
this mail from his mailbox:

X-Gerrit-ChangeURL: <https://gerrit.libreoffice.org/50436>

he got from Jenkins, where he is claiming he got the mail,
even though he is not the change owner.

That's correct, he is not the owner, Stephan Bergmann is the owner
of this change, but he is the author, because he performed the rebase
on patch set 1 of this change. So he is the uploader/committer of patch set 2.

When Jenkins is sending email, all reviewers are blocked, because
Jenkins user was granted DENY permission on EmailReviewers ACL,
so that Jenkins can only send email to authors of the change.
So the subtle term is who is considered to be an author of gerrit change?

Well, that's something very easy to find out, we are using open source tool,
and all we need is to read some code, and we are all developers here:

The gerrit code on branch 2.11 for ChangEmail.java is here:

gerrit-server/src/main/java/com/google/gerrit/server/mail/ChangeEmail.java

the relevant parts are here:

  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);
    emailOnlyAuthors = !user.getCapabilities().canEmailReviewers();
  }

^^^ Here you see where canEmailReviewers ACL is evaluated and is stored
in boolean emailOnlyAuthors.

  protected void add(final RecipientType rt, final Account.Id to) {
    if (! emailOnlyAuthors || authors.contains(to)) {
      super.add(rt, to);
    }
  }

^^^ Here you see, the part where emailOnlyAuthors considered and in Jenkins case this condition is always false. So the mail can be sent then and only then, when
the second condition evaluates to true: authors.contains(to)

/** Find all users who are authors of any part of this change. */
  protected Set<Account.Id> getAuthors() {
    Set<Account.Id> authors = new HashSet<>();

    authors.add(change.getOwner());
    if (patchSet != null) {
      authors.add(patchSet.getUploader());
    }
    if (patchSetInfo != null) {
      if (patchSetInfo.getAuthor().getAccount() != null) {
        authors.add(patchSetInfo.getAuthor().getAccount());
      }
      if (patchSetInfo.getCommitter().getAccount() != null) {
        authors.add(patchSetInfo.getCommitter().getAccount());
      }
    }
    return authors;
  }

^^^ Here is the part about second condition from the if statement above.
Author set contains change owners and/or uploader/committer.



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.