Class: Integrations::ChatMessage::NoteMessage
- Inherits:
-
BaseMessage
- Object
- BaseMessage
- Integrations::ChatMessage::NoteMessage
- Defined in:
- app/models/integrations/chat_message/note_message.rb
Constant Summary
Constants inherited from BaseMessage
BaseMessage::RELATIVE_LINK_REGEX
Instance Attribute Summary collapse
-
#note ⇒ Object
readonly
Returns the value of attribute note.
-
#note_url ⇒ Object
readonly
Returns the value of attribute note_url.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes inherited from BaseMessage
#markdown, #project_name, #project_url, #user_avatar, #user_full_name, #user_name
Instance Method Summary collapse
- #activity ⇒ Object
- #attachments ⇒ Object
-
#initialize(params) ⇒ NoteMessage
constructor
A new instance of NoteMessage.
Methods inherited from BaseMessage
#fallback, #pretext, #summary, #user_combined_name
Constructor Details
#initialize(params) ⇒ NoteMessage
Returns a new instance of NoteMessage.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/integrations/chat_message/note_message.rb', line 11 def initialize(params) super params = HashWithIndifferentAccess.new(params) obj_attr = params[:object_attributes] @note = obj_attr[:note] @note_url = obj_attr[:url] @target, @title = case obj_attr[:noteable_type] when "Commit" create_commit_note(params[:commit]) when "Issue" create_issue_note(params[:issue]) when "MergeRequest" create_merge_note(params[:merge_request]) when "Snippet" create_snippet_note(params[:snippet]) end end |
Instance Attribute Details
#note ⇒ Object (readonly)
Returns the value of attribute note.
6 7 8 |
# File 'app/models/integrations/chat_message/note_message.rb', line 6 def note @note end |
#note_url ⇒ Object (readonly)
Returns the value of attribute note_url.
7 8 9 |
# File 'app/models/integrations/chat_message/note_message.rb', line 7 def note_url @note_url end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
9 10 11 |
# File 'app/models/integrations/chat_message/note_message.rb', line 9 def target @target end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'app/models/integrations/chat_message/note_message.rb', line 8 def title @title end |
Instance Method Details
#activity ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'app/models/integrations/chat_message/note_message.rb', line 36 def activity { title: "#{strip_markup(user_combined_name)} #{link('commented on ' + target, note_url)}", subtitle: "in #{project_link}", text: strip_markup(formatted_title), image: user_avatar } end |
#attachments ⇒ Object
30 31 32 33 34 |
# File 'app/models/integrations/chat_message/note_message.rb', line 30 def return note if markdown end |