Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/notes/components/issue_comment_form.vue2
-rw-r--r--app/assets/javascripts/notes/components/issue_discussion.vue2
-rw-r--r--app/assets/javascripts/notes/components/issue_note.vue2
-rw-r--r--app/controllers/concerns/notes_actions.rb6
-rw-r--r--app/helpers/notes_helper.rb8
-rw-r--r--app/views/projects/issues/_discussion.html.haml2
-rw-r--r--spec/helpers/notes_helper_spec.rb8
-rw-r--r--spec/javascripts/notes/mock_data.js4
8 files changed, 23 insertions, 11 deletions
diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue
index 45043818055..390be5c26af 100644
--- a/app/assets/javascripts/notes/components/issue_comment_form.vue
+++ b/app/assets/javascripts/notes/components/issue_comment_form.vue
@@ -105,7 +105,7 @@
endpoint: this.endpoint,
flashContainer: this.$el,
data: {
- full_data: true,
+ view: 'full_data',
note: {
noteable_type: 'Issue',
noteable_id: this.getIssueData.id,
diff --git a/app/assets/javascripts/notes/components/issue_discussion.vue b/app/assets/javascripts/notes/components/issue_discussion.vue
index 91f3e5391dd..d6dd0be55ac 100644
--- a/app/assets/javascripts/notes/components/issue_discussion.vue
+++ b/app/assets/javascripts/notes/components/issue_discussion.vue
@@ -100,7 +100,7 @@
target_type: 'issue',
target_id: this.discussion.noteable_id,
note: { note: noteText },
- full_data: true,
+ view: 'full_data',
},
};
diff --git a/app/assets/javascripts/notes/components/issue_note.vue b/app/assets/javascripts/notes/components/issue_note.vue
index d93b415654d..63df996a0e0 100644
--- a/app/assets/javascripts/notes/components/issue_note.vue
+++ b/app/assets/javascripts/notes/components/issue_note.vue
@@ -78,7 +78,7 @@
const data = {
endpoint: this.note.path,
note: {
- full_data: true,
+ view: 'full_data',
target_type: 'issue',
target_id: this.note.noteable_id,
note: { note: noteText },
diff --git a/app/controllers/concerns/notes_actions.rb b/app/controllers/concerns/notes_actions.rb
index 1d0587aad3a..1809464f4f4 100644
--- a/app/controllers/concerns/notes_actions.rb
+++ b/app/controllers/concerns/notes_actions.rb
@@ -18,7 +18,8 @@ module NotesActions
@notes = prepare_notes_for_rendering(@notes)
notes_json[:notes] =
- if params[:full_data]
+ case params[:view]
+ when 'full_data'
note_serializer.represent(@notes)
else
@notes.map { |note| note_json(note) }
@@ -87,7 +88,8 @@ module NotesActions
if note.persisted?
attrs[:valid] = true
- if params[:full_data]
+ case params[:view]
+ when 'full_data'
attrs.merge!(note_serializer.represent(note))
else
attrs.merge!(
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index e857e837c16..ea20f4b8d87 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -93,11 +93,13 @@ module NotesHelper
end
end
- def notes_url
+ def notes_url(extra_params = {})
if @snippet.is_a?(PersonalSnippet)
- snippet_notes_path(@snippet)
+ snippet_notes_path(@snippet, extra_params)
else
- project_noteable_notes_path(@project, target_id: @noteable.id, target_type: @noteable.class.name.underscore)
+ params = { target_id: @noteable.id, target_type: @noteable.class.name.underscore }
+
+ project_noteable_notes_path(@project, params.merge(extra_params))
end
end
diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml
index 8e17895c1c7..538bb50d3c9 100644
--- a/app/views/projects/issues/_discussion.html.haml
+++ b/app/views/projects/issues/_discussion.html.haml
@@ -9,7 +9,7 @@
new_session_path: new_session_path(:user, redirect_to_referer: 'yes'),
markdown_docs: help_page_path('user/markdown'),
quick_actions_docs: help_page_path('user/project/quick_actions'),
- notes_path: "#{notes_url}?full_data=1",
+ notes_path: notes_url(view: 'full_data'),
last_fetched_at: Time.now.to_i,
issue_data: serialize_issuable(@issue),
current_user_data: UserSerializer.new.represent(current_user).to_json }}
diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb
index 9921ca1af33..41474c32755 100644
--- a/spec/helpers/notes_helper_spec.rb
+++ b/spec/helpers/notes_helper_spec.rb
@@ -205,6 +205,14 @@ describe NotesHelper do
expect(helper.notes_url).to eq("/nm/test/noteable/issue/#{@noteable.id}/notes")
end
+
+ it 'adds extra params' do
+ namespace = create(:namespace, path: 'nm')
+ @project = create(:project, path: 'test', namespace: namespace)
+ @noteable = create(:issue, project: @project)
+
+ expect(helper.notes_url(view: 'full_data')).to eq("/nm/test/noteable/issue/#{@noteable.id}/notes?view=full_data")
+ end
end
describe '#note_url' do
diff --git a/spec/javascripts/notes/mock_data.js b/spec/javascripts/notes/mock_data.js
index ce969f0f460..000ea84cb9d 100644
--- a/spec/javascripts/notes/mock_data.js
+++ b/spec/javascripts/notes/mock_data.js
@@ -5,7 +5,7 @@ export const notesDataMock = {
lastFetchedAt: '1501862675',
markdownDocs: '/help/user/markdown',
newSessionPath: '/users/sign_in?redirect_to_referer=yes',
- notesPath: '/gitlab-org/gitlab-ce/noteable/issue/98/notes?full_data=1',
+ notesPath: '/gitlab-org/gitlab-ce/noteable/issue/98/notes?view=full_data',
quickActionsDocs: '/help/user/project/quick_actions',
registerPath: '/users/sign_in?redirect_to_referer=yes#register-pane',
};
@@ -314,4 +314,4 @@ export const discussionResponse = [{
"path": "/gitlab-org/gitlab-ce/notes/1391"
}],
"individual_note": true
-}]; \ No newline at end of file
+}];