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
Jérome Perrin
gitlab-ce
Commits
bfbfa3b5
Commit
bfbfa3b5
authored
Nov 16, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplication in issue emails
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
9573e06e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
36 deletions
+30
-36
app/mailers/emails/issues.rb
app/mailers/emails/issues.rb
+30
-36
No files found.
app/mailers/emails/issues.rb
View file @
bfbfa3b5
module
Emails
module
Issues
def
new_issue_email
(
recipient_id
,
issue_id
)
@issue
=
Issue
.
find
(
issue_id
)
@project
=
@issue
.
project
@target_url
=
namespace_project_issue_url
(
@project
.
namespace
,
@project
,
@issue
)
mail_new_thread
(
@issue
,
from:
sender
(
@issue
.
author_id
),
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
))
SentNotification
.
record
(
@issue
,
recipient_id
,
reply_key
)
mail_with_notification
(
issue_id
,
recipient_id
)
do
mail_new_thread
(
@issue
,
thread_options
(
@issue
.
author_id
,
recipient_id
))
end
end
def
reassigned_issue_email
(
recipient_id
,
issue_id
,
previous_assignee_id
,
updated_by_user_id
)
@issue
=
Issue
.
find
(
issue_id
)
mail_with_notification
(
issue_id
,
recipient_id
)
do
@previous_assignee
=
User
.
find_by
(
id:
previous_assignee_id
)
if
previous_assignee_id
@project
=
@issue
.
project
@target_url
=
namespace_project_issue_url
(
@project
.
namespace
,
@project
,
@issue
)
mail_answer_thread
(
@issue
,
from:
sender
(
updated_by_user_id
),
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
))
SentNotification
.
record
(
@issue
,
recipient_id
,
reply_key
)
mail_answer_thread
(
@issue
,
thread_options
(
updated_by_user_id
,
recipient_id
))
end
end
def
closed_issue_email
(
recipient_id
,
issue_id
,
updated_by_user_id
)
@issue
=
Issue
.
find
issue_id
@project
=
@issue
.
project
mail_with_notification
(
issue_id
,
recipient_id
)
do
@updated_by
=
User
.
find
updated_by_user_id
@target_url
=
namespace_project_issue_url
(
@project
.
namespace
,
@project
,
@issue
)
mail_answer_thread
(
@issue
,
from:
sender
(
updated_by_user_id
),
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
))
SentNotification
.
record
(
@issue
,
recipient_id
,
reply_key
)
mail_answer_thread
(
@issue
,
thread_options
(
updated_by_user_id
,
recipient_id
))
end
end
def
issue_status_changed_email
(
recipient_id
,
issue_id
,
status
,
updated_by_user_id
)
@issue
=
Issue
.
find
issue_id
mail_with_notification
(
issue_id
,
recipient_id
)
do
@issue_status
=
status
@project
=
@issue
.
project
@updated_by
=
User
.
find
updated_by_user_id
@target_url
=
namespace_project_issue_url
(
@project
.
namespace
,
@project
,
@issue
)
mail_answer_thread
(
@issue
,
from:
sender
(
updated_by_user_id
),
mail_answer_thread
(
@issue
,
thread_options
(
updated_by_user_id
,
recipient_id
))
end
end
def
thread_options
(
sender_id
,
recipient_id
)
{
from:
sender
(
sender_id
),
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
))
subject:
subject
(
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
)
}
end
def
mail_with_notification
(
issue_id
,
recipient_id
)
@issue
=
Issue
.
find
(
issue_id
)
@project
=
@issue
.
project
@target_url
=
namespace_project_issue_url
(
@project
.
namespace
,
@project
,
@issue
)
yield
SentNotification
.
record
(
@issue
,
recipient_id
,
reply_key
)
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