@@ -29,15 +29,15 @@ export const ROOM_RULE_TYPES = [RULE_ROOM, "m.room.rule.room", "org.matrix.mjoln
2929export const SERVER_RULE_TYPES = [ RULE_SERVER , "m.room.rule.server" , "org.matrix.mjolnir.rule.server" ] ;
3030export const ALL_RULE_TYPES = [ ...USER_RULE_TYPES , ...ROOM_RULE_TYPES , ...SERVER_RULE_TYPES ] ;
3131
32- export function ruleTypeToStable ( rule : string , unstable = true ) : string {
32+ export function ruleTypeToStable ( rule : string ) : string {
3333 if ( USER_RULE_TYPES . includes ( rule ) ) {
34- return unstable ? USER_RULE_TYPES [ USER_RULE_TYPES . length - 1 ] : RULE_USER ;
34+ return RULE_USER ;
3535 }
3636 if ( ROOM_RULE_TYPES . includes ( rule ) ) {
37- return unstable ? ROOM_RULE_TYPES [ ROOM_RULE_TYPES . length - 1 ] : RULE_ROOM ;
37+ return RULE_ROOM ;
3838 }
3939 if ( SERVER_RULE_TYPES . includes ( rule ) ) {
40- return unstable ? SERVER_RULE_TYPES [ SERVER_RULE_TYPES . length - 1 ] : RULE_SERVER ;
40+ return RULE_SERVER ;
4141 }
4242 return null ;
4343}
@@ -68,19 +68,19 @@ export class BanList {
6868 }
6969
7070 async banEntity ( kind : string , entity : string , reason : string ) : Promise < any > {
71- await MatrixClientPeg . get ( ) . sendStateEvent ( this . _roomId , ruleTypeToStable ( kind , true ) , {
71+ await MatrixClientPeg . get ( ) . sendStateEvent ( this . _roomId , ruleTypeToStable ( kind ) , {
7272 entity : entity ,
7373 reason : reason ,
7474 recommendation : recommendationToStable ( RECOMMENDATION_BAN , true ) ,
7575 } , "rule:" + entity ) ;
76- this . _rules . push ( new ListRule ( entity , RECOMMENDATION_BAN , reason , ruleTypeToStable ( kind , false ) ) ) ;
76+ this . _rules . push ( new ListRule ( entity , RECOMMENDATION_BAN , reason , ruleTypeToStable ( kind ) ) ) ;
7777 }
7878
7979 async unbanEntity ( kind : string , entity : string ) : Promise < any > {
8080 // Empty state event is effectively deleting it.
81- await MatrixClientPeg . get ( ) . sendStateEvent ( this . _roomId , ruleTypeToStable ( kind , true ) , { } , "rule:" + entity ) ;
81+ await MatrixClientPeg . get ( ) . sendStateEvent ( this . _roomId , ruleTypeToStable ( kind ) , { } , "rule:" + entity ) ;
8282 this . _rules = this . _rules . filter ( r => {
83- if ( r . kind !== ruleTypeToStable ( kind , false ) ) return true ;
83+ if ( r . kind !== ruleTypeToStable ( kind ) ) return true ;
8484 if ( r . entity !== entity ) return true ;
8585 return false ; // we just deleted this rule
8686 } ) ;
@@ -97,7 +97,7 @@ export class BanList {
9797 for ( const ev of events ) {
9898 if ( ! ev . getStateKey ( ) ) continue ;
9999
100- const kind = ruleTypeToStable ( eventType , false ) ;
100+ const kind = ruleTypeToStable ( eventType ) ;
101101
102102 const entity = ev . getContent ( ) [ 'entity' ] ;
103103 const recommendation = ev . getContent ( ) [ 'recommendation' ] ;
0 commit comments