Add config print full display name of the invited person.
This commit is contained in:
@@ -208,6 +208,7 @@ threepid:
|
||||
|
||||
# Config invitation manager
|
||||
#invite:
|
||||
# fullDisplayName: true # print full name of the invited user (default false)
|
||||
# resolution:
|
||||
# timer: 10
|
||||
# period: seconds # search invites every 10 seconds (by default 5 minutes)
|
||||
|
@@ -123,6 +123,7 @@ public class InvitationConfig {
|
||||
private Expiration expiration = new Expiration();
|
||||
private Resolution resolution = new Resolution();
|
||||
private Policies policy = new Policies();
|
||||
private boolean fullDisplayName = false;
|
||||
|
||||
public Expiration getExpiration() {
|
||||
return expiration;
|
||||
@@ -148,11 +149,20 @@ public class InvitationConfig {
|
||||
this.policy = policy;
|
||||
}
|
||||
|
||||
public boolean isFullDisplayName() {
|
||||
return fullDisplayName;
|
||||
}
|
||||
|
||||
public void setFullDisplayName(boolean fullDisplayName) {
|
||||
this.fullDisplayName = fullDisplayName;
|
||||
}
|
||||
|
||||
public void build() {
|
||||
log.info("--- Invite config ---");
|
||||
log.info("Expiration: {}", GsonUtil.get().toJson(getExpiration()));
|
||||
log.info("Resolution: {}", GsonUtil.get().toJson(getResolution()));
|
||||
log.info("Policies: {}", GsonUtil.get().toJson(getPolicy()));
|
||||
log.info("Print full display name on invitation: {}", isFullDisplayName());
|
||||
}
|
||||
|
||||
public enum PeriodDimension {
|
||||
|
@@ -287,7 +287,7 @@ public class InvitationManager {
|
||||
}
|
||||
|
||||
String token = RandomStringUtils.randomAlphanumeric(64);
|
||||
String displayName = invitation.getAddress().substring(0, 3) + "...";
|
||||
String displayName = getInvitedDisplayName(invitation.getAddress());
|
||||
KeyIdentifier pKeyId = keyMgr.getServerSigningKey().getId();
|
||||
KeyIdentifier eKeyId = keyMgr.generateKey(KeyType.Ephemeral);
|
||||
|
||||
@@ -316,6 +316,14 @@ public class InvitationManager {
|
||||
return reply;
|
||||
}
|
||||
|
||||
private String getInvitedDisplayName(String origin) {
|
||||
if (cfg.isFullDisplayName()) {
|
||||
return origin;
|
||||
} else {
|
||||
return origin.substring(0, 3) + "...";
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasInvite(ThreePid tpid) {
|
||||
for (IThreePidInviteReply reply : invitations.values()) {
|
||||
if (!StringUtils.equals(tpid.getMedium(), reply.getInvite().getMedium())) {
|
||||
|
Reference in New Issue
Block a user