From 944ff5a70f85dd36e4d42075010d380cffb8a0e4 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 22 Jun 2015 10:06:18 +1000 Subject: [PATCH] FIX: yank existing notification when unaccepted --- plugin.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin.rb b/plugin.rb index 99b62df..e1e118c 100644 --- a/plugin.rb +++ b/plugin.rb @@ -63,6 +63,16 @@ after_initialize do post.topic.save! post.save! + # yank notification + notification = Notification.find_by( + notification_type: Notification.types[:custom], + user_id: post.user_id, + topic_id: post.topic_id, + post_number: post.post_number + ) + + notification.destroy if notification + render json: success_json end end