You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Apply hidden char check to rawDisplayName too
This commit is contained in:
@@ -131,7 +131,11 @@ export class RoomMember extends EventEmitter {
|
|||||||
this.disambiguate,
|
this.disambiguate,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.rawDisplayName = event.getDirectionalContent().displayname || this.userId;
|
this.rawDisplayName = event.getDirectionalContent().displayname;
|
||||||
|
if (!this.rawDisplayName || !utils.removeHiddenChars(this.rawDisplayName)) {
|
||||||
|
this.rawDisplayName = this.userId;
|
||||||
|
}
|
||||||
|
|
||||||
if (oldMembership !== this.membership) {
|
if (oldMembership !== this.membership) {
|
||||||
this.updateModifiedTime();
|
this.updateModifiedTime();
|
||||||
this.emit("RoomMember.membership", event, this, oldMembership);
|
this.emit("RoomMember.membership", event, this, oldMembership);
|
||||||
|
|||||||
@@ -402,10 +402,11 @@ export function normalize(str: string): string {
|
|||||||
// various width spaces U+2000 - U+200D
|
// various width spaces U+2000 - U+200D
|
||||||
// LTR and RTL marks U+200E and U+200F
|
// LTR and RTL marks U+200E and U+200F
|
||||||
// LTR/RTL and other directional formatting marks U+202A - U+202F
|
// LTR/RTL and other directional formatting marks U+202A - U+202F
|
||||||
|
// Arabic Letter RTL mark U+061C
|
||||||
// Combining characters U+0300 - U+036F
|
// Combining characters U+0300 - U+036F
|
||||||
// Zero width no-break space (BOM) U+FEFF
|
// Zero width no-break space (BOM) U+FEFF
|
||||||
// eslint-disable-next-line no-misleading-character-class
|
// eslint-disable-next-line no-misleading-character-class
|
||||||
const removeHiddenCharsRegex = /[\u2000-\u200F\u202A-\u202F\u0300-\u036f\uFEFF\s]/g;
|
const removeHiddenCharsRegex = /[\u2000-\u200F\u202A-\u202F\u0300-\u036F\uFEFF\u061C\s]/g;
|
||||||
|
|
||||||
export function escapeRegExp(string: string): string {
|
export function escapeRegExp(string: string): string {
|
||||||
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||||
|
|||||||
Reference in New Issue
Block a user