Improve "Login expired!" message (#2029)

* feat: improve "Login expired!" message

Since this message occurs when the OAuth token becomes invalid, users
have to re-add their account in order to continue using the application.
The previous message did not make this clear enough, often leading to
confusion and questions by users.

This commit changes the system message to more clear about what the user
has to do, and adds a link that opens the "Accounts" page in the
preferences.

* Update changelog

* Update ChannelView.cpp

Co-authored-by: fourtf <tf.four@gmail.com>
This commit is contained in:
Leon Richardt 2020-10-04 17:36:38 +02:00 committed by GitHub
parent 53a784eb1b
commit aff59495df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 3 deletions

View file

@ -14,6 +14,7 @@
- Minor: Colorized nicknames now enabled by default - Minor: Colorized nicknames now enabled by default
- Minor: Show channels live now enabled by default - Minor: Show channels live now enabled by default
- Minor: Bold usernames enabled by default - Minor: Bold usernames enabled by default
- Minor: Improve UX of the "Login expired!" message (#2029)
- Bugfix: Fix bug preventing users from setting the highlight color of the second entry in the "User" highlights tab (#1898) - Bugfix: Fix bug preventing users from setting the highlight color of the second entry in the "User" highlights tab (#1898)
- Bugfix: Fix bug where the "check user follow state" event could trigger a network request requesting the user to follow or unfollow a user. By itself its quite harmless as it just repeats to Twitch the same follow state we had, so no follows should have been lost by this but it meant there was a rogue network request that was fired that could cause a crash (#1906) - Bugfix: Fix bug where the "check user follow state" event could trigger a network request requesting the user to follow or unfollow a user. By itself its quite harmless as it just repeats to Twitch the same follow state we had, so no follows should have been lost by this but it meant there was a rogue network request that was fired that could cause a crash (#1906)
- Bugfix: /usercard command will now respect the "Automatically close user popup" setting (#1918) - Bugfix: /usercard command will now respect the "Automatically close user popup" setting (#1918)

View file

@ -19,6 +19,7 @@ public:
UserAction, UserAction,
AutoModAllow, AutoModAllow,
AutoModDeny, AutoModDeny,
OpenAccountsPage,
}; };
Link(); Link();

View file

@ -655,9 +655,25 @@ std::vector<MessagePtr> IrcMessageHandler::parseNoticeMessage(
{ {
if (message->content().startsWith("Login auth", Qt::CaseInsensitive)) if (message->content().startsWith("Login auth", Qt::CaseInsensitive))
{ {
return {MessageBuilder(systemMessage, const auto linkColor = MessageColor(MessageColor::Link);
"Login expired! Try logging in again.") const auto accountsLink = Link(Link::OpenAccountsPage, QString());
.release()}; const auto curUser = getApp()->accounts->twitch.getCurrent();
const auto expirationText = QString("Login expired for user \"%1\"!")
.arg(curUser->getUserName());
const auto loginPromptText = QString(" Try adding your account again.");
auto builder = MessageBuilder();
builder.message().flags.set(MessageFlag::System);
builder.emplace<TimestampElement>();
builder.emplace<TextElement>(expirationText, MessageElementFlag::Text,
MessageColor::System);
builder
.emplace<TextElement>(loginPromptText, MessageElementFlag::Text,
linkColor)
->setLink(accountsLink);
return {builder.release()};
} }
else else
{ {

View file

@ -38,6 +38,7 @@
#include "util/Twitch.hpp" #include "util/Twitch.hpp"
#include "widgets/Scrollbar.hpp" #include "widgets/Scrollbar.hpp"
#include "widgets/TooltipWidget.hpp" #include "widgets/TooltipWidget.hpp"
#include "widgets/dialogs/SettingsDialog.hpp"
#include "widgets/dialogs/UserInfoPopup.hpp" #include "widgets/dialogs/UserInfoPopup.hpp"
#include "widgets/helper/EffectLabel.hpp" #include "widgets/helper/EffectLabel.hpp"
#include "widgets/splits/Split.hpp" #include "widgets/splits/Split.hpp"
@ -1879,6 +1880,12 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
case Link::AutoModDeny: { case Link::AutoModDeny: {
getApp()->accounts->twitch.getCurrent()->autoModDeny(link.value); getApp()->accounts->twitch.getCurrent()->autoModDeny(link.value);
} }
break;
case Link::OpenAccountsPage: {
SettingsDialog::showDialog(SettingsDialogPreference::Accounts);
}
break;
default:; default:;
} }