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
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
= "Reassigned Issue ##{@issue.id}"
= link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue)
%p
- Assignee changed from
- %strong #{@previous_assignee.name}
+ Assignee changed
+ - if @previous_assignee
+ from
+ %strong #{@previous_assignee.name}
to
%strong #{@issue.assignee_name}
<%= 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 %>
= "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
- %strong #{@previous_assignee.name}
+ Assignee changed
+ - if @previous_assignee
+ from
+ %strong #{@previous_assignee.name}
to
%strong #{@merge_request.assignee_name}
<%= 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 %>