@@ -7,7 +7,7 @@ use ruma::{
77} ;
88
99use super :: command:: Command ;
10- use crate :: NotificationSettingsError ;
10+ use crate :: { notification_settings :: command :: Notify , NotificationSettingsError } ;
1111
1212/// A `RuleCommand` allows to generate a list of `Command` needed to modify a
1313/// `Ruleset`
@@ -27,7 +27,7 @@ impl RuleCommands {
2727 & mut self ,
2828 kind : RuleKind ,
2929 room_id : & RoomId ,
30- notify : bool ,
30+ notify : Notify ,
3131 ) -> Result < ( ) , NotificationSettingsError > {
3232 let command = match kind {
3333 RuleKind :: Room => Command :: SetRoomPushRule { room_id : room_id. to_owned ( ) , notify } ,
@@ -210,7 +210,7 @@ mod tests {
210210 } ;
211211
212212 use super :: RuleCommands ;
213- use crate :: { error:: NotificationSettingsError , notification_settings:: command:: Command } ;
213+ use crate :: { error:: NotificationSettingsError , notification_settings:: command:: { Command , Notify } } ;
214214
215215 fn get_server_default_ruleset ( ) -> Ruleset {
216216 let user_id = UserId :: parse ( "@user:matrix.org" ) . unwrap ( ) ;
@@ -225,7 +225,7 @@ mod tests {
225225 async fn test_insert_rule_room ( ) {
226226 let room_id = get_test_room_id ( ) ;
227227 let mut rule_commands = RuleCommands :: new ( get_server_default_ruleset ( ) ) ;
228- rule_commands. insert_rule ( RuleKind :: Room , & room_id, true ) . unwrap ( ) ;
228+ rule_commands. insert_rule ( RuleKind :: Room , & room_id, Notify :: All ) . unwrap ( ) ;
229229
230230 // A rule must have been inserted in the ruleset.
231231 assert ! ( rule_commands. rules. get( RuleKind :: Room , & room_id) . is_some( ) ) ;
@@ -235,7 +235,7 @@ mod tests {
235235 assert_matches ! ( & rule_commands. commands[ 0 ] ,
236236 Command :: SetRoomPushRule { room_id: command_room_id, notify } => {
237237 assert_eq!( command_room_id, & room_id) ;
238- assert! ( notify) ;
238+ assert_eq! ( & Notify :: All , notify) ;
239239 }
240240 ) ;
241241 }
@@ -244,7 +244,7 @@ mod tests {
244244 async fn test_insert_rule_override ( ) {
245245 let room_id = get_test_room_id ( ) ;
246246 let mut rule_commands = RuleCommands :: new ( get_server_default_ruleset ( ) ) ;
247- rule_commands. insert_rule ( RuleKind :: Override , & room_id, true ) . unwrap ( ) ;
247+ rule_commands. insert_rule ( RuleKind :: Override , & room_id, Notify :: All ) . unwrap ( ) ;
248248
249249 // A rule must have been inserted in the ruleset.
250250 assert ! ( rule_commands. rules. get( RuleKind :: Override , & room_id) . is_some( ) ) ;
@@ -255,7 +255,7 @@ mod tests {
255255 Command :: SetOverridePushRule { room_id: command_room_id, rule_id, notify } => {
256256 assert_eq!( command_room_id, & room_id) ;
257257 assert_eq!( rule_id, room_id. as_str( ) ) ;
258- assert! ( notify) ;
258+ assert_eq! ( & Notify :: All , notify) ;
259259 }
260260 ) ;
261261 }
@@ -266,17 +266,17 @@ mod tests {
266266 let mut rule_commands = RuleCommands :: new ( get_server_default_ruleset ( ) ) ;
267267
268268 assert_matches ! (
269- rule_commands. insert_rule( RuleKind :: Underride , & room_id, true ) ,
269+ rule_commands. insert_rule( RuleKind :: Underride , & room_id, Notify :: All ) ,
270270 Err ( NotificationSettingsError :: InvalidParameter ( _) ) => { }
271271 ) ;
272272
273273 assert_matches ! (
274- rule_commands. insert_rule( RuleKind :: Content , & room_id, true ) ,
274+ rule_commands. insert_rule( RuleKind :: Content , & room_id, Notify :: All ) ,
275275 Err ( NotificationSettingsError :: InvalidParameter ( _) ) => { }
276276 ) ;
277277
278278 assert_matches ! (
279- rule_commands. insert_rule( RuleKind :: Sender , & room_id, true ) ,
279+ rule_commands. insert_rule( RuleKind :: Sender , & room_id, Notify :: All ) ,
280280 Err ( NotificationSettingsError :: InvalidParameter ( _) ) => { }
281281 ) ;
282282 }
0 commit comments