Skip to content

Commit

Permalink
Merge pull request #9182 from RocketChat/fix-use-emoji
Browse files Browse the repository at this point in the history
[FIX] "Use Emoji" preference not working
  • Loading branch information
rodrigok authored Dec 19, 2017
2 parents af61edc + f3049de commit 7864f4e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/rocketchat-emoji/client/emojiButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Template.messageBox.events({
'click .emoji-picker-icon'(event) {
event.stopPropagation();
event.preventDefault();

if (!RocketChat.getUserPreference(Meteor.user(), 'useEmojis')) {
return false;
}

if (RocketChat.EmojiPicker.isOpened()) {
RocketChat.EmojiPicker.close();
} else {
Expand Down
6 changes: 6 additions & 0 deletions packages/rocketchat-emoji/client/emojiPicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

font-size: 18px;

&--disabled {
cursor: default;

color: var(--message-box-container-border-color);
}

&::before {
transition: transform 0.2s ease;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui-message/client/messageBox.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{{#if allowedToSend}}
{{> messagePopupConfig getPopupConfig}}
<label class="rc-message-box__container">
<div class="rc-message-box__icon emoji-picker-icon">
<div class="rc-message-box__icon emoji-picker-icon {{#unless isEmojiEnable}}emoji-picker-icon--disabled{{/unless}}">
{{> icon block="rc-input__icon-svg" icon="emoji"}}
</div>
<textarea autofocus name="msg" maxlength="{{maxMessageLength}}" placeholder="{{_ 'Message'}}" rows="1" class="rc-message-box__textarea js-input-message autogrow-short"></textarea>
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-ui-message/client/messageBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ Template.messageBox.helpers({
},
embeddedVersion() {
return RocketChat.Layout.isEmbedded();
},
isEmojiEnable() {
return RocketChat.getUserPreference(Meteor.user(), 'useEmojis');
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ Template.messagePopupConfig.helpers({
getFilter(collection, filter) {
const key = `:${ filter }`;

if (!RocketChat.getUserPreference(Meteor.user(), 'useEmojis')) {
return [];
}

if (!RocketChat.emoji.packages.emojione || RocketChat.emoji.packages.emojione.asciiList[key]) {
return [];
}
Expand Down

0 comments on commit 7864f4e

Please sign in to comment.