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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
07e86b12
Commit
07e86b12
authored
Aug 08, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send emails via sidekiq worker
parent
71f7675c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
0 deletions
+32
-0
app/mailers/emails/admin_notification.rb
app/mailers/emails/admin_notification.rb
+8
-0
app/mailers/notify.rb
app/mailers/notify.rb
+1
-0
app/views/notify/send_admin_notification.html.haml
app/views/notify/send_admin_notification.html.haml
+1
-0
app/views/notify/send_admin_notification.text.haml
app/views/notify/send_admin_notification.text.haml
+1
-0
app/workers/admin_emails_worker.rb
app/workers/admin_emails_worker.rb
+21
-0
No files found.
app/mailers/emails/admin_notification.rb
0 → 100644
View file @
07e86b12
module
Emails
module
AdminNotification
def
send_admin_notification
(
user_id
,
subject
,
body
)
@body
=
body
mail
to:
recipient
(
user_id
),
subject:
subject
end
end
end
\ No newline at end of file
app/mailers/notify.rb
View file @
07e86b12
class
Notify
<
ActionMailer
::
Base
include
ActionDispatch
::
Routing
::
PolymorphicRoutes
include
Emails
::
AdminNotification
include
Emails
::
Issues
include
Emails
::
MergeRequests
include
Emails
::
Notes
...
...
app/views/notify/send_admin_notification.html.haml
0 → 100644
View file @
07e86b12
=
simple_format
@body
\ No newline at end of file
app/views/notify/send_admin_notification.text.haml
0 → 100644
View file @
07e86b12
=
h
@body
\ No newline at end of file
app/workers/admin_emails_worker.rb
0 → 100644
View file @
07e86b12
class
AdminEmailsWorker
include
Sidekiq
::
Worker
def
perform
(
recipient_id
,
subject
,
body
)
recipient_list
(
recipient_id
).
pluck
(
:id
).
each
do
|
user_id
|
Notify
.
send_admin_notification
(
user_id
,
subject
,
body
).
deliver
end
end
private
def
recipient_list
(
recipient_id
)
case
recipient_id
when
'all'
User
.
where
(
nil
)
when
/group-(\d+)\z/
Group
.
find
(
$1
).
users
when
/project-(\d+)\z/
Project
.
find
(
$1
).
users
end
end
end
\ No newline at end of file
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