Class: Decidim::Initiatives::StatusChangeNotifier
- Inherits:
-
Object
- Object
- Decidim::Initiatives::StatusChangeNotifier
- Defined in:
- app/services/decidim/initiatives/status_change_notifier.rb
Overview
Service that reports changes in initiative status
Instance Attribute Summary collapse
-
#initiative ⇒ Object
readonly
Returns the value of attribute initiative.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ StatusChangeNotifier
constructor
A new instance of StatusChangeNotifier.
-
#notify ⇒ Object
PUBLIC Notifies when an initiative has changed its status.
Constructor Details
#initialize(args = {}) ⇒ StatusChangeNotifier
Returns a new instance of StatusChangeNotifier.
9 10 11 |
# File 'app/services/decidim/initiatives/status_change_notifier.rb', line 9 def initialize(args = {}) @initiative = args.fetch(:initiative) end |
Instance Attribute Details
#initiative ⇒ Object (readonly)
Returns the value of attribute initiative.
7 8 9 |
# File 'app/services/decidim/initiatives/status_change_notifier.rb', line 7 def initiative @initiative end |
Instance Method Details
#notify ⇒ Object
PUBLIC Notifies when an initiative has changed its status.
-
created: Notifies the author that their initiative has been created.
-
validating: Administrators will be notified about the initiative that requests technical validation.
-
published, discarded: Initiative authors will be notified about the result of the technical validation process.
-
rejected, accepted: Initiative’s followers and authors will be notified about the result of the initiative.
26 27 28 29 30 31 |
# File 'app/services/decidim/initiatives/status_change_notifier.rb', line 26 def notify notify_initiative_creation if initiative.created? notify_validating_initiative if initiative.validating? notify_validating_result if initiative.published? || initiative.discarded? notify_support_result if initiative.rejected? || initiative.accepted? end |