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 @@ -65,12 +65,17 @@ export class NameFilterCondition extends EventEmitter implements IFilterConditio
6565 return this . matches ( room . name ) ;
6666 }
6767
68- public matches ( val : string ) : boolean {
68+ private normalize ( val : string ) : string {
6969 // Note: we have to match the filter with the removeHiddenChars() room name because the
7070 // function strips spaces and other characters (M becomes RN for example, in lowercase).
71- // We also doubly convert to lowercase to work around oddities of the library.
72- const noSecretsFilter = removeHiddenChars ( this . search . toLowerCase ( ) ) . toLowerCase ( ) ;
73- const noSecretsName = removeHiddenChars ( val . toLowerCase ( ) ) . toLowerCase ( ) ;
74- return noSecretsName . includes ( noSecretsFilter ) ;
71+ return removeHiddenChars ( val . toLowerCase ( ) )
72+ // Strip all punctuation
73+ . replace ( / [ \\ ' ! " # $ % & ( ) * + , \- . / : ; < = > ? @ [ \] ^ _ ` { | } ~ \u2000 - \u206f \u2e00 - \u2e7f ] / g, "" )
74+ // We also doubly convert to lowercase to work around oddities of the library.
75+ . toLowerCase ( ) ;
76+ }
77+
78+ public matches ( val : string ) : boolean {
79+ return this . normalize ( val ) . includes ( this . normalize ( this . search ) ) ;
7580 }
7681}
You can’t perform that action at this time.
0 commit comments