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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
a527f5c2
Commit
a527f5c2
authored
Dec 02, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notify user when award-emoji comment is invalid
parent
bfce5d71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
app/assets/javascripts/notes.js.coffee
app/assets/javascripts/notes.js.coffee
+4
-0
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+6
-1
No files found.
app/assets/javascripts/notes.js.coffee
View file @
a527f5c2
...
@@ -111,6 +111,10 @@ class @Notes
...
@@ -111,6 +111,10 @@ class @Notes
Note: for rendering inline notes use renderDiscussionNote
Note: for rendering inline notes use renderDiscussionNote
###
###
renderNote
:
(
note
)
->
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
# render note if it not present in loaded list
# or skip if rendered
# or skip if rendered
if
@
isNewNote
(
note
)
&&
!
note
.
award
if
@
isNewNote
(
note
)
&&
!
note
.
award
...
...
app/controllers/projects/notes_controller.rb
View file @
a527f5c2
...
@@ -133,6 +133,7 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -133,6 +133,7 @@ class Projects::NotesController < Projects::ApplicationController
def
render_note_json
(
note
)
def
render_note_json
(
note
)
if
note
.
valid?
if
note
.
valid?
render
json:
{
render
json:
{
valid:
true
,
id:
note
.
id
,
id:
note
.
id
,
discussion_id:
note
.
discussion_id
,
discussion_id:
note
.
discussion_id
,
html:
note_to_html
(
note
),
html:
note_to_html
(
note
),
...
@@ -143,7 +144,11 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -143,7 +144,11 @@ class Projects::NotesController < Projects::ApplicationController
discussion_with_diff_html:
note_to_discussion_with_diff_html
(
note
)
discussion_with_diff_html:
note_to_discussion_with_diff_html
(
note
)
}
}
else
else
render
json:
{
invalid:
true
,
errors:
note
.
errors
}
render
json:
{
valid:
false
,
award:
note
.
is_award
,
errors:
note
.
errors
}
end
end
end
end
...
...
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