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