FIX: don't send multiple requests when changing category notification (#6435)

This commit is contained in:
Maja Komel 2018-10-01 17:41:23 +02:00 committed by Régis Hanol
parent e2770bc1c4
commit 1add11d8c9
2 changed files with 8 additions and 2 deletions

View File

@ -11,5 +11,7 @@ export default NotificationOptionsComponent.extend({
mutateValue(value) {
this.get("category").setNotification(value);
}
},
deselect() {}
});

View File

@ -55,7 +55,11 @@ class CategoryUser < ActiveRecord::Base
record.notification_level = level
record.save!
else
CategoryUser.create!(user: user, category_id: category_id, notification_level: level)
begin
CategoryUser.create!(user: user, category_id: category_id, notification_level: level)
rescue ActiveRecord::RecordNotUnique
# does not matter
end
end
auto_watch(user_id: user.id)