Support creates follow (Merge pull request #3895)

* Supporting a proposal will create a follow relationship
* Only followers receive notifications
This commit is contained in:
Andy Sims
2020-04-06 23:26:47 +10:00
committed by GitHub
parent 14106ce800
commit 74fbde09f1
17 changed files with 44 additions and 48 deletions

View File

@@ -57,6 +57,7 @@ class ProposalsController < ApplicationController
end
def vote
@follow = Follow.find_or_create_by!(user: current_user, followable: @proposal)
@proposal.register_vote(current_user, "yes")
set_proposal_votes(@proposal)
end
@@ -73,6 +74,7 @@ class ProposalsController < ApplicationController
end
def vote_featured
@follow = Follow.find_or_create_by!(user: current_user, followable: @proposal)
@proposal.register_vote(current_user, "yes")
set_featured_proposal_votes(@proposal)
end