Fix issue where unpublished article hangs in notifications (#42)
* Fix issue where unpublished article hangs in notifications
This commit is contained in:
parent
86a32b42df
commit
45b371e31b
6 changed files with 6 additions and 1 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class Mention < ApplicationRecord
|
|||
end
|
||||
|
||||
def remove_from_feed
|
||||
super
|
||||
User.find(user.id)&.touch(:last_notification_activity)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ class Notification < ApplicationRecord
|
|||
end
|
||||
|
||||
def remove_from_feed
|
||||
super
|
||||
User.find(user_id)&.touch(:last_notification_activity)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ class Reaction < ApplicationRecord
|
|||
end
|
||||
|
||||
def remove_from_feed
|
||||
super
|
||||
User.find(reactable.user.id)&.touch(:last_notification_activity)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue