Refactored system message received upon trying to send a message while anonymous (#2862)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
- Minor: Limit the number of recent chatters to improve memory usage and reduce freezes. (#2796, #2814)
|
- Minor: Limit the number of recent chatters to improve memory usage and reduce freezes. (#2796, #2814)
|
||||||
- Minor: Added `/popout` command. Usage: `/popout [channel]`. It opens browser chat for the provided channel. Can also be used without arguments to open current channels browser chat. (#2556, #2812)
|
- Minor: Added `/popout` command. Usage: `/popout [channel]`. It opens browser chat for the provided channel. Can also be used without arguments to open current channels browser chat. (#2556, #2812)
|
||||||
- Minor: Improved matching of game names when using `/setgame` command (#2636)
|
- Minor: Improved matching of game names when using `/setgame` command (#2636)
|
||||||
|
- Minor: Added a link to accounts page in settings to "You need to be logged in to send messages" message. (#2862)
|
||||||
- Minor: Switch to Twitch v2 emote API for animated emote support. (#2863)
|
- Minor: Switch to Twitch v2 emote API for animated emote support. (#2863)
|
||||||
- Bugfix: Fixed FFZ emote links for global emotes (#2807, #2808)
|
- Bugfix: Fixed FFZ emote links for global emotes (#2807, #2808)
|
||||||
|
|
||||||
|
|||||||
@@ -328,11 +328,33 @@ void TwitchChannel::sendMessage(const QString &message)
|
|||||||
|
|
||||||
if (!app->accounts->twitch.isLoggedIn())
|
if (!app->accounts->twitch.isLoggedIn())
|
||||||
{
|
{
|
||||||
// XXX: It would be nice if we could add a link here somehow that opened
|
if (message.isEmpty())
|
||||||
// the "account manager" dialog
|
{
|
||||||
this->addMessage(
|
return;
|
||||||
makeSystemMessage("You need to log in to send messages. You can "
|
}
|
||||||
"link your Twitch account in the settings."));
|
|
||||||
|
const auto linkColor = MessageColor(MessageColor::Link);
|
||||||
|
const auto accountsLink = Link(Link::OpenAccountsPage, QString());
|
||||||
|
const auto currentUser = getApp()->accounts->twitch.getCurrent();
|
||||||
|
const auto expirationText =
|
||||||
|
QString("You need to log in to send messages. You can link your "
|
||||||
|
"Twitch account");
|
||||||
|
const auto loginPromptText = QString("in the settings.");
|
||||||
|
|
||||||
|
auto builder = MessageBuilder();
|
||||||
|
builder.message().flags.set(MessageFlag::System);
|
||||||
|
builder.message().flags.set(MessageFlag::DoNotTriggerNotification);
|
||||||
|
|
||||||
|
builder.emplace<TimestampElement>();
|
||||||
|
builder.emplace<TextElement>(expirationText, MessageElementFlag::Text,
|
||||||
|
MessageColor::System);
|
||||||
|
builder
|
||||||
|
.emplace<TextElement>(loginPromptText, MessageElementFlag::Text,
|
||||||
|
linkColor)
|
||||||
|
->setLink(accountsLink);
|
||||||
|
|
||||||
|
this->addMessage(builder.release());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user