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
5bcd626f
Commit
5bcd626f
authored
Oct 21, 2016
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mailer to deliver issues csv as attachment
parent
44bc526b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
0 deletions
+37
-0
app/mailers/emails/issues.rb
app/mailers/emails/issues.rb
+7
-0
app/views/notify/issues_csv_email.html.haml
app/views/notify/issues_csv_email.html.haml
+2
-0
app/views/notify/issues_csv_email.text.erb
app/views/notify/issues_csv_email.text.erb
+1
-0
spec/mailers/emails/issues_spec.rb
spec/mailers/emails/issues_spec.rb
+19
-0
spec/mailers/previews/issues_csv_mailer_preview.rb
spec/mailers/previews/issues_csv_mailer_preview.rb
+8
-0
No files found.
app/mailers/emails/issues.rb
View file @
5bcd626f
...
...
@@ -49,6 +49,13 @@ module Emails
mail_answer_thread
(
issue
,
issue_thread_options
(
updated_by_user
.
id
,
recipient
.
id
))
end
def
issues_csv_email
(
user
,
project
,
content
)
#, issues) file_name: or content: or issues:
@project
=
project
attachments
[
'issues.csv'
]
=
{
content:
content
,
mime_type:
'text/csv'
}
mail
(
to:
user
.
notification_email
,
subject:
subject
(
"Issues exported as CSV"
))
end
private
def
setup_issue_mail
(
issue_id
,
recipient_id
)
...
...
app/views/notify/issues_csv_email.html.haml
0 → 100644
View file @
5bcd626f
%p
Your issues for
#{
@project
.
name
}
have been attached as a CSV.
\ No newline at end of file
app/views/notify/issues_csv_email.text.erb
0 → 100644
View file @
5bcd626f
Your issues for
<%=
@project
.
name
%>
have been attached as a CSV.
\ No newline at end of file
spec/mailers/emails/issues_spec.rb
0 → 100644
View file @
5bcd626f
require
'spec_helper'
require
'email_spec'
require
'mailers/shared/notify'
describe
Notify
do
include
EmailSpec
::
Matchers
include_context
'gitlab email notification'
describe
'csv export email'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:empty_project
)
{
create
(
:empty_project
)
}
subject
{
Notify
.
issues_csv_email
(
user
,
project
,
"dummy content"
)
}
it
'attachment has csv mime type'
do
attachment
=
subject
.
attachments
.
first
expect
(
attachment
.
mime_type
).
to
eq
'text/csv'
end
end
end
spec/mailers/previews/issues_csv_mailer_preview.rb
0 → 100644
View file @
5bcd626f
class
IssuesCsvMailerPreview
<
ActionMailer
::
Preview
def
issues_csv_export
user
=
OpenStruct
.
new
(
notification_email:
'a@example.com'
)
project
=
OpenStruct
.
new
(
name:
'Judolint'
)
Notify
.
issues_csv_email
(
user
,
project
,
"Dummy,Csv
\n
0,1"
)
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