Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
857852ce
Commit
857852ce
authored
Nov 12, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set action on issue/mr creation mail.
parent
d65f2bad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
app/helpers/emails_helper.rb
app/helpers/emails_helper.rb
+23
-11
app/views/layouts/notify.html.haml
app/views/layouts/notify.html.haml
+1
-1
No files found.
app/helpers/emails_helper.rb
View file @
857852ce
...
...
@@ -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
app/views/layouts/notify.html.haml
View file @
857852ce
...
...
@@ -28,4 +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
name:
"View
#{
@note
.
noteable_type
.
underscore
.
humanize
}
"
,
url:
@target_url
=
email_action
@target_url
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment