Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
8f4eaf1b
Commit
8f4eaf1b
authored
8 years ago
by
Diego Sampaio
Browse files
Options
Downloads
Patches
Plain Diff
Update custom emojis in real time
Closes #4391
parent
46f78980
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/rocketchat-emoji-custom/client/lib/emojiCustom.js
+18
-0
18 additions, 0 deletions
packages/rocketchat-emoji-custom/client/lib/emojiCustom.js
with
18 additions
and
0 deletions
packages/rocketchat-emoji-custom/client/lib/emojiCustom.js
+
18
−
0
View file @
8f4eaf1b
...
...
@@ -65,9 +65,17 @@ deleteEmojiCustom = function(emojiData) {
if
(
arrayIndex
!==
-
1
)
{
RocketChat
.
emoji
.
packages
.
emojiCustom
.
emojisByCategory
.
rocket
.
splice
(
arrayIndex
,
1
);
}
let
arrayIndexList
=
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
indexOf
(
`:
${
emojiData
.
name
}
:`
);
if
(
arrayIndexList
!==
-
1
)
{
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
splice
(
arrayIndexList
,
1
);
}
if
(
isSetNotNull
(()
=>
emojiData
.
aliases
))
{
for
(
let
alias
of
emojiData
.
aliases
)
{
delete
RocketChat
.
emoji
.
list
[
`:
${
alias
}
:`
];
let
aliasIndex
=
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
indexOf
(
`:
${
alias
}
:`
);
if
(
aliasIndex
!==
-
1
)
{
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
splice
(
aliasIndex
,
1
);
}
}
}
updateEmojiPickerList
();
...
...
@@ -83,6 +91,10 @@ updateEmojiCustom = function(emojiData) {
if
(
previousExists
&&
isSetNotNull
(()
=>
RocketChat
.
emoji
.
list
[
`:
${
emojiData
.
previousName
}
:`
].
aliases
))
{
for
(
let
alias
of
RocketChat
.
emoji
.
list
[
`:
${
emojiData
.
previousName
}
:`
].
aliases
)
{
delete
RocketChat
.
emoji
.
list
[
`:
${
alias
}
:`
];
let
aliasIndex
=
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
indexOf
(
`:
${
alias
}
:`
);
if
(
aliasIndex
!==
-
1
)
{
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
splice
(
aliasIndex
,
1
);
}
}
}
...
...
@@ -91,16 +103,22 @@ updateEmojiCustom = function(emojiData) {
if
(
arrayIndex
!==
-
1
)
{
RocketChat
.
emoji
.
packages
.
emojiCustom
.
emojisByCategory
.
rocket
.
splice
(
arrayIndex
,
1
);
}
let
arrayIndexList
=
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
indexOf
(
`:
${
emojiData
.
previousName
}
:`
);
if
(
arrayIndexList
!==
-
1
)
{
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
splice
(
arrayIndexList
,
1
);
}
delete
RocketChat
.
emoji
.
list
[
`:
${
emojiData
.
previousName
}
:`
];
}
let
categoryIndex
=
RocketChat
.
emoji
.
packages
.
emojiCustom
.
emojisByCategory
.
rocket
.
indexOf
(
`
${
emojiData
.
name
}
`
);
if
(
categoryIndex
===
-
1
)
{
RocketChat
.
emoji
.
packages
.
emojiCustom
.
emojisByCategory
.
rocket
.
push
(
`
${
emojiData
.
name
}
`
);
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
push
(
`:
${
emojiData
.
name
}
:`
);
}
RocketChat
.
emoji
.
list
[
`:
${
emojiData
.
name
}
:`
]
=
Object
.
assign
({
emojiPackage
:
'
emojiCustom
'
},
RocketChat
.
emoji
.
list
[
`:
${
emojiData
.
name
}
:`
],
emojiData
);
if
(
currentAliases
)
{
for
(
let
alias
of
emojiData
.
aliases
)
{
RocketChat
.
emoji
.
packages
.
emojiCustom
.
list
.
push
(
`:
${
alias
}
:`
);
RocketChat
.
emoji
.
list
[
`:
${
alias
}
:`
]
=
{};
RocketChat
.
emoji
.
list
[
`:
${
alias
}
:`
].
emojiPackage
=
'
emojiCustom
'
;
RocketChat
.
emoji
.
list
[
`:
${
alias
}
:`
].
aliasOf
=
emojiData
.
name
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment