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
Léo-Paul Géneau
gitlab-ce
Commits
874413cf
Commit
874413cf
authored
Mar 21, 2017
by
Douwe Maan
Committed by
Luke "Jared" Bennett
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
79889a6a
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
13 additions
and
13 deletions
+13
-13
app/mailers/emails/notes.rb
app/mailers/emails/notes.rb
+1
-0
app/mailers/notify.rb
app/mailers/notify.rb
+2
-2
app/services/notes/build_service.rb
app/services/notes/build_service.rb
+3
-1
app/views/discussions/_notes.html.haml
app/views/discussions/_notes.html.haml
+1
-1
app/views/layouts/notify.html.haml
app/views/layouts/notify.html.haml
+2
-2
app/views/notify/new_mention_in_issue_email.html.haml
app/views/notify/new_mention_in_issue_email.html.haml
+1
-1
app/views/notify/new_mention_in_merge_request_email.html.haml
...views/notify/new_mention_in_merge_request_email.html.haml
+1
-1
spec/factories/sent_notifications.rb
spec/factories/sent_notifications.rb
+1
-1
spec/models/discussion_note_spec.rb
spec/models/discussion_note_spec.rb
+0
-1
spec/models/individual_note_discussion_spec.rb
spec/models/individual_note_discussion_spec.rb
+0
-1
spec/models/out_of_context_discussion_spec.rb
spec/models/out_of_context_discussion_spec.rb
+0
-1
spec/models/sent_notification_spec.rb
spec/models/sent_notification_spec.rb
+1
-1
No files found.
app/mailers/emails/notes.rb
View file @
874413cf
...
@@ -66,6 +66,7 @@ module Emails
...
@@ -66,6 +66,7 @@ module Emails
def
setup_note_mail
(
note_id
,
recipient_id
)
def
setup_note_mail
(
note_id
,
recipient_id
)
@note
=
Note
.
find
(
note_id
)
@note
=
Note
.
find
(
note_id
)
@project
=
@note
.
project
@project
=
@note
.
project
return
unless
@project
@sent_notification
=
SentNotification
.
record_note
(
@note
,
recipient_id
,
reply_key
)
@sent_notification
=
SentNotification
.
record_note
(
@note
,
recipient_id
,
reply_key
)
end
end
...
...
app/mailers/notify.rb
View file @
874413cf
...
@@ -111,7 +111,7 @@ class Notify < BaseMailer
...
@@ -111,7 +111,7 @@ class Notify < BaseMailer
headers
[
"X-GitLab-
#{
model
.
class
.
name
}
-ID"
]
=
model
.
id
headers
[
"X-GitLab-
#{
model
.
class
.
name
}
-ID"
]
=
model
.
id
headers
[
'X-GitLab-Reply-Key'
]
=
reply_key
headers
[
'X-GitLab-Reply-Key'
]
=
reply_key
if
Gitlab
::
IncomingEmail
.
enabled?
if
Gitlab
::
IncomingEmail
.
enabled?
&&
@sent_notification
address
=
Mail
::
Address
.
new
(
Gitlab
::
IncomingEmail
.
reply_address
(
reply_key
))
address
=
Mail
::
Address
.
new
(
Gitlab
::
IncomingEmail
.
reply_address
(
reply_key
))
address
.
display_name
=
@project
.
name_with_namespace
address
.
display_name
=
@project
.
name_with_namespace
...
@@ -176,6 +176,6 @@ class Notify < BaseMailer
...
@@ -176,6 +176,6 @@ class Notify < BaseMailer
end
end
headers
[
'List-Unsubscribe'
]
=
list_unsubscribe_methods
.
map
{
|
e
|
"<
#{
e
}
>"
}.
join
(
','
)
headers
[
'List-Unsubscribe'
]
=
list_unsubscribe_methods
.
map
{
|
e
|
"<
#{
e
}
>"
}.
join
(
','
)
@
sent_notification
_url
=
unsubscribe_sent_notification_url
(
@sent_notification
)
@
unsubscribe
_url
=
unsubscribe_sent_notification_url
(
@sent_notification
)
end
end
end
end
app/services/notes/build_service.rb
View file @
874413cf
...
@@ -2,6 +2,8 @@ module Notes
...
@@ -2,6 +2,8 @@ module Notes
class
BuildService
<
BaseService
class
BuildService
<
BaseService
def
execute
def
execute
in_reply_to_discussion_id
=
params
.
delete
(
:in_reply_to_discussion_id
)
in_reply_to_discussion_id
=
params
.
delete
(
:in_reply_to_discussion_id
)
new_discussion
=
params
.
delete
(
:new_discussion
)
if
project
&&
in_reply_to_discussion_id
.
present?
if
project
&&
in_reply_to_discussion_id
.
present?
discussion
=
discussion
=
project
.
notes
.
find_original_discussion
(
in_reply_to_discussion_id
)
||
project
.
notes
.
find_original_discussion
(
in_reply_to_discussion_id
)
||
...
@@ -14,7 +16,7 @@ module Notes
...
@@ -14,7 +16,7 @@ module Notes
end
end
params
.
merge!
(
discussion
.
reply_attributes
)
params
.
merge!
(
discussion
.
reply_attributes
)
elsif
params
.
delete
(
:new_discussion
)
elsif
new_discussion
# TODO: Remove when we use a selectbox instead of a submit button
# TODO: Remove when we use a selectbox instead of a submit button
params
[
:type
]
=
DiscussionNote
.
name
params
[
:type
]
=
DiscussionNote
.
name
end
end
...
...
app/views/discussions/_notes.html.haml
View file @
874413cf
app/views/layouts/notify.html.haml
View file @
874413cf
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
-
if
@labels_url
-
if
@labels_url
adjust your
#{
link_to
'label subscriptions'
,
@labels_url
}
.
adjust your
#{
link_to
'label subscriptions'
,
@labels_url
}
.
-
else
-
else
-
if
@
sent_notification
_url
-
if
@
unsubscribe
_url
=
link_to
"unsubscribe"
,
@
sent_notification
_url
=
link_to
"unsubscribe"
,
@
unsubscribe
_url
from this thread or
from this thread or
adjust your notification settings.
adjust your notification settings.
...
...
app/views/notify/new_mention_in_issue_email.html.haml
View file @
874413cf
%p
%p
You have been mentioned in an issue.
You have been mentioned in an issue.
=
render
template:
'new_issue_email'
=
render
template:
'n
otify/n
ew_issue_email'
app/views/notify/new_mention_in_merge_request_email.html.haml
View file @
874413cf
%p
%p
You have been mentioned in Merge Request
#{
@merge_request
.
to_reference
}
You have been mentioned in Merge Request
#{
@merge_request
.
to_reference
}
=
render
template:
'new_merge_request_email'
=
render
template:
'n
otify/n
ew_merge_request_email'
spec/factories/sent_notifications.rb
View file @
874413cf
...
@@ -2,7 +2,7 @@ FactoryGirl.define do
...
@@ -2,7 +2,7 @@ FactoryGirl.define do
factory
:sent_notification
do
factory
:sent_notification
do
project
factory: :empty_project
project
factory: :empty_project
recipient
factory: :user
recipient
factory: :user
noteable
factory: :issue
noteable
{
create
(
:issue
,
project:
project
)
}
reply_key
{
SentNotification
.
reply_key
}
reply_key
{
SentNotification
.
reply_key
}
end
end
end
end
spec/models/discussion_note_spec.rb
View file @
874413cf
require
'spec_helper'
require
'spec_helper'
describe
DiscussionNote
,
models:
true
do
describe
DiscussionNote
,
models:
true
do
end
end
spec/models/individual_note_discussion_spec.rb
View file @
874413cf
require
'spec_helper'
require
'spec_helper'
describe
IndividualNoteDiscussion
,
models:
true
do
describe
IndividualNoteDiscussion
,
models:
true
do
end
end
spec/models/out_of_context_discussion_spec.rb
View file @
874413cf
require
'spec_helper'
require
'spec_helper'
describe
OutOfContextDiscussion
,
model:
true
do
describe
OutOfContextDiscussion
,
model:
true
do
end
end
spec/models/sent_notification_spec.rb
View file @
874413cf
...
@@ -4,7 +4,7 @@ describe SentNotification, model: true do
...
@@ -4,7 +4,7 @@ describe SentNotification, model: true do
describe
'validation'
do
describe
'validation'
do
describe
'note validity'
do
describe
'note validity'
do
context
"when the project doesn't match the noteable's project"
do
context
"when the project doesn't match the noteable's project"
do
subject
{
build
(
:sent_notification
,
project:
create
(
:project
))
}
subject
{
build
(
:sent_notification
,
noteable:
create
(
:issue
))
}
it
"is invalid"
do
it
"is invalid"
do
expect
(
subject
).
not_to
be_valid
expect
(
subject
).
not_to
be_valid
...
...
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