Class: Decidim::Newsletter
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Newsletter
- Defined in:
- app/models/decidim/newsletter.rb
Overview
This model holds all the data needed to send a newsletter.
Class Method Summary collapse
Instance Method Summary collapse
- #sended_to_all_users? ⇒ Boolean
- #sended_to_followers? ⇒ Boolean
- #sended_to_participants? ⇒ Boolean
- #sended_to_partipatory_spaces ⇒ Object
-
#sent? ⇒ Boolean
Returns true if this newsletter was already sent.
- #sent_scopes ⇒ Object
- #sent_scopes_ids ⇒ Object
Class Method Details
.log_presenter_class_for(_log) ⇒ Object
15 16 17 |
# File 'app/models/decidim/newsletter.rb', line 15 def self.log_presenter_class_for(_log) Decidim::AdminLog::NewsletterPresenter end |
Instance Method Details
#sended_to_all_users? ⇒ Boolean
34 35 36 |
# File 'app/models/decidim/newsletter.rb', line 34 def sended_to_all_users? extended_data["send_to_all_users"] end |
#sended_to_followers? ⇒ Boolean
38 39 40 |
# File 'app/models/decidim/newsletter.rb', line 38 def sended_to_followers? extended_data["send_to_followers"] end |
#sended_to_participants? ⇒ Boolean
42 43 44 |
# File 'app/models/decidim/newsletter.rb', line 42 def sended_to_participants? extended_data["send_to_participants"] end |
#sended_to_partipatory_spaces ⇒ Object
46 47 48 |
# File 'app/models/decidim/newsletter.rb', line 46 def sended_to_partipatory_spaces extended_data["participatory_space_types"] end |
#sent? ⇒ Boolean
Returns true if this newsletter was already sent.
Returns a Boolean.
22 23 24 |
# File 'app/models/decidim/newsletter.rb', line 22 def sent? sent_at.present? end |
#sent_scopes ⇒ Object
30 31 32 |
# File 'app/models/decidim/newsletter.rb', line 30 def sent_scopes @sent_scopes ||= organization.scopes.where(id: sent_scopes_ids) end |
#sent_scopes_ids ⇒ Object
26 27 28 |
# File 'app/models/decidim/newsletter.rb', line 26 def sent_scopes_ids extended_data["scope_ids"] || [] end |