mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Added system message if no bttv emotes found instead of "unknown error" (#2542)
Co-authored-by: Paweł <zneix@zneix.eu> Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
a893cdaebe
commit
6ef515a0e2
|
@ -81,6 +81,7 @@
|
|||
- Bugfix: Fixed hidden tooltips when always on top is active (#2384)
|
||||
- Bugfix: Fix CLI arguments (`--help`, `--version`, `--channels`) not being respected (#2368, #2190)
|
||||
- Bugfix: Fix Twitch cheer emotes not displaying tooltips when hovered (#2434, #2503)
|
||||
- Bugfix: Fix BTTV/FFZ channel emotes saying unknown error when no emotes found (#2542)
|
||||
- Bugfix: Fix directory not opening when clicking "Open AppData Directory" setting button on macOS (#2531, #2537)
|
||||
- Dev: Updated minimum required Qt framework version to 5.12. (#2210)
|
||||
- Dev: Migrated `Kraken::getUser` to Helix (#2260)
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
namespace chatterino {
|
||||
namespace {
|
||||
|
||||
const QString CHANNEL_HAS_NO_EMOTES(
|
||||
"This channel has no BetterTTV channel emotes.");
|
||||
|
||||
QString emoteLinkFormat("https://betterttv.com/emotes/%1");
|
||||
|
||||
Url getEmoteLink(QString urlTemplate, const EmoteId &id,
|
||||
|
@ -164,23 +167,37 @@ void BttvEmotes::loadChannel(std::weak_ptr<Channel> channel,
|
|||
manualRefresh](auto result) -> Outcome {
|
||||
auto pair =
|
||||
parseChannelEmotes(result.parseJson(), channelDisplayName);
|
||||
bool hasEmotes = false;
|
||||
if (pair.first)
|
||||
{
|
||||
hasEmotes = !pair.second.empty();
|
||||
callback(std::move(pair.second));
|
||||
}
|
||||
if (auto shared = channel.lock(); manualRefresh)
|
||||
shared->addMessage(
|
||||
makeSystemMessage("BetterTTV channel emotes reloaded."));
|
||||
{
|
||||
if (hasEmotes)
|
||||
{
|
||||
shared->addMessage(makeSystemMessage(
|
||||
"BetterTTV channel emotes reloaded."));
|
||||
}
|
||||
else
|
||||
{
|
||||
shared->addMessage(
|
||||
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
|
||||
}
|
||||
}
|
||||
return pair.first;
|
||||
})
|
||||
.onError([channelId, channel, manualRefresh](auto result) {
|
||||
auto shared = channel.lock();
|
||||
if (!shared)
|
||||
return;
|
||||
if (result.status() == 203)
|
||||
if (result.status() == 404)
|
||||
{
|
||||
// User does not have any BTTV emotes
|
||||
if (manualRefresh)
|
||||
shared->addMessage(makeSystemMessage(
|
||||
"This channel has no BetterTTV channel emotes."));
|
||||
shared->addMessage(
|
||||
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
|
||||
}
|
||||
else if (result.status() == NetworkResult::timedoutStatus)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
|
||||
namespace chatterino {
|
||||
namespace {
|
||||
|
||||
const QString CHANNEL_HAS_NO_EMOTES(
|
||||
"This channel has no FrankerFaceZ channel emotes.");
|
||||
|
||||
Url getEmoteLink(const QJsonObject &urls, const QString &emoteScale)
|
||||
{
|
||||
auto emote = urls.value(emoteScale);
|
||||
|
@ -210,11 +214,23 @@ void FfzEmotes::loadChannel(
|
|||
auto emoteMap = parseChannelEmotes(json);
|
||||
auto modBadge = parseModBadge(json);
|
||||
|
||||
bool hasEmotes = !emoteMap.empty();
|
||||
|
||||
emoteCallback(std::move(emoteMap));
|
||||
modBadgeCallback(std::move(modBadge));
|
||||
if (auto shared = channel.lock(); manualRefresh)
|
||||
shared->addMessage(
|
||||
makeSystemMessage("FrankerFaceZ channel emotes reloaded."));
|
||||
{
|
||||
if (hasEmotes)
|
||||
{
|
||||
shared->addMessage(makeSystemMessage(
|
||||
"FrankerFaceZ channel emotes reloaded."));
|
||||
}
|
||||
else
|
||||
{
|
||||
shared->addMessage(
|
||||
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
|
||||
}
|
||||
}
|
||||
|
||||
return Success;
|
||||
})
|
||||
|
@ -222,12 +238,12 @@ void FfzEmotes::loadChannel(
|
|||
auto shared = channel.lock();
|
||||
if (!shared)
|
||||
return;
|
||||
if (result.status() == 203)
|
||||
if (result.status() == 404)
|
||||
{
|
||||
// User does not have any FFZ emotes
|
||||
if (manualRefresh)
|
||||
shared->addMessage(makeSystemMessage(
|
||||
"This channel has no FrankerFaceZ channel emotes."));
|
||||
shared->addMessage(
|
||||
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
|
||||
}
|
||||
else if (result.status() == NetworkResult::timedoutStatus)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue