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
ea6c5c1c
Commit
ea6c5c1c
authored
Sep 27, 2016
by
barthc
Committed by
Rémy Coutable
Oct 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix authored vote from notes
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
1a7ba2a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
CHANGELOG.md
CHANGELOG.md
+1
-0
app/services/notes/create_service.rb
app/services/notes/create_service.rb
+4
-2
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+13
-2
No files found.
CHANGELOG.md
View file @
ea6c5c1c
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
## 8.14.0 (2016-11-22)
## 8.14.0 (2016-11-22)
-
Adds user project membership expired event to clarify why user was removed (Callum Dryden)
-
Adds user project membership expired event to clarify why user was removed (Callum Dryden)
-
Trim leading and trailing whitespace on project_path (Linus Thiel)
-
Trim leading and trailing whitespace on project_path (Linus Thiel)
-
Prevent award emoji via notes for issues/MRs authored by user (barthc)
-
Fix HipChat notifications rendering (airatshigapov, eisnerd)
-
Fix HipChat notifications rendering (airatshigapov, eisnerd)
-
Add hover to trash icon in notes !7008 (blackst0ne)
-
Add hover to trash icon in notes !7008 (blackst0ne)
-
Simpler arguments passed to named_route on toggle_award_url helper method
-
Simpler arguments passed to named_route on toggle_award_url helper method
...
...
app/services/notes/create_service.rb
View file @
ea6c5c1c
...
@@ -7,8 +7,10 @@ module Notes
...
@@ -7,8 +7,10 @@ module Notes
if
note
.
award_emoji?
if
note
.
award_emoji?
noteable
=
note
.
noteable
noteable
=
note
.
noteable
todo_service
.
new_award_emoji
(
noteable
,
current_user
)
if
noteable
.
user_can_award?
(
current_user
,
note
.
award_emoji_name
)
return
noteable
.
create_award_emoji
(
note
.
award_emoji_name
,
current_user
)
todo_service
.
new_award_emoji
(
noteable
,
current_user
)
return
noteable
.
create_award_emoji
(
note
.
award_emoji_name
,
current_user
)
end
end
end
# We execute commands (extracted from `params[:note]`) on the noteable
# We execute commands (extracted from `params[:note]`) on the noteable
...
...
spec/requests/api/notes_spec.rb
View file @
ea6c5c1c
...
@@ -221,12 +221,23 @@ describe API::API, api: true do
...
@@ -221,12 +221,23 @@ describe API::API, api: true do
end
end
end
end
context
'when the user is posting an award emoji'
do
context
'when the user is posting an award emoji on an issue created by someone else'
do
let
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
it
'returns an award emoji'
do
it
'returns an award emoji'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue2
.
id
}
/notes"
,
user
),
body:
':+1:'
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'awardable_id'
]).
to
eq
issue2
.
id
end
end
context
'when the user is posting an award emoji on his/her own issue'
do
it
'creates a new issue note'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
),
body:
':+1:'
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
),
body:
':+1:'
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'
awardable_id'
]).
to
eq
issue
.
id
expect
(
json_response
[
'
body'
]).
to
eq
(
':+1:'
)
end
end
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