Commit de848e15 authored by Martin Lowe's avatar Martin Lowe 🇨🇦 Committed by Martin Lowe
Browse files

Add extra context to messaging for auth vs committer

parent 60901e99
...@@ -273,23 +273,27 @@ public class ValidationResource { ...@@ -273,23 +273,27 @@ public class ValidationResource {
*/ */
private void validateUserAccessPartial(ValidationResponse r, Commit c, EclipseUser eclipseUser, private void validateUserAccessPartial(ValidationResponse r, Commit c, EclipseUser eclipseUser,
boolean isCommitter, APIStatusCode errorCode) { boolean isCommitter, APIStatusCode errorCode) {
String userType = "author";
if (APIStatusCode.ERROR_COMMITTER.equals(errorCode)) {
userType = "committer";
}
if (isCommitter) { if (isCommitter) {
addMessage(r, String.format("Eclipse user '%s' is a committer on the project.", eclipseUser.getName()), c.getHash()); addMessage(r, String.format("Eclipse user '%s'(%s) is a committer on the project.", eclipseUser.getName(), userType), c.getHash());
} else { } else {
addMessage(r, String.format("Eclipse user '%s' is not a committer on the project.", eclipseUser.getName()), c.getHash()); addMessage(r, String.format("Eclipse user '%s'(%s) is not a committer on the project.", eclipseUser.getName(), userType), c.getHash());
// check if the author is signed off if not a committer // check if the author is signed off if not a committer
if (eclipseUser.getEca().isSigned()) { if (eclipseUser.getEca().isSigned()) {
addMessage( addMessage(
r, r,
String.format("Eclipse user '%s' has a current Eclipse Contributor Agreement (ECA) on file.", eclipseUser.getName()), String.format("Eclipse user '%s'(%s) has a current Eclipse Contributor Agreement (ECA) on file.", eclipseUser.getName(), userType),
c.getHash()); c.getHash());
} else { } else {
addMessage( addMessage(
r, r,
String.format("Eclipse user '%s' does not have a current Eclipse Contributor Agreement (ECA) on file.\n" String.format("Eclipse user '%s'(%s) does not have a current Eclipse Contributor Agreement (ECA) on file.\n"
+ "If there are multiple commits, please ensure that each author has a ECA.", eclipseUser.getName()), + "If there are multiple commits, please ensure that each author has a ECA.", eclipseUser.getName(), userType),
c.getHash()); c.getHash());
addError(r, String.format("An Eclipse Contributor Agreement is required for Eclipse user '%s'.", eclipseUser.getName()), addError(r, String.format("An Eclipse Contributor Agreement is required for Eclipse user '%s'(%s).", eclipseUser.getName(), userType),
c.getHash(), errorCode); c.getHash(), errorCode);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment