summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/notes_actions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/concerns/notes_actions.rb')
-rw-r--r--app/controllers/concerns/notes_actions.rb36
1 files changed, 17 insertions, 19 deletions
diff --git a/app/controllers/concerns/notes_actions.rb b/app/controllers/concerns/notes_actions.rb
index b4fee93713b..337c8c809e7 100644
--- a/app/controllers/concerns/notes_actions.rb
+++ b/app/controllers/concerns/notes_actions.rb
@@ -15,11 +15,11 @@ module NotesActions
def index
current_fetched_at = Time.now.to_i
- notes_json = { notes: [], last_fetched_at: current_fetched_at }
+ notes_json = {notes: [], last_fetched_at: current_fetched_at}
notes = notes_finder
- .execute
- .inc_relations_for_view
+ .execute
+ .inc_relations_for_view
if notes_filter != UserPreference::NOTES_FILTERS[:only_comments]
notes =
@@ -48,7 +48,7 @@ module NotesActions
respond_to do |format|
format.json do
json = {
- commands_changes: @note.commands_changes
+ commands_changes: @note.commands_changes,
}
if @note.persisted? && return_discussion?
@@ -99,7 +99,7 @@ module NotesActions
"shared/notes/_note",
layout: false,
formats: [:html],
- locals: { note: note }
+ locals: {note: note}
)
end
@@ -138,10 +138,8 @@ module NotesActions
end
end
else
- attrs.merge!(
- valid: false,
- errors: note.errors
- )
+ attrs[:valid] = false
+ attrs[:errors] = note.errors
end
attrs
@@ -152,19 +150,19 @@ module NotesActions
on_image = discussion.on_image?
- if params[:view] == 'parallel' && !on_image
+ if params[:view] == "parallel" && !on_image
template = "discussions/_parallel_diff_discussion"
locals =
- if params[:line_type] == 'old'
- { discussions_left: [discussion], discussions_right: nil }
+ if params[:line_type] == "old"
+ {discussions_left: [discussion], discussions_right: nil}
else
- { discussions_left: nil, discussions_right: [discussion] }
+ {discussions_left: nil, discussions_right: [discussion]}
end
else
template = "discussions/_diff_discussion"
@fresh_discussion = true # rubocop:disable Gitlab/ModuleWithInstanceVariables
- locals = { discussions: [discussion], on_image: on_image }
+ locals = {discussions: [discussion], on_image: on_image}
end
render_to_string(
@@ -182,7 +180,7 @@ module NotesActions
"discussions/_discussion",
layout: false,
formats: [:html],
- locals: { discussion: discussion }
+ locals: {discussion: discussion}
)
end
@@ -206,9 +204,9 @@ module NotesActions
create_params[:noteable_type] = params[:target_type].classify
case params[:target_type]
- when 'commit'
+ when "commit"
create_params[:commit_id] = params[:target_id]
- when 'merge_request'
+ when "merge_request"
create_params[:noteable_id] = params[:target_id]
# Notes on MergeRequest can have an extra `commit_id` context
create_params[:commit_id] = params.dig(:note, :commit_id)
@@ -235,7 +233,7 @@ module NotesActions
end
def last_fetched_at
- request.headers['X-Last-Fetched-At']
+ request.headers["X-Last-Fetched-At"]
end
def notes_filter
@@ -278,7 +276,7 @@ module NotesActions
end
def use_note_serializer?
- return false if params['html']
+ return false if params["html"]
noteable.discussions_rendered_on_frontend?
end