Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't add sets without emotes when searching #5582

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
- Bugfix: Fixed splits staying paused after unfocusing Chatterino in certain configurations. (#5504)
- Bugfix: Links with invalid characters in the domain are no longer detected. (#5509)
- Bugfix: Fixed janky selection for messages with RTL segments (selection is still wrong, but consistently wrong). (#5525)
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580)
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580, #5582)
- Bugfix: Fixed tab visibility being controllable in the emote popup. (#5530)
- Bugfix: Fixed account switch not being saved if no other settings were changed. (#5558)
- Bugfix: Fixed some tooltips not being readable. (#5578)
Expand Down
19 changes: 12 additions & 7 deletions src/widgets/dialogs/EmotePopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,13 @@ auto makeEmojiMessage(const std::vector<EmojiPtr> &emojiMap)
return builder.release();
}

void addEmotes(Channel &channel, auto emotes, const QString &title,
void addEmotes(Channel &channel, auto &&emotes, const QString &title,
const MessageElementFlag &emoteFlag)
{
channel.addMessage(makeTitleMessage(title), MessageContext::Original);
channel.addMessage(makeEmoteMessage(emotes, emoteFlag),
MessageContext::Original);
channel.addMessage(
makeEmoteMessage(std::forward<decltype(emotes)>(emotes), emoteFlag),
MessageContext::Original);
}

void addTwitchEmoteSets(const std::shared_ptr<const EmoteMap> &local,
Expand Down Expand Up @@ -175,7 +176,7 @@ void loadEmojis(Channel &channel, const std::vector<EmojiPtr> &emojiMap,

// Create an emote
EmoteMap filterEmoteMap(const QString &text,
std::shared_ptr<const EmoteMap> emotes)
const std::shared_ptr<const EmoteMap> &emotes)
{
EmoteMap filteredMap;

Expand Down Expand Up @@ -518,15 +519,19 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
if (!local.empty())
{
addEmotes(*searchChannel, local,
this->twitchChannel_->getName() % u" (local)",
this->twitchChannel_->getName() % u" (Follower)",
MessageElementFlag::TwitchEmote);
}

for (const auto &[_id, set] :
**getApp()->getAccounts()->twitch.getCurrent()->accessEmoteSets())
{
addEmotes(*searchChannel, filterEmoteVec(searchText, set.emotes),
set.title(), MessageElementFlag::TwitchEmote);
auto filtered = filterEmoteVec(searchText, set.emotes);
if (!filtered.empty())
{
addEmotes(*searchChannel, std::move(filtered), set.title(),
MessageElementFlag::TwitchEmote);
}
}
}

Expand Down
Loading