Class: Integrations::EmailsOnPush
Constant Summary
collapse
- RECIPIENTS_LIMIT =
750
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
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Instance Attribute Summary
Attributes included from Importable
#imported, #importing
Class Method Summary
collapse
Instance Method Summary
collapse
#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?, #configurable_events, create_from_active_default_integrations, default_integration, #default_test_event, default_test_event, dev_integration_names, #dup, #editable?, #event_channel_names, event_description, event_names, #event_names, field, #fields, 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, 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, #sections, #show_active_box?, #supported_events, #supports_data_fields?, #test, #testable?, #to_database_hash, #to_param, #updated_properties
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
#exposing_secrets_fields
Methods included from Loggable
#build_message, #log_error, #log_exception, #log_info, #logger
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
#serializable_hash
Class Method Details
.supported_events ⇒ Object
54
55
56
|
# File 'app/models/integrations/emails_on_push.rb', line 54
def self.supported_events
%w[push tag_push]
end
|
.to_param ⇒ Object
50
51
52
|
# File 'app/models/integrations/emails_on_push.rb', line 50
def self.to_param
'emails_on_push'
end
|
.valid_recipients(recipients) ⇒ Object
38
39
40
|
# File 'app/models/integrations/emails_on_push.rb', line 38
def self.valid_recipients(recipients)
recipients.split.grep(Devise.email_regexp).uniq(&:downcase)
end
|
Instance Method Details
#description ⇒ Object
46
47
48
|
# File 'app/models/integrations/emails_on_push.rb', line 46
def description
s_('EmailsOnPushService|Email the commits and diff of each push to a list of recipients.')
end
|
#disable_diffs? ⇒ Boolean
89
90
91
|
# File 'app/models/integrations/emails_on_push.rb', line 89
def disable_diffs?
Gitlab::Utils.to_boolean(self.disable_diffs)
end
|
#execute(push_data) ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'app/models/integrations/emails_on_push.rb', line 64
def execute(push_data)
return unless supported_events.include?(push_data[:object_kind])
return if project.emails_disabled?
return unless notify_for_ref?(push_data)
EmailsOnPushWorker.perform_async(
project_id,
recipients,
push_data,
send_from_committer_email: send_from_committer_email?,
disable_diffs: disable_diffs?
)
end
|
#initialize_properties ⇒ Object
58
59
60
61
62
|
# File 'app/models/integrations/emails_on_push.rb', line 58
def initialize_properties
super
self.branches_to_be_notified = 'all' if branches_to_be_notified.nil?
end
|
#notify_for_ref?(push_data) ⇒ Boolean
78
79
80
81
82
83
|
# File 'app/models/integrations/emails_on_push.rb', line 78
def notify_for_ref?(push_data)
return true if push_data[:object_kind] == 'tag_push'
return true if push_data.dig(:object_attributes, :tag)
notify_for_branch?(push_data)
end
|
#send_from_committer_email? ⇒ Boolean
85
86
87
|
# File 'app/models/integrations/emails_on_push.rb', line 85
def send_from_committer_email?
Gitlab::Utils.to_boolean(self.send_from_committer_email)
end
|
#title ⇒ Object
42
43
44
|
# File 'app/models/integrations/emails_on_push.rb', line 42
def title
s_('EmailsOnPushService|Emails on push')
end
|