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
5ba2ccff
Commit
5ba2ccff
authored
Mar 08, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extracted CSV export mailer from issues mailer
parent
40b004b9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
14 deletions
+18
-14
app/mailers/emails/csv_export.rb
app/mailers/emails/csv_export.rb
+17
-0
app/mailers/emails/issues.rb
app/mailers/emails/issues.rb
+0
-14
app/mailers/notify.rb
app/mailers/notify.rb
+1
-0
spec/mailers/emails/csv_export_spec.rb
spec/mailers/emails/csv_export_spec.rb
+0
-0
No files found.
app/mailers/emails/csv_export.rb
0 → 100644
View file @
5ba2ccff
module
Emails
module
CsvExport
def
issues_csv_email
(
user
,
project
,
csv_data
,
export_status
)
@project
=
project
@issues_count
=
export_status
.
fetch
(
:rows_expected
)
@written_count
=
export_status
.
fetch
(
:rows_written
)
@truncated
=
export_status
.
fetch
(
:truncated
)
filename
=
"
#{
project
.
full_path
.
parameterize
}
_issues_
#{
Date
.
today
.
iso8601
}
.csv"
attachments
[
filename
]
=
{
content:
csv_data
,
mime_type:
'text/csv'
}
mail
(
to:
user
.
notification_email
,
subject:
subject
(
"Exported issues"
))
do
|
format
|
format
.
html
{
render
layout:
'mailer'
}
format
.
text
{
render
layout:
'mailer'
}
end
end
end
end
app/mailers/emails/issues.rb
View file @
5ba2ccff
...
...
@@ -49,20 +49,6 @@ module Emails
mail_answer_thread
(
issue
,
issue_thread_options
(
updated_by_user
.
id
,
recipient
.
id
))
end
def
issues_csv_email
(
user
,
project
,
csv_data
,
export_status
)
@project
=
project
@issues_count
=
export_status
.
fetch
(
:rows_expected
)
@written_count
=
export_status
.
fetch
(
:rows_written
)
@truncated
=
export_status
.
fetch
(
:truncated
)
filename
=
"
#{
project
.
full_path
.
parameterize
}
_issues_
#{
Date
.
today
.
iso8601
}
.csv"
attachments
[
filename
]
=
{
content:
csv_data
,
mime_type:
'text/csv'
}
mail
(
to:
user
.
notification_email
,
subject:
subject
(
"Exported issues"
),
skip_premailer:
true
)
do
|
format
|
format
.
html
{
render
layout:
'mailer'
}
format
.
text
{
render
layout:
'mailer'
}
end
end
private
def
setup_issue_mail
(
issue_id
,
recipient_id
)
...
...
app/mailers/notify.rb
View file @
5ba2ccff
...
...
@@ -3,6 +3,7 @@ class Notify < BaseMailer
include
Emails
::
AdminNotification
include
Emails
::
Issues
include
Emails
::
CsvExport
include
Emails
::
MergeRequests
include
Emails
::
Notes
include
Emails
::
Projects
...
...
spec/mailers/emails/
issues
_spec.rb
→
spec/mailers/emails/
csv_export
_spec.rb
View file @
5ba2ccff
File moved
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