Skip to content

Commit

Permalink
FIX: don't send multiple requests when changing category notification (
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel authored and ZogStriP committed Oct 1, 2018
1 parent e2770bc commit 1add11d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ export default NotificationOptionsComponent.extend({

mutateValue(value) {
this.get("category").setNotification(value);
}
},

deselect() {}
});
6 changes: 5 additions & 1 deletion app/models/category_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ def self.set_notification_level_for_category(user, level, category_id)
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)
Expand Down

1 comment on commit 1add11d

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/select-kit-obscured-by-post-body/98570/10

Please sign in to comment.