Skip to content
Permalink
Browse files

Only set email if User's address in null or empty.

JENKINS-28421
  • Loading branch information...
p4paul committed Aug 19, 2015
1 parent 6983371 commit e117cd2c9d1a33745191f5c326d4efb0184ace85
Showing with 12 additions and 3 deletions.
  1. +12 −3 src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java
@@ -11,6 +11,7 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import org.jenkinsci.plugins.p4.client.ConnectionHelper;
import org.kohsuke.stapler.export.Exported;
@@ -24,6 +25,9 @@

public class P4ChangeEntry extends ChangeLogSet.Entry {

private static Logger logger = Logger.getLogger(P4ChangeEntry.class
.getName());

private int FILE_COUNT_LIMIT = 50;

private Object id;
@@ -62,9 +66,14 @@ public void setChange(ConnectionHelper p4, int changeId) throws Exception {
author = User.get(user);

// set email property on user
String email = p4.getEmail(user);
UserProperty userProp = new UserProperty(email);
author.addProperty(userProp);
UserProperty prop = author.getProperty(UserProperty.class);
if (prop == null || prop.getAddress() == null
|| prop.getAddress().isEmpty()) {
String email = p4.getEmail(user);
UserProperty userProp = new UserProperty(email);
author.addProperty(userProp);
logger.fine("Setting email for user: " + user + ":" + email);
}

// set date of change
date = changelist.getDate();

0 comments on commit e117cd2

Please sign in to comment.
You can’t perform that action at this time.