Ports new refactor from EE to CE
This commit is contained in:
parent
81d949f656
commit
487ac98a2a
5 changed files with 17 additions and 5 deletions
|
@ -103,6 +103,9 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
|
|||
@source_project = @merge_request.source_project
|
||||
@commits = set_commits_for_rendering(@merge_request.commits)
|
||||
@commit = @merge_request.diff_head_commit
|
||||
|
||||
# FIXME: We have to assign a presenter to another instance variable
|
||||
# due to class_name checks being made with issuable classes
|
||||
@mr_presenter = @merge_request.present(current_user: current_user)
|
||||
|
||||
@labels = LabelsFinder.new(current_user, project_id: @project.id).execute
|
||||
|
|
|
@ -331,6 +331,9 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
|
|||
@target_project = @merge_request.target_project
|
||||
@target_branches = @merge_request.target_project.repository.branch_names
|
||||
@noteable = @merge_request
|
||||
|
||||
# FIXME: We have to assign a presenter to another instance variable
|
||||
# due to class_name checks being made with issuable classes
|
||||
@mr_presenter = @merge_request.present(current_user: current_user)
|
||||
end
|
||||
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
module Emails
|
||||
module MergeRequests
|
||||
def new_merge_request_email(recipient_id, merge_request_id, reason = nil)
|
||||
setup_merge_request_mail(merge_request_id, recipient_id)
|
||||
setup_merge_request_mail(merge_request_id, recipient_id, present: true)
|
||||
|
||||
mail_new_thread(@merge_request, merge_request_thread_options(@merge_request.author_id, recipient_id, reason))
|
||||
end
|
||||
|
||||
def new_mention_in_merge_request_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)
|
||||
setup_merge_request_mail(merge_request_id, recipient_id)
|
||||
setup_merge_request_mail(merge_request_id, recipient_id, present: true)
|
||||
|
||||
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
|
||||
end
|
||||
|
||||
|
@ -75,11 +76,16 @@ module Emails
|
|||
|
||||
private
|
||||
|
||||
def setup_merge_request_mail(merge_request_id, recipient_id)
|
||||
def setup_merge_request_mail(merge_request_id, recipient_id, present: false)
|
||||
@merge_request = MergeRequest.find(merge_request_id)
|
||||
@project = @merge_request.project
|
||||
@target_url = project_merge_request_url(@project, @merge_request)
|
||||
|
||||
if present
|
||||
recipient = User.find(recipient_id)
|
||||
@mr_presenter = @merge_request.present(current_user: recipient)
|
||||
end
|
||||
|
||||
@sent_notification = SentNotification.record(@merge_request, recipient_id, reply_key)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
%p
|
||||
Assignee: #{@merge_request.assignee_name}
|
||||
|
||||
= render_if_exists 'notify/merge_request_approvers', merge_request: @merge_request
|
||||
= render_if_exists 'notify/merge_request_approvers', presenter: @mr_presenter
|
||||
|
||||
- if @merge_request.description
|
||||
%div
|
||||
|
|
|
@ -5,6 +5,6 @@ New Merge Request <%= @merge_request.to_reference %>
|
|||
<%= merge_path_description(@merge_request, 'to') %>
|
||||
Author: <%= @merge_request.author_name %>
|
||||
Assignee: <%= @merge_request.assignee_name %>
|
||||
<%= render_if_exists 'notify/merge_request_approvers', merge_request: @merge_request %>
|
||||
<%= render_if_exists 'notify/merge_request_approvers', presenter: @mr_presenter %>
|
||||
|
||||
<%= @merge_request.description %>
|
||||
|
|
Loading…
Reference in a new issue