Class: Integrations::GitlabSlackApplication

Inherits:
BaseSlackNotification show all
Includes:
SlackMattermostFields
Defined in:
app/models/integrations/gitlab_slack_application.rb

Constant Summary

Constants inherited from BaseSlackNotification

BaseSlackNotification::SUPPORTED_EVENTS_FOR_USAGE_LOG

Constants inherited from BaseChatNotification

BaseChatNotification::EVENT_CHANNEL, BaseChatNotification::LABEL_NOTIFICATION_BEHAVIOURS, BaseChatNotification::SECRET_MASK, BaseChatNotification::SUPPORTED_EVENTS, BaseChatNotification::SUPPORTED_EVENTS_FOR_LABEL_FILTER

Constants inherited from Integration

Integration::BASE_CLASSES, Integration::DEV_INTEGRATION_NAMES, Integration::INTEGRATION_NAMES, Integration::PROJECT_SPECIFIC_INTEGRATION_NAMES, Integration::SECTION_TYPE_CONFIGURATION, Integration::SECTION_TYPE_CONNECTION, Integration::SECTION_TYPE_TRIGGER, Integration::SNOWPLOW_EVENT_ACTION, Integration::SNOWPLOW_EVENT_LABEL, Integration::UnknownType

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Instance Attribute Summary

Attributes included from Importable

#imported, #importing

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseSlackNotification

#configurable_channels?, #default_channel_placeholder, #get_message, #help, supported_events, #supported_events

Methods inherited from BaseChatNotification

#api_field_names, #channel_limit_per_event, #confidential_issue_channel, #confidential_note_channel, #configurable_channels?, #default_channel_placeholder, #event_channel_name, #event_channel_names, #event_channel_value, #execute, #form_fields, #help, #initialize_properties, #mask_configurable_channels?, supported_events, #webhook_help

Methods included from NotificationBranchSelection

#notify_for_branch?

Methods inherited from Integration

#activate_disabled_reason, #activated?, #api_field_names, #async_execute, #attributes, available_integration_names, available_integration_types, boolean_accessor, build_from_integration, #category, #chat?, #ci?, create_from_active_default_integrations, default_integration, default_test_event, #default_test_event, dev_integration_names, #dup, #event_channel_names, event_description, #event_names, event_names, #execute, field, fields, find_or_initialize_all_non_project_specific, find_or_initialize_non_project_specific_integration, #form_fields, #group_level?, #help, #inheritable?, inherited_descendants_from_self_or_ancestors_from, #initialize_properties, instance_exists_for?, #instance_level?, integration_name_to_model, integration_name_to_type, integration_names, #json_fields, #operating?, #parent, #project_level?, project_specific_integration_names, prop_accessor, #properties=, #reencrypt_properties, #reset_updated_properties, #secret_fields, supported_events, #supported_events, #supports_data_fields?, #testable?, #to_database_hash, #to_param, #updated_properties

Methods included from Gitlab::Utils::Override

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

Methods included from ResetSecretFields

#exposing_secrets_fields

Methods included from Loggable

#build_message, #log_error, #log_exception, #log_info, #logger

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Class Method Details

.requires_webhook?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'app/models/integrations/gitlab_slack_application.rb', line 82

def self.requires_webhook?
  false
end

.to_paramObject



37
38
39
# File 'app/models/integrations/gitlab_slack_application.rb', line 37

def self.to_param
  'gitlab_slack_application'
end

Instance Method Details

#configurable_eventsObject



75
76
77
78
79
# File 'app/models/integrations/gitlab_slack_application.rb', line 75

def configurable_events
  return [] unless editable?

  super
end

#descriptionObject



33
34
35
# File 'app/models/integrations/gitlab_slack_application.rb', line 33

def description
  s_('Integrations|Enable slash commands and notifications for a Slack workspace.')
end

#editable?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'app/models/integrations/gitlab_slack_application.rb', line 56

def editable?
  activated?
end

#fieldsObject



61
62
63
64
65
# File 'app/models/integrations/gitlab_slack_application.rb', line 61

def fields
  return [] unless editable?

  super
end

#sectionsObject



68
69
70
71
72
# File 'app/models/integrations/gitlab_slack_application.rb', line 68

def sections
  return [] unless editable?

  super.drop(1)
end

#show_active_box?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'app/models/integrations/gitlab_slack_application.rb', line 42

def show_active_box?
  false
end

#test(_data) ⇒ Object



47
48
49
50
51
# File 'app/models/integrations/gitlab_slack_application.rb', line 47

def test(_data)
  failures = test_notification_channels

  { success: failures.blank?, result: failures }
end

#titleObject



29
30
31
# File 'app/models/integrations/gitlab_slack_application.rb', line 29

def title
  s_('Integrations|GitLab for Slack app')
end

#update_active_statusObject



25
26
27
# File 'app/models/integrations/gitlab_slack_application.rb', line 25

def update_active_status
  update(active: !!slack_integration)
end

#upgrade_needed?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'app/models/integrations/gitlab_slack_application.rb', line 86

def upgrade_needed?
  slack_integration.present? && slack_integration.upgrade_needed?
end