diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /app/controllers/concerns/notes_actions.rb | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'app/controllers/concerns/notes_actions.rb')
-rw-r--r-- | app/controllers/concerns/notes_actions.rb | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/app/controllers/concerns/notes_actions.rb b/app/controllers/concerns/notes_actions.rb index b595c3c6790..a41e2d840ac 100644 --- a/app/controllers/concerns/notes_actions.rb +++ b/app/controllers/concerns/notes_actions.rb @@ -89,9 +89,7 @@ module NotesActions # rubocop:enable Gitlab/ModuleWithInstanceVariables def destroy - if note.editable? - Notes::DestroyService.new(project, current_user).execute(note) - end + Notes::DestroyService.new(project, current_user).execute(note) if note.editable? respond_to do |format| format.js { head :ok } @@ -258,15 +256,14 @@ module NotesActions end def last_fetched_at - strong_memoize(:last_fetched_at) do - microseconds = request.headers['X-Last-Fetched-At'].to_i + microseconds = request.headers['X-Last-Fetched-At'].to_i - seconds = microseconds / MICROSECOND - frac = microseconds % MICROSECOND + seconds = microseconds / MICROSECOND + frac = microseconds % MICROSECOND - Time.zone.at(seconds, frac) - end + Time.zone.at(seconds, frac) end + strong_memoize_attr :last_fetched_at def notes_filter current_user&.notes_filter_for(params[:target_type]) @@ -285,23 +282,22 @@ module NotesActions end def note_project - strong_memoize(:note_project) do - next nil unless project + return unless project - note_project_id = params[:note_project_id] + note_project_id = params[:note_project_id] - the_project = - if note_project_id.present? - Project.find(note_project_id) - else - project - end + the_project = + if note_project_id.present? + Project.find(note_project_id) + else + project + end - next access_denied! unless can?(current_user, :create_note, the_project) + return access_denied! unless can?(current_user, :create_note, the_project) - the_project - end + the_project end + strong_memoize_attr :note_project def return_discussion? Gitlab::Utils.to_boolean(params[:return_discussion]) |