Fix issue where unpublished article hangs in notifications (#42)

* Fix issue where unpublished article hangs in notifications
This commit is contained in:
Ben Halpern 2018-03-05 11:56:32 -05:00 committed by GitHub
parent 86a32b42df
commit 45b371e31b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 1 deletions

View file

@ -96,7 +96,7 @@ class ArticlesController < ApplicationController
handle_org_assignment
handle_hiring_tag
if @article.published
Notification.send_all(@article, "Published") if @article.previous_changes.include?("published_at")
Notification.send_all(@article, "Published") if @article.previous_changes.include?("published")
path = @article.path
else
Notification.remove_all(@article, "Published")

View file

@ -171,6 +171,7 @@ class Comment < ApplicationRecord
end
def remove_from_feed
super
if ancestors.empty? && user != commentable.user
[User.find(commentable.user.id)&.touch(:last_notification_activity)]
elsif ancestors

View file

@ -45,6 +45,7 @@ class Follow < ApplicationRecord
end
def remove_from_feed
super
if followable_type == "User"
User.find(followable.id)&.touch(:last_notification_activity)
end

View file

@ -60,6 +60,7 @@ class Mention < ApplicationRecord
end
def remove_from_feed
super
User.find(user.id)&.touch(:last_notification_activity)
end

View file

@ -72,6 +72,7 @@ class Notification < ApplicationRecord
end
def remove_from_feed
super
User.find(user_id)&.touch(:last_notification_activity)
end

View file

@ -55,6 +55,7 @@ class Reaction < ApplicationRecord
end
def remove_from_feed
super
User.find(reactable.user.id)&.touch(:last_notification_activity)
end