Class: Decidim::PushNotificationMessage
- Inherits:
-
Object
- Object
- Decidim::PushNotificationMessage
- Includes:
- SanitizeHelper
- Defined in:
- app/models/decidim/push_notification_message.rb
Overview
A message from a conversation that will be sent as a push notification
Defined Under Namespace
Classes: InvalidActionError
Instance Attribute Summary collapse
-
#conversation ⇒ Object
readonly
Returns the value of attribute conversation.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#recipient ⇒ Object
(also: #user)
readonly
Returns the value of attribute recipient.
Instance Method Summary collapse
- #body ⇒ Object
- #icon ⇒ Object
-
#initialize(recipient:, conversation:, message:) ⇒ PushNotificationMessage
constructor
A new instance of PushNotificationMessage.
- #url ⇒ Object
Methods included from SanitizeHelper
#decidim_escape_translated, #decidim_html_escape, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included
Constructor Details
#initialize(recipient:, conversation:, message:) ⇒ PushNotificationMessage
Returns a new instance of PushNotificationMessage.
10 11 12 13 14 |
# File 'app/models/decidim/push_notification_message.rb', line 10 def initialize(recipient:, conversation:, message:) @recipient = recipient @conversation = conversation @message = end |
Instance Attribute Details
#conversation ⇒ Object (readonly)
Returns the value of attribute conversation.
16 17 18 |
# File 'app/models/decidim/push_notification_message.rb', line 16 def conversation @conversation end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
16 17 18 |
# File 'app/models/decidim/push_notification_message.rb', line 16 def @message end |
#recipient ⇒ Object (readonly) Also known as: user
Returns the value of attribute recipient.
16 17 18 |
# File 'app/models/decidim/push_notification_message.rb', line 16 def recipient @recipient end |
Instance Method Details
#body ⇒ Object
20 21 22 |
# File 'app/models/decidim/push_notification_message.rb', line 20 def body decidim_escape_translated() end |
#icon ⇒ Object
24 25 26 |
# File 'app/models/decidim/push_notification_message.rb', line 24 def icon organization.attached_uploader(:favicon).variant_url(:big, host: organization.host) end |
#url ⇒ Object
28 29 30 |
# File 'app/models/decidim/push_notification_message.rb', line 28 def url EngineRouter.new("decidim", {}).public_send(:conversation_path, host: organization.host, id: @conversation) end |