Skip to content

Commit

Permalink
Merge pull request #13 from push-protocol/audit/issue-1
Browse files Browse the repository at this point in the history
Audit Issue1: fixed channel user settings event param
  • Loading branch information
0xNilesh authored Nov 20, 2024
2 parents e5ff018 + 18ef928 commit e05c197
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,15 @@ pub mod PushComm {
self
.user_to_channel_notifs
.entry(caller_address)
.write(channel, modified_notif_settings);
.write(channel, modified_notif_settings.clone());

self
.emit(
UserNotifcationSettingsAdded {
channel: channel,
recipient: caller_address,
notif_id: notif_id,
notif_settings: notif_settings
notif_settings: modified_notif_settings
}
);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/test_channel_settings.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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
}
)
)
Expand Down

0 comments on commit e05c197

Please sign in to comment.