change how names are displayed
This commit is contained in:
parent
18902b21c6
commit
bc9af04820
|
@ -184,8 +184,12 @@ class PPfunMatrixBridge {
|
|||
}
|
||||
let name = this.idToNameMap.get(userId);
|
||||
if (!name) {
|
||||
this.idToNameMap.set(userId, userId.substring(1));
|
||||
name = await this.getDisplayName(userId);
|
||||
if (uid) {
|
||||
name = `[mx] ${await this.getDisplayName(userId)}`;
|
||||
} else {
|
||||
name = userId.substring(1);
|
||||
}
|
||||
this.idToNameMap.set(userId, name);
|
||||
}
|
||||
if (name === 'event' || name === 'info') {
|
||||
// don'tallow special names used by system
|
||||
|
@ -212,10 +216,9 @@ class PPfunMatrixBridge {
|
|||
const intent = this.matrixBridge.getIntent();
|
||||
const profile = await intent.getProfileInfo(userId, 'displayname');
|
||||
const { displayname } = profile;
|
||||
this.idToNameMap.set(userId, displayname);
|
||||
return displayname;
|
||||
} catch (e) {
|
||||
console.error(`Could not fetch DiplayName for ${uid}: ${e}`);
|
||||
console.error(`Could not fetch DiplayName for ${userId}: ${e}`);
|
||||
return userId.substring(1);
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +242,7 @@ class PPfunMatrixBridge {
|
|||
}
|
||||
this.ppfunSocket.emit(
|
||||
'sendChatMessage',
|
||||
(uid) ? name : `[mx] ${name}`,
|
||||
name,
|
||||
uid || null,
|
||||
msgString,
|
||||
cid,
|
||||
|
|
Loading…
Reference in New Issue
Block a user