Do not override user info row on registration endpoint if it already exists

This commit fixes an issue where notification settings would be lost
after restarting Damus, causing unwanted notifications

Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Closes: https://github.com/damus-io/damus/issues/2417
This commit is contained in:
Daniel D’Aquino
2024-09-04 14:25:07 -07:00
parent 11568aa628
commit abb3283eaa
2 changed files with 12 additions and 1 deletions

View File

@ -253,7 +253,7 @@ impl APIHandler {
}
// Proceed with the main logic after passing all checks
self.notification_manager.save_user_device_info(pubkey, device_token).await?;
self.notification_manager.save_user_device_info_if_not_present(pubkey, device_token).await?;
Ok(APIResponse {
status: StatusCode::OK,
body: json!({ "message": "User info saved successfully" }),