Fix comment notifications on legislation proposals
The `commentable_url` method wasn't updated when we added legislation
proposals.
Back when we first created this method, we couldn't pass budget
investments or topics directly to `polymorphic_url` because they are
nested resources. That isn't the case since commit ff93f5a59, so now we
can simplify this method.
We're keeping the `commentable_url` method for now in order to keep
compatibility with custom changes that might use it, although this
method isn't consistent with the `commentable_path` method (which
receives a comment, and not a commentable), and so we might have to
revisit this code in the future.
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
module MailerHelper
|
||||
def commentable_url(commentable)
|
||||
return poll_url(commentable) if commentable.is_a?(Poll)
|
||||
return debate_url(commentable) if commentable.is_a?(Debate)
|
||||
return proposal_url(commentable) if commentable.is_a?(Proposal)
|
||||
return community_topic_url(commentable.community_id, commentable) if commentable.is_a?(Topic)
|
||||
return budget_investment_url(commentable.budget_id, commentable) if commentable.is_a?(Budget::Investment)
|
||||
polymorphic_url(commentable)
|
||||
end
|
||||
|
||||
def valuation_comments_url(commentable)
|
||||
|
||||
@@ -22,5 +22,11 @@ describe Mailer do
|
||||
|
||||
expect(email).to deliver_from "New organization <new@consul.dev>"
|
||||
end
|
||||
|
||||
it "sends emails for comments on legislation proposals" do
|
||||
email = Mailer.comment(create(:legislation_proposal_comment))
|
||||
|
||||
expect(email.subject).to include("commented on your proposal")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user