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