Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bfce5d71
Commit
bfce5d71
authored
Dec 02, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render json message with errors if note didn't pass validation
parent
c92b6e66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+14
-10
No files found.
app/controllers/projects/notes_controller.rb
View file @
bfce5d71
...
...
@@ -131,16 +131,20 @@ class Projects::NotesController < Projects::ApplicationController
end
def
render_note_json
(
note
)
render
json:
{
id:
note
.
id
,
discussion_id:
note
.
discussion_id
,
html:
note_to_html
(
note
),
award:
note
.
is_award
,
emoji_path:
note
.
is_award
?
view_context
.
image_url
(
::
AwardEmoji
.
path_to_emoji_image
(
note
.
note
))
:
""
,
note:
note
.
note
,
discussion_html:
note_to_discussion_html
(
note
),
discussion_with_diff_html:
note_to_discussion_with_diff_html
(
note
)
}
if
note
.
valid?
render
json:
{
id:
note
.
id
,
discussion_id:
note
.
discussion_id
,
html:
note_to_html
(
note
),
award:
note
.
is_award
,
emoji_path:
note
.
is_award
?
view_context
.
image_url
(
::
AwardEmoji
.
path_to_emoji_image
(
note
.
note
))
:
""
,
note:
note
.
note
,
discussion_html:
note_to_discussion_html
(
note
),
discussion_with_diff_html:
note_to_discussion_with_diff_html
(
note
)
}
else
render
json:
{
invalid:
true
,
errors:
note
.
errors
}
end
end
def
authorize_admin_note!
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment