Commit 046fcf59 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch '9949-refactor-epic-notes-controller' into 'master'

Refactor note target override for Epics

Closes #9949

See merge request gitlab-org/gitlab-ee!9686
parents e2a2acd8 c508aec6
# frozen_string_literal: true # frozen_string_literal: true
class Groups::Epics::NotesController < Groups::ApplicationController class Groups::Epics::NotesController < Groups::ApplicationController
extend ::Gitlab::Utils::Override
include NotesActions include NotesActions
include NotesHelper include NotesHelper
include ToggleAwardEmoji include ToggleAwardEmoji
before_action :set_target_params, only: [:create]
before_action :epic before_action :epic
before_action :authorize_create_note!, only: [:create] before_action :authorize_create_note!, only: [:create]
...@@ -44,8 +44,11 @@ class Groups::Epics::NotesController < Groups::ApplicationController ...@@ -44,8 +44,11 @@ class Groups::Epics::NotesController < Groups::ApplicationController
EpicNoteSerializer.new(project: nil, noteable: noteable, current_user: current_user) EpicNoteSerializer.new(project: nil, noteable: noteable, current_user: current_user)
end end
def set_target_params override :create_note_params
def create_note_params
params[:target_type] = 'Epic' params[:target_type] = 'Epic'
params[:target_id] = epic.id params[:target_id] = epic.id
super
end end
end end
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