Class: Integrations::ChatMessage::PushMessage
- Inherits:
-
BaseMessage
- Object
- BaseMessage
- Integrations::ChatMessage::PushMessage
- Defined in:
- app/models/integrations/chat_message/push_message.rb
Constant Summary
Constants inherited from BaseMessage
BaseMessage::RELATIVE_LINK_REGEX
Instance Attribute Summary collapse
-
#after ⇒ Object
readonly
Returns the value of attribute after.
-
#before ⇒ Object
readonly
Returns the value of attribute before.
-
#commits ⇒ Object
readonly
Returns the value of attribute commits.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#ref_type ⇒ Object
readonly
Returns the value of attribute ref_type.
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) ⇒ PushMessage
constructor
A new instance of PushMessage.
Methods inherited from BaseMessage
#fallback, #pretext, #summary, #user_combined_name
Constructor Details
#initialize(params) ⇒ PushMessage
Returns a new instance of PushMessage.
12 13 14 15 16 17 18 19 20 |
# File 'app/models/integrations/chat_message/push_message.rb', line 12 def initialize(params) super @after = params[:after] @before = params[:before] @commits = params.fetch(:commits, []) @ref_type = Gitlab::Git.tag_ref?(params[:ref]) ? 'tag' : 'branch' @ref = Gitlab::Git.ref_name(params[:ref]) end |
Instance Attribute Details
#after ⇒ Object (readonly)
Returns the value of attribute after.
6 7 8 |
# File 'app/models/integrations/chat_message/push_message.rb', line 6 def after @after end |
#before ⇒ Object (readonly)
Returns the value of attribute before.
7 8 9 |
# File 'app/models/integrations/chat_message/push_message.rb', line 7 def before @before end |
#commits ⇒ Object (readonly)
Returns the value of attribute commits.
8 9 10 |
# File 'app/models/integrations/chat_message/push_message.rb', line 8 def commits @commits end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
9 10 11 |
# File 'app/models/integrations/chat_message/push_message.rb', line 9 def ref @ref end |
#ref_type ⇒ Object (readonly)
Returns the value of attribute ref_type.
10 11 12 |
# File 'app/models/integrations/chat_message/push_message.rb', line 10 def ref_type @ref_type end |
Instance Method Details
#activity ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/models/integrations/chat_message/push_message.rb', line 29 def activity { title: humanized_action(short: true), subtitle: "in #{project_link}", text: compare_link, image: user_avatar } end |
#attachments ⇒ Object
22 23 24 25 26 27 |
# File 'app/models/integrations/chat_message/push_message.rb', line 22 def return [] if new_branch? || removed_branch? return if markdown end |