Merge branch 'actions_in_the_inbox' into 'master'
Actions in the inbox Related to #1607 See merge request !1247
This commit is contained in:
commit
6adc313a1f
|
@ -0,0 +1,32 @@
|
||||||
|
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 ApplicationHelper
|
||||||
add_template_helper GitlabMarkdownHelper
|
add_template_helper GitlabMarkdownHelper
|
||||||
add_template_helper MergeRequestsHelper
|
add_template_helper MergeRequestsHelper
|
||||||
|
add_template_helper EmailsHelper
|
||||||
|
|
||||||
default_url_options[:host] = Gitlab.config.gitlab.host
|
default_url_options[:host] = Gitlab.config.gitlab.host
|
||||||
default_url_options[:protocol] = Gitlab.config.gitlab.protocol
|
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.
|
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
|
- if @target_url
|
||||||
#{link_to "View it on GitLab", @target_url}
|
#{link_to "View it on GitLab", @target_url}
|
||||||
|
= email_action @target_url
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1,11 @@
|
||||||
|
# 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)
|
||||||
|
|
Loading…
Reference in New Issue