Send proposals notifications to followers.
This commit is contained in:
committed by
Senén Rodero Rodríguez
parent
35f7f11177
commit
b29bf62f56
@@ -11,8 +11,8 @@ class ProposalNotificationsController < ApplicationController
|
||||
@notification = ProposalNotification.new(proposal_notification_params)
|
||||
@proposal = Proposal.find(proposal_notification_params[:proposal_id])
|
||||
if @notification.save
|
||||
@proposal.voters.each do |voter|
|
||||
Notification.add(voter.id, @notification)
|
||||
notification_users.each do |user|
|
||||
Notification.add(user.id, @notification)
|
||||
end
|
||||
redirect_to @notification, notice: I18n.t("flash.actions.create.proposal_notification")
|
||||
else
|
||||
@@ -30,4 +30,8 @@ class ProposalNotificationsController < ApplicationController
|
||||
params.require(:proposal_notification).permit(:title, :body, :proposal_id)
|
||||
end
|
||||
|
||||
end
|
||||
def notification_users
|
||||
(@proposal.voters + @proposal.followers).uniq
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user