mostrar notificaciones a los usuarios cuando alguien comenta en su
debate o responde a su comentario
This commit is contained in:
@@ -116,4 +116,14 @@ class ApplicationController < ActionController::Base
|
||||
add_notifications_for activity
|
||||
end
|
||||
end
|
||||
|
||||
def add_notifications_for(activity)
|
||||
case activity.action
|
||||
when "debate_comment"
|
||||
author = activity.trackable.debate.author
|
||||
when "comment_reply"
|
||||
author = activity.trackable.parent.author
|
||||
end
|
||||
author.notifications.create!(activity: activity) unless activity.made_by? author
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user