AddKeySender: 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: I230a9ae187d695e4de44dbfcc94ddabe8a3542e5
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2019-12-13 10:00:46 +01:00
parent ea6dce80ad
commit a69aa048a4

View File

@@ -78,15 +78,26 @@ public class AddKeySender extends OutgoingEmail {
}
}
public String getEmail() {
@Override
protected void setupSoyContext() {
super.setupSoyContext();
soyContextEmailData.put("email", getEmail());
soyContextEmailData.put("gpgKeys", getGpgKeys());
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 (gpgKeys != null) {
@@ -95,29 +106,14 @@ public class AddKeySender extends OutgoingEmail {
return "Unknown";
}
public String getSshKey() {
private String getSshKey() {
return (sshKey != null) ? sshKey.sshPublicKey() + "\n" : null;
}
public String getGpgKeys() {
private String getGpgKeys() {
if (gpgKeys != null) {
return Joiner.on("\n").join(gpgKeys);
}
return null;
}
@Override
protected void setupSoyContext() {
super.setupSoyContext();
soyContextEmailData.put("email", getEmail());
soyContextEmailData.put("gpgKeys", getGpgKeys());
soyContextEmailData.put("keyType", getKeyType());
soyContextEmailData.put("sshKey", getSshKey());
soyContextEmailData.put("userNameEmail", getUserNameEmail());
}
@Override
protected boolean supportsHtml() {
return true;
}
}