Module: Integrations::Base::HangoutsChat

Extended by:
ActiveSupport::Concern
Includes:
ChatNotification
Included in:
HangoutsChat
Defined in:
app/models/concerns/integrations/base/hangouts_chat.rb

Constant Summary collapse

REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD =

Enum value of the messageReplyOption query parameter indicates that messages should be created as replies to the specified threads if possible and start new threads otherwise developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/create#messagereplyoption

'REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD'

Constants included from ChatNotification

ChatNotification::EVENT_CHANNEL, ChatNotification::GROUP_ONLY_SUPPORTED_EVENTS, ChatNotification::LABEL_NOTIFICATION_BEHAVIOURS, ChatNotification::SECRET_MASK, ChatNotification::SUPPORTED_EVENTS, ChatNotification::SUPPORTED_EVENTS_FOR_LABEL_FILTER

Constants included from NotificationPipelineStatusSelection

NotificationPipelineStatusSelection::FIELD

Instance Method Summary collapse

Methods included from ChatNotification

#api_field_names, #channel_limit_per_event, #confidential_issue_channel, #confidential_note_channel, #configurable_channels?, #configurable_events, #event_channel_names, #event_channel_value, #execute, #fields, #form_fields, #initialize_properties, #mask_configurable_channels?, #sections, #webhook_help

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Methods included from NotificationPipelineStatusSelection

#fields

Methods included from NotificationBranchSelection

#notify_for_branch?

Instance Method Details

#default_channel_placeholderObject



86
# File 'app/models/concerns/integrations/base/hangouts_chat.rb', line 86

def default_channel_placeholder; end

#format_attachment_title(attachment) ⇒ Object



117
118
119
120
121
# File 'app/models/concerns/integrations/base/hangouts_chat.rb', line 117

def format_attachment_title(attachment)
  return attachment[:title] unless attachment[:title_link]

  "<#{attachment[:title_link]}|#{attachment[:title]}>"
end

#parse_simple_text_message(message) ⇒ Object



106
107
108
109
110
111
112
113
114
115
# File 'app/models/concerns/integrations/base/hangouts_chat.rb', line 106

def parse_simple_text_message(message)
  header = message.pretext
  return header if message.attachments.empty?

  attachment = message.attachments.first
  title = format_attachment_title(attachment)
  body = attachment[:text]

  [header, title, body].compact.join("\n")
end

#parse_thread_key(message) ⇒ Object

Returns an appropriate key for threading messages in google chat



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'app/models/concerns/integrations/base/hangouts_chat.rb', line 89

def parse_thread_key(message)
  case message
  when Integrations::ChatMessage::NoteMessage
    message.target
  when Integrations::ChatMessage::IssueMessage
    "issue #{message.project_name}#{Issue.reference_prefix}#{message.issue_iid}"
  when Integrations::ChatMessage::MergeMessage
    "merge request #{message.project_name}#{MergeRequest.reference_prefix}#{message.merge_request_iid}"
  when Integrations::ChatMessage::PushMessage
    "push #{message.project_name}_#{message.ref}"
  when Integrations::ChatMessage::PipelineMessage
    "pipeline #{message.pipeline_id}"
  when Integrations::ChatMessage::WikiPageMessage
    "wiki_page #{message.wiki_page_url}"
  end
end