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
iv
gitlab-ce
Commits
22d87b74
Commit
22d87b74
authored
Dec 01, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support award-emoji notes only when it a comment for an issue
parent
9cf67f72
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
app/services/notes/create_service.rb
app/services/notes/create_service.rb
+17
-6
No files found.
app/services/notes/create_service.rb
View file @
22d87b74
...
@@ -5,9 +5,9 @@ module Notes
...
@@ -5,9 +5,9 @@ module Notes
note
.
author
=
current_user
note
.
author
=
current_user
note
.
system
=
false
note
.
system
=
false
if
contains_emoji_only?
(
params
[
:note
])
if
award_emoji_note?
note
.
is_award
=
true
note
.
is_award
=
true
note
.
note
=
emoji_name
(
params
[
:note
])
note
.
note
=
emoji_name
end
end
if
note
.
save
if
note
.
save
...
@@ -34,12 +34,23 @@ module Notes
...
@@ -34,12 +34,23 @@ module Notes
note
.
project
.
execute_services
(
note_data
,
:note_hooks
)
note
.
project
.
execute_services
(
note_data
,
:note_hooks
)
end
end
def
contains_emoji_only?
(
note
)
private
note
=~
/\A:[-_+[:alnum:]]*:\s?\z/
def
award_emoji_note?
# We support award-emojis only in issue discussion
issue_comment?
&&
contains_emoji_only?
end
def
contains_emoji_only?
params
[
:note
]
=~
/\A:[-_+[:alnum:]]*:\s?\z/
end
def
issue_comment?
params
[
:noteable_type
]
==
'Issue'
end
end
def
emoji_name
(
note
)
def
emoji_name
note
.
match
(
/\A:([-_+[:alnum:]]*):\s?/
)[
1
]
params
[
:note
]
.
match
(
/\A:([-_+[:alnum:]]*):\s?/
)[
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