Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2014-11-12 13:59:57 +0300
committerMarin Jankovski <maxlazio@gmail.com>2014-11-12 13:59:57 +0300
commit857852ce048607a0898a9b40e04fdb0658b6a83d (patch)
treec30c5c9a89ce08954a4526b2ad6089fbc5c0ecf4 /app/helpers/emails_helper.rb
parentd65f2bad6c7f834b708886f1ee8160a67281638d (diff)
Set action on issue/mr creation mail.
Diffstat (limited to 'app/helpers/emails_helper.rb')
-rw-r--r--app/helpers/emails_helper.rb34
1 files changed, 23 insertions, 11 deletions
diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb
index 2ef28922ec1..24d67c21d6b 100644
--- a/app/helpers/emails_helper.rb
+++ b/app/helpers/emails_helper.rb
@@ -2,19 +2,31 @@ module EmailsHelper
# Google Actions
# https://developers.google.com/gmail/markup/reference/go-to-action
- def email_action(options)
- data = {
- "@context" => "http://schema.org",
- "@type" => "EmailMessage",
- "action" => {
- "@type" => "ViewAction",
- "name" => options[:name],
- "url" => options[:url],
+ 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
+ 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