Commit f49fb5dc authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix error when reassign issue/merge_request from non-assigned. Fixes #3201

parent ef9298fe
......@@ -8,7 +8,7 @@ module Emails
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
@issue = Issue.find(issue_id)
@previous_assignee ||= User.find(previous_assignee_id)
@previous_assignee = User.find_by_id(previous_assignee_id) if previous_assignee_id
@project = @issue.project
mail(to: recipient(recipient_id), subject: subject("changed issue ##{@issue.id}", @issue.title))
end
......
......@@ -8,7 +8,7 @@ module Emails
def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id)
@merge_request = MergeRequest.find(merge_request_id)
@previous_assignee ||= User.find(previous_assignee_id)
@previous_assignee = User.find_by_id(previous_assignee_id) if previous_assignee_id
@project = @merge_request.project
mail(to: recipient(recipient_id), subject: subject("changed merge request !#{@merge_request.id}", @merge_request.title))
end
......
......@@ -2,7 +2,9 @@
= "Reassigned Issue ##{@issue.id}"
= link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue)
%p
Assignee changed from
Assignee changed
- if @previous_assignee
from
%strong #{@previous_assignee.name}
to
%strong #{@issue.assignee_name}
......
......@@ -2,6 +2,4 @@ Reassigned Issue <%= @issue.id %>
<%= url_for(project_issue_url(@issue.project, @issue)) %>
Assignee changed from <%= @previous_assignee.name %> to <%= @issue.assignee_name %>
Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee %> to <%= @issue.assignee_name %>
......@@ -2,7 +2,9 @@
= "Reassigned Merge Request !#{@merge_request.id}"
= link_to_gfm truncate(@merge_request.title, length: 30), project_merge_request_url(@merge_request.project, @merge_request)
%p
Assignee changed from
Assignee changed
- if @previous_assignee
from
%strong #{@previous_assignee.name}
to
%strong #{@merge_request.assignee_name}
......@@ -3,5 +3,5 @@ Reassigned Merge Request <%= @merge_request.id %>
<%= url_for(project_merge_request_url(@merge_request.project, @merge_request)) %>
Assignee changed from <%= @previous_assignee.name %> to <%= @merge_request.assignee_name %>
Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee %> to <%= @merge_request.assignee_name %>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment