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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
6ae2680c
Commit
6ae2680c
authored
Apr 14, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Emoji categories fix
parent
dd9ced0a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
CHANGELOG
CHANGELOG
+1
-0
lib/award_emoji.rb
lib/award_emoji.rb
+13
-3
spec/lib/award_emoji_spec.rb
spec/lib/award_emoji_spec.rb
+7
-0
No files found.
CHANGELOG
View file @
6ae2680c
...
@@ -66,6 +66,7 @@ v 8.7.0 (unreleased)
...
@@ -66,6 +66,7 @@ v 8.7.0 (unreleased)
- Improved markdown forms
- Improved markdown forms
- Diffs load at the correct point when linking from from number
- Diffs load at the correct point when linking from from number
- Selected diff rows highlight
- Selected diff rows highlight
- Fix emoji catgories in the emoji picker
v 8.6.6
v 8.6.6
- Fix error on language detection when repository has no HEAD (e.g., master branch). !3654 (Jeroen Bobbeldijk)
- Fix error on language detection when repository has no HEAD (e.g., master branch). !3654 (Jeroen Bobbeldijk)
...
...
lib/award_emoji.rb
View file @
6ae2680c
...
@@ -14,19 +14,29 @@ class AwardEmoji
...
@@ -14,19 +14,29 @@ class AwardEmoji
food_drink:
"Food"
food_drink:
"Food"
}.
with_indifferent_access
}.
with_indifferent_access
CATEGORY_ALIASES
=
{
symbols:
"objects_symbols"
,
foods:
"food_drink"
,
travel:
"travel_places"
}.
with_indifferent_access
def
self
.
normilize_emoji_name
(
name
)
def
self
.
normilize_emoji_name
(
name
)
aliases
[
name
]
||
name
aliases
[
name
]
||
name
end
end
def
self
.
emoji_by_category
def
self
.
emoji_by_category
unless
@emoji_by_category
unless
@emoji_by_category
@emoji_by_category
=
{
}
@emoji_by_category
=
Hash
.
new
{
|
h
,
key
|
h
[
key
]
=
[]
}
emojis
.
each
do
|
emoji_name
,
data
|
emojis
.
each
do
|
emoji_name
,
data
|
data
[
"name"
]
=
emoji_name
data
[
"name"
]
=
emoji_name
@emoji_by_category
[
data
[
"category"
]]
||=
[]
# Skip Fitzpatrick(tone) modifiers
@emoji_by_category
[
data
[
"category"
]]
<<
data
next
if
data
[
"category"
]
==
"modifier"
category
=
CATEGORY_ALIASES
[
data
[
"category"
]]
||
data
[
"category"
]
@emoji_by_category
[
category
]
<<
data
end
end
@emoji_by_category
=
@emoji_by_category
.
sort
.
to_h
@emoji_by_category
=
@emoji_by_category
.
sort
.
to_h
...
...
spec/lib/award_emoji_spec.rb
View file @
6ae2680c
...
@@ -16,4 +16,11 @@ describe AwardEmoji do
...
@@ -16,4 +16,11 @@ describe AwardEmoji do
end
end
end
end
end
end
describe
'.emoji_by_category'
do
it
"only contains known categories"
do
undefined_categories
=
AwardEmoji
.
emoji_by_category
.
keys
-
AwardEmoji
::
CATEGORIES
.
keys
expect
(
undefined_categories
).
to
be_empty
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