mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Added informative messages on issues related to recent-messages (#3029)
This commit is contained in:
parent
8ceb100177
commit
1f19d31a67
|
@ -6,6 +6,7 @@
|
||||||
- Minor: Added autocompletion in /whispers for Twitch emotes, Global Bttv/Ffz emotes and emojis. (#2999, #3033)
|
- Minor: Added autocompletion in /whispers for Twitch emotes, Global Bttv/Ffz emotes and emojis. (#2999, #3033)
|
||||||
- Minor: Received Twitch messages now use the exact same timestamp (obtained from Twitch's server) for every Chatterino user instead of assuming message timestamp on client's side. (#3021)
|
- Minor: Received Twitch messages now use the exact same timestamp (obtained from Twitch's server) for every Chatterino user instead of assuming message timestamp on client's side. (#3021)
|
||||||
- Minor: Received IRC messages use `time` message tag for timestamp if it's available. (#3021)
|
- Minor: Received IRC messages use `time` message tag for timestamp if it's available. (#3021)
|
||||||
|
- Minor: Added informative messages for recent-messages API's errors. (#3029)
|
||||||
- Bugfix: Fixed "smiley" emotes being unable to be "Tabbed" with autocompletion, introduced in v2.3.3. (#3010)
|
- Bugfix: Fixed "smiley" emotes being unable to be "Tabbed" with autocompletion, introduced in v2.3.3. (#3010)
|
||||||
- Dev: Ubuntu packages are now available (#2936)
|
- Dev: Ubuntu packages are now available (#2936)
|
||||||
|
|
||||||
|
|
|
@ -761,13 +761,16 @@ void TwitchChannel::loadRecentMessages()
|
||||||
.arg(baseURL)
|
.arg(baseURL)
|
||||||
.arg(getSettings()->twitchMessageHistoryLimit);
|
.arg(getSettings()->twitchMessageHistoryLimit);
|
||||||
|
|
||||||
|
auto weak = weakOf<Channel>(this);
|
||||||
|
|
||||||
NetworkRequest(url)
|
NetworkRequest(url)
|
||||||
.onSuccess([weak = weakOf<Channel>(this)](auto result) -> Outcome {
|
.onSuccess([this, weak](NetworkResult result) -> Outcome {
|
||||||
auto shared = weak.lock();
|
auto shared = weak.lock();
|
||||||
if (!shared)
|
if (!shared)
|
||||||
return Failure;
|
return Failure;
|
||||||
|
|
||||||
auto messages = parseRecentMessages(result.parseJson(), shared);
|
auto root = result.parseJson();
|
||||||
|
auto messages = parseRecentMessages(root, shared);
|
||||||
|
|
||||||
auto &handler = IrcMessageHandler::instance();
|
auto &handler = IrcMessageHandler::instance();
|
||||||
|
|
||||||
|
@ -801,13 +804,38 @@ void TwitchChannel::loadRecentMessages()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
postToThread(
|
postToThread([this, shared, root,
|
||||||
[shared, messages = std::move(allBuiltMessages)]() mutable {
|
messages = std::move(allBuiltMessages)]() mutable {
|
||||||
shared->addMessagesAtStart(messages);
|
shared->addMessagesAtStart(messages);
|
||||||
});
|
|
||||||
|
// Notify user about a possible gap in logs if it returned some messages
|
||||||
|
// but isn't currently joined to a channel
|
||||||
|
if (QString errorCode = root.value("error_code").toString();
|
||||||
|
!errorCode.isEmpty())
|
||||||
|
{
|
||||||
|
qCDebug(chatterinoTwitch)
|
||||||
|
<< QString("rm error_code=%1, channel=%2")
|
||||||
|
.arg(errorCode, this->getName());
|
||||||
|
if (errorCode == "channel_not_joined" && !messages.empty())
|
||||||
|
{
|
||||||
|
shared->addMessage(makeSystemMessage(
|
||||||
|
"Message history service recovering, there may be "
|
||||||
|
"gaps in the message history."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
})
|
})
|
||||||
|
.onError([weak](NetworkResult result) {
|
||||||
|
auto shared = weak.lock();
|
||||||
|
if (!shared)
|
||||||
|
return;
|
||||||
|
|
||||||
|
shared->addMessage(makeSystemMessage(
|
||||||
|
QString("Message history service unavailable (Error %1)")
|
||||||
|
.arg(result.status())));
|
||||||
|
})
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue