Notify user when award-emoji comment is invalid
This commit is contained in:
parent
bfce5d7168
commit
a527f5c27f
|
|
@ -111,6 +111,10 @@ class @Notes
|
|||
Note: for rendering inline notes use renderDiscussionNote
|
||||
###
|
||||
renderNote: (note) ->
|
||||
unless note.valid
|
||||
alert('You have already used this award emoji !') if note.award
|
||||
return
|
||||
|
||||
# render note if it not present in loaded list
|
||||
# or skip if rendered
|
||||
if @isNewNote(note) && !note.award
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ class Projects::NotesController < Projects::ApplicationController
|
|||
def render_note_json(note)
|
||||
if note.valid?
|
||||
render json: {
|
||||
valid: true,
|
||||
id: note.id,
|
||||
discussion_id: note.discussion_id,
|
||||
html: note_to_html(note),
|
||||
|
|
@ -143,7 +144,11 @@ class Projects::NotesController < Projects::ApplicationController
|
|||
discussion_with_diff_html: note_to_discussion_with_diff_html(note)
|
||||
}
|
||||
else
|
||||
render json: { invalid: true, errors: note.errors }
|
||||
render json: {
|
||||
valid: false,
|
||||
award: note.is_award,
|
||||
errors: note.errors
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue