Commit 6adc313a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'actions_in_the_inbox' into 'master'

Actions in the inbox

Related to #1607

See merge request !1247
parents 3bd12e99 857852ce
module EmailsHelper
# Google Actions
# 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
end
def action_title(url)
return unless url
["merge_requests", "issues", "commit"].each do |action|
if url.split("/").include?(action)
return "View #{action.humanize.singularize}"
end
end
end
end
......@@ -11,6 +11,7 @@ class Notify < ActionMailer::Base
add_template_helper ApplicationHelper
add_template_helper GitlabMarkdownHelper
add_template_helper MergeRequestsHelper
add_template_helper EmailsHelper
default_url_options[:host] = Gitlab.config.gitlab.host
default_url_options[:protocol] = Gitlab.config.gitlab.protocol
......
......@@ -28,3 +28,4 @@
You're receiving this notification because you are a member of the #{link_to_unless @target_url, @project.name_with_namespace, project_url(@project)} project team.
- if @target_url
#{link_to "View it on GitLab", @target_url}
= email_action @target_url
# GitLab buttons in gmail
GitLab supports [Google actions in email](https://developers.google.com/gmail/markup/actions/actions-overview).
If correctly setup, emails that require an action will be marked in Gmail.
![gitlab_actions](gitlab_actions.png)
To get this functioning, you need to be registered with Google.
[See how to register with google in this document.](https://developers.google.com/gmail/markup/registering-with-google)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment