DeleteKeySender: Make all methods private which are only within the class
Inline getUserNameEmail method as it is only used once and doesn’t contain enough logic to justify a separate method. Change-Id: Ie8ff21dad0da6e4764063cc928124361792944ef Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -76,15 +76,26 @@ public class DeleteKeySender extends OutgoingEmail {
|
||||
}
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
@Override
|
||||
protected void setupSoyContext() {
|
||||
super.setupSoyContext();
|
||||
soyContextEmailData.put("email", getEmail());
|
||||
soyContextEmailData.put("gpgKeyFingerprints", getGpgKeyFingerprints());
|
||||
soyContextEmailData.put("keyType", getKeyType());
|
||||
soyContextEmailData.put("sshKey", getSshKey());
|
||||
soyContextEmailData.put("userNameEmail", getUserNameEmailFor(user.getAccountId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsHtml() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getEmail() {
|
||||
return user.getAccount().preferredEmail();
|
||||
}
|
||||
|
||||
public String getUserNameEmail() {
|
||||
return getUserNameEmailFor(user.getAccountId());
|
||||
}
|
||||
|
||||
public String getKeyType() {
|
||||
private String getKeyType() {
|
||||
if (sshKey != null) {
|
||||
return "SSH";
|
||||
} else if (gpgKeyFingerprints != null) {
|
||||
@@ -93,29 +104,14 @@ public class DeleteKeySender extends OutgoingEmail {
|
||||
throw new IllegalStateException("key type is not SSH or GPG");
|
||||
}
|
||||
|
||||
public String getSshKey() {
|
||||
private String getSshKey() {
|
||||
return (sshKey != null) ? sshKey.sshPublicKey() + "\n" : null;
|
||||
}
|
||||
|
||||
public String getGpgKeyFingerprints() {
|
||||
private String getGpgKeyFingerprints() {
|
||||
if (!gpgKeyFingerprints.isEmpty()) {
|
||||
return Joiner.on("\n").join(gpgKeyFingerprints);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupSoyContext() {
|
||||
super.setupSoyContext();
|
||||
soyContextEmailData.put("email", getEmail());
|
||||
soyContextEmailData.put("gpgKeyFingerprints", getGpgKeyFingerprints());
|
||||
soyContextEmailData.put("keyType", getKeyType());
|
||||
soyContextEmailData.put("sshKey", getSshKey());
|
||||
soyContextEmailData.put("userNameEmail", getUserNameEmail());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsHtml() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user