This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
src/stores/room-list/filters Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,17 @@ export class NameFilterCondition extends EventEmitter implements IFilterConditio
6666 return this . matches ( room . name ) ;
6767 }
6868
69- public matches ( val : string ) : boolean {
69+ private normalize ( val : string ) : string {
7070 // Note: we have to match the filter with the removeHiddenChars() room name because the
7171 // function strips spaces and other characters (M becomes RN for example, in lowercase).
72- // We also doubly convert to lowercase to work around oddities of the library.
73- const noSecretsFilter = removeHiddenChars ( this . search . toLowerCase ( ) ) . toLowerCase ( ) ;
74- const noSecretsName = removeHiddenChars ( val . toLowerCase ( ) ) . toLowerCase ( ) ;
75- return noSecretsName . includes ( noSecretsFilter ) ;
72+ return removeHiddenChars ( val . toLowerCase ( ) )
73+ // Strip all punctuation
74+ . replace ( / [ \\ ' ! " # $ % & ( ) * + , \- . / : ; < = > ? @ [ \] ^ _ ` { | } ~ \u2000 - \u206f \u2e00 - \u2e7f ] / g, "" )
75+ // We also doubly convert to lowercase to work around oddities of the library.
76+ . toLowerCase ( ) ;
77+ }
78+
79+ public matches ( val : string ) : boolean {
80+ return this . normalize ( val ) . includes ( this . normalize ( this . search ) ) ;
7681 }
7782}
You can’t perform that action at this time.
0 commit comments