diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/helpers/emails_helper.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/helpers/emails_helper.rb')
-rw-r--r-- | app/helpers/emails_helper.rb | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb index 0b1bdb68e50..b804efb9561 100644 --- a/app/helpers/emails_helper.rb +++ b/app/helpers/emails_helper.rb @@ -7,21 +7,9 @@ module EmailsHelper # https://developers.google.com/gmail/markup/reference/go-to-action def email_action(url) name = action_title(url) - if name - data = { - "@context" => "http://schema.org", - "@type" => "EmailMessage", - "action" => { - "@type" => "ViewAction", - "name" => name, - "url" => url - } - } - - content_tag :script, type: 'application/ld+json' do - data.to_json.html_safe - end - end + return unless name + + gmail_goto_action(name, url) end def action_title(url) @@ -36,6 +24,22 @@ module EmailsHelper nil end + def gmail_goto_action(name, url) + data = { + "@context" => "http://schema.org", + "@type" => "EmailMessage", + "action" => { + "@type" => "ViewAction", + "name" => name, + "url" => url + } + } + + content_tag :script, type: 'application/ld+json' do + data.to_json.html_safe + end + end + def sanitize_name(name) if name =~ URI::DEFAULT_PARSER.regexp[:URI_REF] name.tr('.', '_') |