Commit c508aec6 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Refactor epic notes target before_action

Overrides `#create_note_params` instead
parent a2266aae
# 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