diff --git a/src/lib.cairo b/src/lib.cairo index ae40474..46b4274 100644 --- a/src/lib.cairo +++ b/src/lib.cairo @@ -320,7 +320,7 @@ pub mod PushComm { self .user_to_channel_notifs .entry(caller_address) - .write(channel, modified_notif_settings); + .write(channel, modified_notif_settings.clone()); self .emit( @@ -328,7 +328,7 @@ pub mod PushComm { channel: channel, recipient: caller_address, notif_id: notif_id, - notif_settings: notif_settings + notif_settings: modified_notif_settings } ); } diff --git a/tests/test_channel_settings.cairo b/tests/test_channel_settings.cairo index a331c51..84a79ff 100644 --- a/tests/test_channel_settings.cairo +++ b/tests/test_channel_settings.cairo @@ -25,6 +25,7 @@ fn test_channel_channel_user_settings() { push_comm.change_user_channel_settings(CHANNEL_ADDRESS, notif_id, notif_settings.clone()); let modified_notif_settings = format!("@{}+@{}", notif_id, notif_settings); + let modified_notif_settings_clone = modified_notif_settings.clone(); let setting_saved = push_comm.user_to_channel_notifs(USER_1(), CHANNEL_ADDRESS); assert(setting_saved == modified_notif_settings, 'Settings saved'); @@ -36,7 +37,7 @@ fn test_channel_channel_user_settings() { contract_address, PushComm::Event::UserNotifcationSettingsAdded( PushComm::UserNotifcationSettingsAdded { - channel: CHANNEL_ADDRESS, recipient: USER_1(), notif_id, notif_settings + channel: CHANNEL_ADDRESS, recipient: USER_1(), notif_id, notif_settings: modified_notif_settings } ) )