Add an EmojiMap which is like an EmoteMap except it contains data for Emojis

Fix emote popup not inserting the correct emoji value on click. It no
inserts the shortcode (i.e. 👌)

Fix #299
This commit is contained in:
Rasmus Karlsson
2018-04-01 16:16:54 +02:00
parent 56f0e5e76a
commit 3dae83e749
4 changed files with 25 additions and 24 deletions
+4 -4
View File
@@ -89,7 +89,7 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
void EmotePopup::loadEmojis()
{
util::EmoteMap &emojis = singletons::EmoteManager::getInstance().getEmojis();
auto &emojis = singletons::EmoteManager::getInstance().getEmojis();
ChannelPtr emojiChannel(new Channel(""));
@@ -105,9 +105,9 @@ void EmotePopup::loadEmojis()
builder.getMessage()->flags &= Message::Centered;
builder.getMessage()->flags &= Message::DisableCompactEmotes;
emojis.each([this, &builder](const QString &key, const util::EmoteData &value) {
builder.append((new EmoteElement(value, MessageElement::Flags::AlwaysShow))
->setLink(Link(Link::Type::InsertText, key)));
emojis.each([this, &builder](const QString &key, const auto &value) {
builder.append((new EmoteElement(value.emoteData, MessageElement::Flags::AlwaysShow))
->setLink(Link(Link::Type::InsertText, ":" + value.shortCode + ":")));
});
emojiChannel->addMessage(builder.getMessage());