Class: Notify

Constant Summary

Constants included from Emails::InProductMarketing

Emails::InProductMarketing::CUSTOM_HEADERS, Emails::InProductMarketing::FROM_ADDRESS

Constants included from Emails::Members

Emails::Members::INITIAL_INVITE

Instance Attribute Summary

Attributes inherited from ApplicationMailer

#current_user

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Emails::AdminNotification

#send_admin_notification, #send_unsubscribed_notification

Methods included from Emails::InProductMarketing

#build_ios_app_guide_email, #in_product_marketing_email

Methods included from Emails::ServiceDesk

#service_desk_new_note_email, #service_desk_thank_you_email

Methods included from MarkupHelper

#asciidoc?, #cross_project_reference, #first_line_in_markdown, #gitlab_markdown?, #link_to_html, #link_to_markdown, #link_to_markdown_field, #markdown, #markdown_field, #markup, #markup?, #markup_unsafe, #plain?, #render_wiki_content

Methods included from Emails::Reviews

#new_review_email

Methods included from Emails::Groups

#group_email, #group_was_exported_email, #group_was_not_exported_email

Methods included from Emails::Releases

#new_release_email

Methods included from Emails::RemoteMirrors

#remote_mirror_update_failed_email

Methods included from Emails::AutoDevops

#autodevops_disabled_email

Methods included from Emails::Members

#member, #member_access_denied_email, #member_access_granted_email, #member_access_requested_email, #member_expiration_date_updated_email, #member_invite_accepted_email, #member_invite_declined_email, #member_invited_email, #member_invited_reminder_email, #member_source, #notification_group

Methods included from MembersHelper

#filter_group_project_member_path, #leave_confirmation_message, #localized_tasks_to_be_done_choices, #member_path, #remove_member_message, #remove_member_title

Methods included from Emails::Pipelines

#pipeline_failed_email, #pipeline_fixed_email, #pipeline_success_email

Methods included from Emails::Profile

#access_token_about_to_expire_email, #access_token_created_email, #access_token_expired_email, #disabled_two_factor_email, #instance_access_request_email, #new_email_address_added_email, #new_gpg_key_email, #new_ssh_key_email, #new_user_email, #ssh_key_expired_email, #ssh_key_expiring_soon_email, #unknown_sign_in_email, #user_admin_rejection_email, #user_deactivated_email

Methods included from Emails::Projects

#project_was_exported_email, #project_was_moved_email, #project_was_not_exported_email, #prometheus_alert_fired_email, #repository_cleanup_failure_email, #repository_cleanup_success_email, #repository_push_email

Methods included from Emails::PagesDomains

#pages_domain_auto_ssl_failed_email, #pages_domain_disabled_email, #pages_domain_enabled_email, #pages_domain_verification_failed_email, #pages_domain_verification_succeeded_email

Methods included from Emails::Notes

#note_commit_email, #note_design_email, #note_issue_email, #note_merge_request_email, #note_snippet_email

Methods included from Emails::MergeRequests

#approved_merge_request_email, #attention_requested_merge_request_email, #change_in_merge_request_draft_status_email, #changed_milestone_merge_request_email, #changed_reviewer_of_merge_request_email, #closed_merge_request_email, #merge_request_status_email, #merge_request_unmergeable_email, #merge_requests_csv_email, #merge_when_pipeline_succeeds_email, #merged_merge_request_email, #new_mention_in_merge_request_email, #new_merge_request_email, #push_to_merge_request_email, #reassigned_merge_request_email, #relabeled_merge_request_email, #removed_milestone_merge_request_email, #request_review_merge_request_email, #resolved_all_discussions_email, #unapproved_merge_request_email

Methods included from Emails::Issues

#changed_milestone_issue_email, #closed_issue_email, #import_issues_csv_email, #issue_cloned_email, #issue_due_email, #issue_moved_email, #issue_status_changed_email, #issues_csv_email, #new_issue_email, #new_mention_in_issue_email, #reassigned_issue_email, #relabeled_issue_email, #removed_milestone_issue_email

Methods included from IssuablesHelper

#assigned_issuables_count, #assignee_sidebar_data, #assignees_label, #close_issuable_path, #due_date_with_remaining_days, #group_dropdown_label, #has_filter_bar_param?, #issuable_author_is_current_user, #issuable_display_type, #issuable_initial_data, #issuable_meta, #issuable_meta_author_slot, #issuable_meta_author_status, #issuable_path, #issuable_project_reference, #issuable_reference, #issuable_squash_option?, #issuables_count_for_state, #issuables_state_counter_text, #issue_only_initial_data, #milestone_dropdown_label, #multi_label_name, #path_data, #project_dropdown_label, #reopen_issuable_path, #reviewer_sidebar_data, #serialize_issuable, #sidebar_due_date_tooltip_label, #sidebar_gutter_collapsed_class, #sidebar_gutter_toggle_icon, #sidebar_gutter_tooltip_text, #sidebar_milestone_remaining_days, #sidebar_milestone_tooltip_label, #state_name_with_icon, #updated_at_by, #user_dropdown_label, #users_dropdown_label

Methods included from Sidebars::Concerns::HasPill

#format_cached_count, #has_pill?, #pill_count, #pill_html_options

Methods included from IssuablesDescriptionTemplatesHelper

#available_service_desk_templates_for, #issuable_templates, #selected_template, #template_dropdown_tag, #template_names_path

Methods included from Routing::PseudonymizationHelper

#masked_page_url

Methods included from Routing::GraphqlHelper

#graphql_etag_pipeline_path, #graphql_etag_pipeline_sha_path, #graphql_etag_project_on_demand_scan_counts_path

Methods included from Routing::WikiHelper

#wiki_page_path, #wiki_path

Methods included from Routing::SnippetsHelper

#gitlab_dashboard_snippets_path, #gitlab_raw_snippet_blob_path, #gitlab_raw_snippet_blob_url, #gitlab_raw_snippet_path, #gitlab_raw_snippet_url, #gitlab_snippet_note_path, #gitlab_snippet_note_url, #gitlab_snippet_notes_path, #gitlab_snippet_notes_url, #gitlab_snippet_path, #gitlab_snippet_url, #gitlab_toggle_award_emoji_snippet_note_path, #gitlab_toggle_award_emoji_snippet_note_url, #gitlab_toggle_award_emoji_snippet_path, #gitlab_toggle_award_emoji_snippet_url, #preview_markdown_path, #toggle_award_emoji_personal_snippet_path, #toggle_award_emoji_project_project_snippet_path, #toggle_award_emoji_project_project_snippet_url

Methods included from Routing::PipelineSchedulesHelper

#edit_pipeline_schedule_path, #pipeline_schedule_path, #pipeline_schedules_path, #play_pipeline_schedule_path, #take_ownership_pipeline_schedule_path

Methods included from Routing::ArtifactsHelper

#artifacts_action_path, #expose_fast_artifacts_path, #fast_browse_project_job_artifacts_path, #fast_download_project_job_artifacts_path, #fast_keep_project_job_artifacts_path

Methods included from Routing::MembersHelper

#source_members_url

Methods included from Routing::Groups::MembersHelper

#approve_access_request_group_member_path, #group_member_path, #group_members_url, #leave_group_members_path, #request_access_group_members_path, #resend_invite_group_member_path

Methods included from Routing::Projects::MembersHelper

#approve_access_request_project_member_path, #leave_project_members_path, #project_member_path, #project_members_url, #request_access_project_members_path, #resend_invite_project_member_path

Methods included from Routing::ProjectsHelper

#commit_url, #commits_url, #edit_milestone_path, #environment_delete_path, #environment_path, #issue_path, #issue_url, #merge_request_path, #merge_request_url, #pipeline_job_url, #pipeline_path, #pipeline_url, #project_commits_path, #project_ref_path, #project_tree_path, #release_url, #toggle_subscription_path

Methods included from API::Helpers::RelatedResourcesHelpers

#expose_path, #expose_url, #issues_available?, #mrs_available?

Methods included from ApplicationSettingsHelper

#all_protocols_enabled?, #allowed_protocols_present?, #deprecated_attributes, #enabled_protocol, #enabled_protocol_button, #expanded_by_default?, #external_authorization_client_certificate_help_text, #external_authorization_client_key_help_text, #external_authorization_client_pass_help_text, #external_authorization_client_url_help_text, #external_authorization_description, #external_authorization_service_attributes, #external_authorization_timeout_help_text, #external_authorization_url_help_text, #http_enabled?, #import_sources_checkboxes, #instance_clusters_enabled?, #integration_expanded?, #key_restriction_options_for_select, #kroki_available_formats, #oauth_providers_checkboxes, #omnibus_protected_paths_throttle?, #pending_user_count, #registration_features_can_be_prompted?, #repository_storages_options_json, #restricted_level_checkboxes, #self_monitoring_project_data, #sidekiq_job_limiter_mode_help_text, #sidekiq_job_limiter_modes_for_select, #signup_enabled?, #ssh_enabled?, #storage_weights, #user_oauth_applications?, #valid_runner_registrars, #visible_attributes

Methods included from ProjectsHelper

#able_to_see_issues?, #able_to_see_merge_requests?, #any_projects?, #author_content_tag, #autodeploy_flash_notice, #can_admin_project_member?, #can_change_visibility_level?, #can_disable_emails?, #delete_confirm_phrase, #directory?, #error_tracking_setting_project_json, #explore_projects_tab?, #external_classification_label_help_message, #fork_button_disabled_tooltip, #grafana_integration_enabled?, #grafana_integration_masked_token, #grafana_integration_url, #import_from_bitbucket_message, #import_from_gitlab_message, #last_push_event, #link_to_autodeploy_doc, #link_to_member, #link_to_member_avatar, #link_to_project, #load_pipeline_status, #membership_locked?, #metrics_dashboard_timezone, #metrics_external_dashboard_url, #no_password_message, #project_can_be_shared?, #project_classes, #project_incident_management_setting, #project_license_name, #project_list_cache_key, #project_permissions_panel_data, #project_search_tabs?, #project_title, #push_to_create_project_command, #remove_fork_project_confirm_json, #remove_fork_project_description_message, #remove_fork_project_warning_message, #remove_project_message, #share_project_description, #show_auto_devops_implicitly_enabled_banner?, #show_issue_count?, #show_merge_request_count?, #show_no_password_message?, #show_no_ssh_key_message?, #show_projects?, #show_terraform_banner?, #show_xcode_link?, #transfer_project_message, #visible_fork_source, #xcode_uri_to_repo

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods included from ReminderEmailsHelper

#invitation_reminder_accept_link, #invitation_reminder_body, #invitation_reminder_decline_link, #invitation_reminder_salutation

Methods included from EmailsHelper

#action_title, #admin_changed_password_text, #change_reviewer_notification_text, #closure_reason_text, #contact_your_administrator_text, #create_list_id_string, #email_action, #email_default_heading, #gmail_goto_action, #group_membership_expiration_changed_link, #group_membership_expiration_changed_text, #header_logo, #html_footer_message, #html_header_message, #instance_access_request_link, #instance_access_request_text, #new_email_address_added_text, #notification_reason_text, #password_reset_token_valid_time, #re_enable_two_factor_authentication_text, #remove_email_address_text, #sanitize_name, #say_hello, #say_hi, #text_footer_message, #text_header_message, #two_factor_authentication_disabled_text

Methods included from AppearancesHelper

#brand_header_logo, #brand_image, #brand_new_project_guidelines, #brand_profile_image_guidelines, #brand_text, #brand_title, #current_appearance, #default_brand_title, #footer_message, #header_message

Methods inherited from ApplicationMailer

#can?

Class Method Details

.allowed_email_domainsObject

Splits “gitlab.corp.company.com” up into “gitlab.corp.company.com”, “corp.company.com” and “company.com”. Respects set tld length so “company.co.uk” won't match “somethingelse.uk”


50
51
52
53
54
55
56
57
58
59
# File 'app/mailers/notify.rb', line 50

def self.allowed_email_domains
  domain_parts = Gitlab.config.gitlab.host.split(".")
  allowed_domains = []
  begin
    allowed_domains << domain_parts.join(".")
    domain_parts.shift
  end while domain_parts.length > ActionDispatch::Http::URL.tld_length

  allowed_domains
end

Instance Method Details

#can_send_from_user_email?(sender) ⇒ Boolean

Returns:

  • (Boolean)

61
62
63
64
# File 'app/mailers/notify.rb', line 61

def can_send_from_user_email?(sender)
  sender_domain = sender.email.split("@").last
  self.class.allowed_email_domains.include?(sender_domain)
end

#test_email(recipient_email, subject, body) ⇒ Object


39
40
41
42
43
44
45
# File 'app/mailers/notify.rb', line 39

def test_email(recipient_email, subject, body)
  mail(to: recipient_email,
       subject: subject,
       body: body.html_safe,
       content_type: 'text/html'
      )
end