diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 672394c6d..fff616626 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -205,7 +205,7 @@ class Proposal < ActiveRecord::Base end def users_to_notify - (voters + followers).uniq + (voters + followers).uniq - [author] end def self.proposals_orders(user) diff --git a/app/views/admin/activity/show.html.erb b/app/views/admin/activity/show.html.erb index dd4cee125..3f82369ea 100644 --- a/app/views/admin/activity/show.html.erb +++ b/app/views/admin/activity/show.html.erb @@ -33,12 +33,16 @@ <%= activity.actionable.username %> (<%= activity.actionable.email %>) <% when "Comment" %> <%= activity.actionable.body %> + <% when "Newsletter" %> + <%= activity.actionable.subject %> + <% when "ProposalNotification" %> + <%= activity.actionable.title %> +
+ <%= activity.actionable.body %> <% else %> <%= activity.actionable.title %>
-
- <%= activity.actionable.description %> -
+ <%= activity.actionable.description %> <% end %> <%= activity.user.name %> (<%= activity.user.email %>) diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index bf505e8b7..fa4226764 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -895,6 +895,19 @@ describe Proposal do expect(proposal.users_to_notify).to eq([voter_and_follower]) end + it "returns voters and followers except the proposal author" do + author = create(:user, :level_two) + proposal = create(:proposal, author: author) + voter_and_follower = create(:user, :level_two) + + create(:follow, user: author, followable: proposal) + create(:follow, user: voter_and_follower, followable: proposal) + create(:vote, voter: author, votable: proposal) + create(:vote, voter: voter_and_follower, votable: proposal) + + expect(proposal.users_to_notify).to eq([voter_and_follower]) + end + end describe "#recommendations" do