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
Hide 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
note
.
author
=
current_user
note
.
system
=
false
if
contains_emoji_only?
(
params
[
:note
])
if
award_emoji_note?
note
.
is_award
=
true
note
.
note
=
emoji_name
(
params
[
:note
])
note
.
note
=
emoji_name
end
if
note
.
save
...
...
@@ -34,12 +34,23 @@ module Notes
note
.
project
.
execute_services
(
note_data
,
:note_hooks
)
end
def
contains_emoji_only?
(
note
)
note
=~
/\A:[-_+[:alnum:]]*:\s?\z/
private
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
def
emoji_name
(
note
)
note
.
match
(
/\A:([-_+[:alnum:]]*):\s?/
)[
1
]
def
emoji_name
params
[
:note
]
.
match
(
/\A:([-_+[:alnum:]]*):\s?/
)[
1
]
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