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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
ef2c8593
Commit
ef2c8593
authored
Apr 11, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable mailer for spinach
parent
e996c526
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
app/services/notification_service.rb
app/services/notification_service.rb
+13
-9
spec/support/test_env.rb
spec/support/test_env.rb
+5
-1
No files found.
app/services/notification_service.rb
View file @
ef2c8593
...
@@ -13,7 +13,7 @@ class NotificationService
...
@@ -13,7 +13,7 @@ class NotificationService
# even if user disabled notifications
# even if user disabled notifications
def
new_key
(
key
)
def
new_key
(
key
)
if
key
.
user
if
key
.
user
Notify
.
delay
.
new_ssh_key_email
(
key
.
id
)
mailer
.
new_ssh_key_email
(
key
.
id
)
end
end
end
end
...
@@ -84,14 +84,14 @@ class NotificationService
...
@@ -84,14 +84,14 @@ class NotificationService
recipients
=
recipients
.
concat
(
project_watchers
(
merge_request
.
project
)).
uniq
recipients
=
recipients
.
concat
(
project_watchers
(
merge_request
.
project
)).
uniq
recipients
.
each
do
|
recipient
|
recipients
.
each
do
|
recipient
|
Notify
.
delay
.
merged_merge_request_email
(
recipient
.
id
,
merge_request
.
id
)
mailer
.
merged_merge_request_email
(
recipient
.
id
,
merge_request
.
id
)
end
end
end
end
# Notify new user with email after creation
# Notify new user with email after creation
def
new_user
(
user
)
def
new_user
(
user
)
# Dont email omniauth created users
# Dont email omniauth created users
Notify
.
delay
.
new_user_email
(
user
.
id
,
user
.
password
)
unless
user
.
extern_uid?
mailer
.
new_user_email
(
user
.
id
,
user
.
password
)
unless
user
.
extern_uid?
end
end
# Notify users on new note in system
# Notify users on new note in system
...
@@ -131,16 +131,16 @@ class NotificationService
...
@@ -131,16 +131,16 @@ class NotificationService
notify_method
=
"note_
#{
note
.
noteable_type
.
underscore
}
_email"
.
to_sym
notify_method
=
"note_
#{
note
.
noteable_type
.
underscore
}
_email"
.
to_sym
recipients
.
each
do
|
recipient
|
recipients
.
each
do
|
recipient
|
Notify
.
delay
.
send
(
notify_method
,
recipient
.
id
,
note
.
id
)
mailer
.
send
(
notify_method
,
recipient
.
id
,
note
.
id
)
end
end
end
end
def
new_team_member
(
users_project
)
def
new_team_member
(
users_project
)
Notify
.
delay
.
project_access_granted_email
(
users_project
.
id
)
mailer
.
project_access_granted_email
(
users_project
.
id
)
end
end
def
update_team_member
(
users_project
)
def
update_team_member
(
users_project
)
Notify
.
delay
.
project_access_granted_email
(
users_project
.
id
)
mailer
.
project_access_granted_email
(
users_project
.
id
)
end
end
protected
protected
...
@@ -186,7 +186,7 @@ class NotificationService
...
@@ -186,7 +186,7 @@ class NotificationService
recipients
.
delete
(
target
.
author
)
recipients
.
delete
(
target
.
author
)
recipients
.
each
do
|
recipient
|
recipients
.
each
do
|
recipient
|
Notify
.
delay
.
send
(
method
,
recipient
.
id
,
target
.
id
)
mailer
.
send
(
method
,
recipient
.
id
,
target
.
id
)
end
end
end
end
...
@@ -196,7 +196,7 @@ class NotificationService
...
@@ -196,7 +196,7 @@ class NotificationService
recipients
.
delete
(
current_user
)
recipients
.
delete
(
current_user
)
recipients
.
each
do
|
recipient
|
recipients
.
each
do
|
recipient
|
Notify
.
delay
.
send
(
method
,
recipient
.
id
,
target
.
id
,
current_user
.
id
)
mailer
.
send
(
method
,
recipient
.
id
,
target
.
id
,
current_user
.
id
)
end
end
end
end
...
@@ -213,7 +213,11 @@ class NotificationService
...
@@ -213,7 +213,11 @@ class NotificationService
recipients
.
delete
(
current_user
)
recipients
.
delete
(
current_user
)
recipients
.
each
do
|
recipient
|
recipients
.
each
do
|
recipient
|
Notify
.
delay
.
send
(
method
,
recipient
.
id
,
target
.
id
,
target
.
assignee_id_was
)
mailer
.
send
(
method
,
recipient
.
id
,
target
.
id
,
target
.
assignee_id_was
)
end
end
end
end
def
mailer
Notify
.
delay
end
end
end
spec/support/test_env.rb
View file @
ef2c8593
require
'rspec/mocks'
module
TestEnv
module
TestEnv
extend
self
extend
self
...
@@ -13,6 +15,8 @@ module TestEnv
...
@@ -13,6 +15,8 @@ module TestEnv
# - remove_key
# - remove_key
#
#
def
init
(
opts
=
{})
def
init
(
opts
=
{})
RSpec
::
Mocks
::
setup
(
self
)
# Disable observers to improve test speed
# Disable observers to improve test speed
#
#
# You can enable it in whole test case where needed by next string:
# You can enable it in whole test case where needed by next string:
...
@@ -82,6 +86,6 @@ module TestEnv
...
@@ -82,6 +86,6 @@ module TestEnv
end
end
def
disable_mailer
def
disable_mailer
ActionMailer
::
Base
.
perform_deliveries
=
false
NotificationService
.
any_instance
.
stub
(
mailer:
double
.
as_null_object
)
end
end
end
end
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