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 ...@@ -8,7 +8,7 @@ module Emails
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id) def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
@issue = Issue.find(issue_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 @project = @issue.project
mail(to: recipient(recipient_id), subject: subject("changed issue ##{@issue.id}", @issue.title)) mail(to: recipient(recipient_id), subject: subject("changed issue ##{@issue.id}", @issue.title))
end end
......
...@@ -8,7 +8,7 @@ module Emails ...@@ -8,7 +8,7 @@ module Emails
def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id)
@merge_request = MergeRequest.find(merge_request_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 @project = @merge_request.project
mail(to: recipient(recipient_id), subject: subject("changed merge request !#{@merge_request.id}", @merge_request.title)) mail(to: recipient(recipient_id), subject: subject("changed merge request !#{@merge_request.id}", @merge_request.title))
end end
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
= "Reassigned Issue ##{@issue.id}" = "Reassigned Issue ##{@issue.id}"
= link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue) = link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue)
%p %p
Assignee changed from Assignee changed
- if @previous_assignee
from
%strong #{@previous_assignee.name} %strong #{@previous_assignee.name}
to to
%strong #{@issue.assignee_name} %strong #{@issue.assignee_name}
......
...@@ -2,6 +2,4 @@ Reassigned Issue <%= @issue.id %> ...@@ -2,6 +2,4 @@ Reassigned Issue <%= @issue.id %>
<%= url_for(project_issue_url(@issue.project, @issue)) %> <%= url_for(project_issue_url(@issue.project, @issue)) %>
Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee %> to <%= @issue.assignee_name %>
Assignee changed from <%= @previous_assignee.name %> to <%= @issue.assignee_name %>
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
= "Reassigned Merge Request !#{@merge_request.id}" = "Reassigned Merge Request !#{@merge_request.id}"
= link_to_gfm truncate(@merge_request.title, length: 30), project_merge_request_url(@merge_request.project, @merge_request) = link_to_gfm truncate(@merge_request.title, length: 30), project_merge_request_url(@merge_request.project, @merge_request)
%p %p
Assignee changed from Assignee changed
- if @previous_assignee
from
%strong #{@previous_assignee.name} %strong #{@previous_assignee.name}
to to
%strong #{@merge_request.assignee_name} %strong #{@merge_request.assignee_name}
...@@ -3,5 +3,5 @@ Reassigned Merge Request <%= @merge_request.id %> ...@@ -3,5 +3,5 @@ Reassigned Merge Request <%= @merge_request.id %>
<%= url_for(project_merge_request_url(@merge_request.project, @merge_request)) %> <%= 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