Class: Decidim::NotificationsSettingsForm
- Defined in:
- app/forms/decidim/notifications_settings_form.rb
Overview
The form object that handles the data behind updating a user’s notifications settings in her profile page.
Instance Method Summary collapse
- #direct_message_types ⇒ Object
- #map_model(user) ⇒ Object
- #newsletter_notifications_at ⇒ Object
- #notification_types ⇒ Object
Instance Method Details
#direct_message_types ⇒ Object
40 41 42 |
# File 'app/forms/decidim/notifications_settings_form.rb', line 40 def allow_public_contact ? "all" : "followed-only" end |
#map_model(user) ⇒ Object
15 16 17 18 19 20 |
# File 'app/forms/decidim/notifications_settings_form.rb', line 15 def map_model(user) self. = user..present? self.notifications_from_followed = ["all", "followed-only"].include? user.notification_types self.notifications_from_own_activity = ["all", "own-only"].include? user.notification_types self.allow_public_contact = user. == "all" end |
#newsletter_notifications_at ⇒ Object
22 23 24 25 26 |
# File 'app/forms/decidim/notifications_settings_form.rb', line 22 def return nil unless Time.current end |
#notification_types ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/forms/decidim/notifications_settings_form.rb', line 28 def notification_types if notifications_from_followed && notifications_from_own_activity "all" elsif notifications_from_followed "followed-only" elsif notifications_from_own_activity "own-only" else "none" end end |