app/models/decidim/proposals/proposal.rb in decidim-proposals-0.5.1 vs app/models/decidim/proposals/proposal.rb in decidim-proposals-0.6.0

- old
+ new

@@ -10,10 +10,11 @@ include Decidim::HasScope include Decidim::HasReference include Decidim::HasCategory include Decidim::Reportable include Decidim::HasAttachments + include Decidim::Followable include Decidim::Comments::Commentable feature_manifest_name "proposals" has_many :votes, foreign_key: "decidim_proposal_id", class_name: "ProposalVote", dependent: :destroy, counter_cache: "proposal_votes_count" @@ -82,11 +83,11 @@ feature.settings.comments_enabled? end # Public: Overrides the `accepts_new_comments?` Commentable concern method. def accepts_new_comments? - commentable? && !feature.active_step_settings.comments_blocked + commentable? && !feature.current_settings.comments_blocked end # Public: Overrides the `comments_have_alignment?` Commentable concern method. def comments_have_alignment? true @@ -95,31 +96,23 @@ # Public: Overrides the `comments_have_votes?` Commentable concern method. def comments_have_votes? true end + # Public: Override Commentable concern method `users_to_notify_on_comment_created` + def users_to_notify_on_comment_created + return (followers | feature.participatory_space.admins).uniq if official? + followers + end + # Public: Overrides the `reported_content_url` Reportable concern method. def reported_content_url ResourceLocatorPresenter.new(self).url end # Public: Whether the proposal is official or not. def official? author.nil? - end - - # Public: Overrides the `notifiable?` Notifiable concern method. - # When a proposal is commented the proposal's author is notified if it is not the same - # who has commented the proposal and if the proposal's author has comment notifications enabled. - def notifiable?(context) - return true if official? - context[:author] != author && author.comments_notifications? - end - - # Public: Overrides the `users_to_notify` Notifiable concern method. - def users_to_notify - return Decidim::Admin::ProcessAdmins.for(feature.participatory_process) if official? - [author] end end end end