Removes author from Proposal#users_to_notify
This commit is contained in:
@@ -205,7 +205,7 @@ class Proposal < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def users_to_notify
|
def users_to_notify
|
||||||
(voters + followers).uniq
|
(voters + followers).uniq - [author]
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.proposals_orders(user)
|
def self.proposals_orders(user)
|
||||||
|
|||||||
@@ -33,12 +33,16 @@
|
|||||||
<%= activity.actionable.username %> (<%= activity.actionable.email %>)
|
<%= activity.actionable.username %> (<%= activity.actionable.email %>)
|
||||||
<% when "Comment" %>
|
<% when "Comment" %>
|
||||||
<%= activity.actionable.body %>
|
<%= activity.actionable.body %>
|
||||||
|
<% when "Newsletter" %>
|
||||||
|
<strong><%= activity.actionable.subject %></strong>
|
||||||
|
<% when "ProposalNotification" %>
|
||||||
|
<strong><%= activity.actionable.title %></strong>
|
||||||
|
<br>
|
||||||
|
<%= activity.actionable.body %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<strong><%= activity.actionable.title %></strong>
|
<strong><%= activity.actionable.title %></strong>
|
||||||
<br>
|
<br>
|
||||||
<div class="proposal-description">
|
<%= activity.actionable.description %>
|
||||||
<%= activity.actionable.description %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<td class="align-top">
|
<td class="align-top">
|
||||||
<%= activity.user.name %> (<%= activity.user.email %>)
|
<%= activity.user.name %> (<%= activity.user.email %>)
|
||||||
|
|||||||
@@ -895,6 +895,19 @@ describe Proposal do
|
|||||||
expect(proposal.users_to_notify).to eq([voter_and_follower])
|
expect(proposal.users_to_notify).to eq([voter_and_follower])
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "#recommendations" do
|
describe "#recommendations" do
|
||||||
|
|||||||
Reference in New Issue
Block a user