mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fix custom built messages not showing up as search results (#2962)
This commit is contained in:
parent
b37c0cb177
commit
94a99ac4f0
|
@ -13,6 +13,7 @@
|
|||
- Bugfix: Made follower emotes suggested (in emote popup menu, tab completion, emote input menu) only in their origin channel, not globally. (#2951)
|
||||
- Bugfix: Fixed founder badge not being respected by `author.subbed` filter. (#2971)
|
||||
- Bugfix: Usercards on IRC will now only show user's messages. (#1780, #2979)
|
||||
- Bugfix: Messages that couldn't be searched or filtered are now handled correctly. (#2962)
|
||||
|
||||
## 2.3.3
|
||||
|
||||
|
|
|
@ -31,14 +31,17 @@ MessagePtr makeSystemMessage(const QString &text, const QTime &time)
|
|||
MessagePtr makeAutomodInfoMessage(const AutomodInfoAction &action)
|
||||
{
|
||||
auto builder = MessageBuilder();
|
||||
QString text("AutoMod: ");
|
||||
|
||||
builder.emplace<TimestampElement>();
|
||||
builder.message().flags.set(MessageFlag::PubSub);
|
||||
|
||||
// AutoMod shield badge
|
||||
builder
|
||||
.emplace<ImageElement>(Image::fromPixmap(getResources().twitch.automod),
|
||||
MessageElementFlag::BadgeChannelAuthority)
|
||||
->setTooltip("AutoMod");
|
||||
// AutoMod "username"
|
||||
builder.emplace<TextElement>("AutoMod:", MessageElementFlag::BoldUsername,
|
||||
MessageColor(QColor("blue")),
|
||||
FontStyle::ChatMediumBold);
|
||||
|
@ -48,27 +51,32 @@ MessagePtr makeAutomodInfoMessage(const AutomodInfoAction &action)
|
|||
switch (action.type)
|
||||
{
|
||||
case AutomodInfoAction::OnHold: {
|
||||
builder.emplace<TextElement>(("Hey! Your message is being checked "
|
||||
"by mods and has not been sent."),
|
||||
MessageElementFlag::Text,
|
||||
QString info("Hey! Your message is being checked "
|
||||
"by mods and has not been sent.");
|
||||
text += info;
|
||||
builder.emplace<TextElement>(info, MessageElementFlag::Text,
|
||||
MessageColor::Text);
|
||||
}
|
||||
break;
|
||||
case AutomodInfoAction::Denied: {
|
||||
builder.emplace<TextElement>(("Mods have removed your message."),
|
||||
MessageElementFlag::Text,
|
||||
QString info("Mods have removed your message.");
|
||||
text += info;
|
||||
builder.emplace<TextElement>(info, MessageElementFlag::Text,
|
||||
MessageColor::Text);
|
||||
}
|
||||
break;
|
||||
case AutomodInfoAction::Approved: {
|
||||
builder.emplace<TextElement>(("Mods have accepted your message."),
|
||||
MessageElementFlag::Text,
|
||||
QString info("Mods have accepted your message.");
|
||||
text += info;
|
||||
builder.emplace<TextElement>(info, MessageElementFlag::Text,
|
||||
MessageColor::Text);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
builder.message().flags.set(MessageFlag::AutoMod);
|
||||
builder.message().messageText = text;
|
||||
builder.message().searchText = text;
|
||||
|
||||
auto message = builder.release();
|
||||
|
||||
|
@ -78,63 +86,83 @@ MessagePtr makeAutomodInfoMessage(const AutomodInfoAction &action)
|
|||
std::pair<MessagePtr, MessagePtr> makeAutomodMessage(
|
||||
const AutomodAction &action)
|
||||
{
|
||||
auto builder = MessageBuilder();
|
||||
MessageBuilder builder, builder2;
|
||||
|
||||
//
|
||||
// Builder for AutoMod message with explanation
|
||||
builder.emplace<TimestampElement>();
|
||||
builder.message().loginName = "automod";
|
||||
builder.message().flags.set(MessageFlag::PubSub);
|
||||
|
||||
// AutoMod shield badge
|
||||
builder
|
||||
.emplace<ImageElement>(Image::fromPixmap(getResources().twitch.automod),
|
||||
MessageElementFlag::BadgeChannelAuthority)
|
||||
->setTooltip("AutoMod");
|
||||
// AutoMod "username"
|
||||
builder.emplace<TextElement>("AutoMod:", MessageElementFlag::BoldUsername,
|
||||
MessageColor(QColor("blue")),
|
||||
FontStyle::ChatMediumBold);
|
||||
builder.emplace<TextElement>(
|
||||
"AutoMod:", MessageElementFlag::NonBoldUsername,
|
||||
MessageColor(QColor("blue")));
|
||||
// AutoMod header message
|
||||
builder.emplace<TextElement>(
|
||||
("Held a message for reason: " + action.reason +
|
||||
". Allow will post it in chat. "),
|
||||
MessageElementFlag::Text, MessageColor::Text);
|
||||
// Allow link button
|
||||
builder
|
||||
.emplace<TextElement>("Allow", MessageElementFlag::Text,
|
||||
MessageColor(QColor("green")),
|
||||
FontStyle::ChatMediumBold)
|
||||
->setLink({Link::AutoModAllow, action.msgID});
|
||||
// Deny link button
|
||||
builder
|
||||
.emplace<TextElement>(" Deny", MessageElementFlag::Text,
|
||||
MessageColor(QColor("red")),
|
||||
FontStyle::ChatMediumBold)
|
||||
->setLink({Link::AutoModDeny, action.msgID});
|
||||
// builder.emplace<TextElement>(action.msgID,
|
||||
// MessageElementFlag::Text,
|
||||
// MessageColor::Text);
|
||||
// ID of message caught by AutoMod
|
||||
// builder.emplace<TextElement>(action.msgID, MessageElementFlag::Text,
|
||||
// MessageColor::Text);
|
||||
builder.message().flags.set(MessageFlag::AutoMod);
|
||||
auto text1 =
|
||||
QString("AutoMod: Held a message for reason: %1. Allow will post "
|
||||
"it in chat. Allow Deny")
|
||||
.arg(action.reason);
|
||||
builder.message().messageText = text1;
|
||||
builder.message().searchText = text1;
|
||||
|
||||
auto message1 = builder.release();
|
||||
|
||||
builder = MessageBuilder();
|
||||
builder.emplace<TimestampElement>();
|
||||
builder.emplace<TwitchModerationElement>();
|
||||
builder.message().loginName = action.target.name;
|
||||
builder.message().flags.set(MessageFlag::PubSub);
|
||||
//
|
||||
// Builder for offender's message
|
||||
builder2.emplace<TimestampElement>();
|
||||
builder2.emplace<TwitchModerationElement>();
|
||||
builder2.message().loginName = action.target.name;
|
||||
builder2.message().flags.set(MessageFlag::PubSub);
|
||||
|
||||
builder
|
||||
// sender username
|
||||
builder2
|
||||
.emplace<TextElement>(
|
||||
action.target.name + ":", MessageElementFlag::BoldUsername,
|
||||
MessageColor(QColor("red")), FontStyle::ChatMediumBold)
|
||||
->setLink({Link::UserInfo, action.target.name});
|
||||
builder
|
||||
builder2
|
||||
.emplace<TextElement>(action.target.name + ":",
|
||||
MessageElementFlag::NonBoldUsername,
|
||||
MessageColor(QColor("red")))
|
||||
->setLink({Link::UserInfo, action.target.name});
|
||||
builder.emplace<TextElement>(action.message, MessageElementFlag::Text,
|
||||
MessageColor::Text);
|
||||
builder.message().flags.set(MessageFlag::AutoMod);
|
||||
// sender's message caught by AutoMod
|
||||
builder2.emplace<TextElement>(action.message, MessageElementFlag::Text,
|
||||
MessageColor::Text);
|
||||
builder2.message().flags.set(MessageFlag::AutoMod);
|
||||
auto text2 = QString("%1: %2").arg(action.target.name, action.message);
|
||||
builder2.message().messageText = text2;
|
||||
builder2.message().searchText = text2;
|
||||
|
||||
auto message2 = builder.release();
|
||||
auto message2 = builder2.release();
|
||||
|
||||
return std::make_pair(message1, message2);
|
||||
}
|
||||
|
@ -369,29 +397,25 @@ MessageBuilder::MessageBuilder(const AutomodUserAction &action)
|
|||
{
|
||||
case AutomodUserAction::AddPermitted: {
|
||||
text = QString("%1 added %2 as a permitted term on AutoMod.")
|
||||
.arg(action.source.name)
|
||||
.arg(action.message);
|
||||
.arg(action.source.name, action.message);
|
||||
}
|
||||
break;
|
||||
|
||||
case AutomodUserAction::AddBlocked: {
|
||||
text = QString("%1 added %2 as a blocked term on AutoMod.")
|
||||
.arg(action.source.name)
|
||||
.arg(action.message);
|
||||
.arg(action.source.name, action.message);
|
||||
}
|
||||
break;
|
||||
|
||||
case AutomodUserAction::RemovePermitted: {
|
||||
text = QString("%1 removed %2 as a permitted term on AutoMod.")
|
||||
.arg(action.source.name)
|
||||
.arg(action.message);
|
||||
.arg(action.source.name, action.message);
|
||||
}
|
||||
break;
|
||||
|
||||
case AutomodUserAction::RemoveBlocked: {
|
||||
text = QString("%1 removed %2 as a blocked term on AutoMod.")
|
||||
.arg(action.source.name)
|
||||
.arg(action.message);
|
||||
.arg(action.source.name, action.message);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -401,6 +425,8 @@ MessageBuilder::MessageBuilder(const AutomodUserAction &action)
|
|||
}
|
||||
break;
|
||||
}
|
||||
this->message().messageText = text;
|
||||
this->message().searchText = text;
|
||||
|
||||
this->emplace<TextElement>(text, MessageElementFlag::Text,
|
||||
MessageColor::System);
|
||||
|
|
|
@ -50,6 +50,9 @@ MessagePtr generateBannedMessage(bool confirmedBan)
|
|||
: QString("Try reconnecting.");
|
||||
|
||||
MessageBuilder builder;
|
||||
auto text = QString("%1 %2").arg(bannedText, reconnectPromptText);
|
||||
builder.message().messageText = text;
|
||||
builder.message().searchText = text;
|
||||
builder.message().flags.set(MessageFlag::System);
|
||||
|
||||
builder.emplace<TimestampElement>();
|
||||
|
@ -735,9 +738,12 @@ std::vector<MessagePtr> IrcMessageHandler::parseNoticeMessage(
|
|||
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.");
|
||||
const auto loginPromptText = QString("Try adding your account again.");
|
||||
|
||||
auto builder = MessageBuilder();
|
||||
auto text = QString("%1 %2").arg(expirationText, loginPromptText);
|
||||
builder.message().messageText = text;
|
||||
builder.message().searchText = text;
|
||||
builder.message().flags.set(MessageFlag::System);
|
||||
builder.message().flags.set(MessageFlag::DoNotTriggerNotification);
|
||||
|
||||
|
|
|
@ -1058,6 +1058,10 @@ void TwitchChannel::createClip()
|
|||
// successCallback
|
||||
[this](const HelixClip &clip) {
|
||||
MessageBuilder builder;
|
||||
QString text(
|
||||
"Clip created! Copy link to clipboard or edit it in browser.");
|
||||
builder.message().messageText = text;
|
||||
builder.message().searchText = text;
|
||||
builder.message().flags.set(MessageFlag::System);
|
||||
|
||||
builder.emplace<TimestampElement>();
|
||||
|
@ -1086,6 +1090,7 @@ void TwitchChannel::createClip()
|
|||
// failureCallback
|
||||
[this](auto error) {
|
||||
MessageBuilder builder;
|
||||
QString text;
|
||||
builder.message().flags.set(MessageFlag::System);
|
||||
|
||||
builder.emplace<TimestampElement>();
|
||||
|
@ -1096,6 +1101,7 @@ void TwitchChannel::createClip()
|
|||
builder.emplace<TextElement>(
|
||||
CLIPS_FAILURE_CLIPS_DISABLED_TEXT,
|
||||
MessageElementFlag::Text, MessageColor::System);
|
||||
text = CLIPS_FAILURE_CLIPS_DISABLED_TEXT;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1108,6 +1114,9 @@ void TwitchChannel::createClip()
|
|||
MessageElementFlag::Text,
|
||||
MessageColor::Link)
|
||||
->setLink(ACCOUNTS_LINK);
|
||||
text = QString("%1 %2").arg(
|
||||
CLIPS_FAILURE_NOT_AUTHENTICATED_TEXT,
|
||||
LOGIN_PROMPT_TEXT);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1117,10 +1126,14 @@ void TwitchChannel::createClip()
|
|||
builder.emplace<TextElement>(
|
||||
CLIPS_FAILURE_UNKNOWN_ERROR_TEXT,
|
||||
MessageElementFlag::Text, MessageColor::System);
|
||||
text = CLIPS_FAILURE_UNKNOWN_ERROR_TEXT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
builder.message().messageText = text;
|
||||
builder.message().searchText = text;
|
||||
|
||||
this->addMessage(builder.release());
|
||||
},
|
||||
// finallyCallback - this will always execute, so clip creation won't ever be stuck
|
||||
|
|
|
@ -1253,6 +1253,7 @@ void TwitchMessageBuilder::appendChannelPointRewardMessage(
|
|||
{
|
||||
builder->emplace<TimestampElement>();
|
||||
QString redeemed = "Redeemed";
|
||||
QStringList textList;
|
||||
if (!reward.isUserInputRequired)
|
||||
{
|
||||
builder
|
||||
|
@ -1261,6 +1262,7 @@ void TwitchMessageBuilder::appendChannelPointRewardMessage(
|
|||
MessageColor::Text, FontStyle::ChatMediumBold)
|
||||
->setLink({Link::UserInfo, reward.user.login});
|
||||
redeemed = "redeemed";
|
||||
textList.append(reward.user.login);
|
||||
}
|
||||
builder->emplace<TextElement>(redeemed,
|
||||
MessageElementFlag::ChannelPointReward);
|
||||
|
@ -1279,6 +1281,10 @@ void TwitchMessageBuilder::appendChannelPointRewardMessage(
|
|||
}
|
||||
|
||||
builder->message().flags.set(MessageFlag::RedeemedChannelPointReward);
|
||||
|
||||
textList.append({redeemed, reward.title, QString::number(reward.cost)});
|
||||
builder->message().messageText = textList.join(" ");
|
||||
builder->message().searchText = textList.join(" ");
|
||||
}
|
||||
|
||||
void TwitchMessageBuilder::liveMessage(const QString &channelName,
|
||||
|
@ -1291,9 +1297,9 @@ void TwitchMessageBuilder::liveMessage(const QString &channelName,
|
|||
->setLink({Link::UserInfo, channelName});
|
||||
builder->emplace<TextElement>("is live!", MessageElementFlag::Text,
|
||||
MessageColor::Text);
|
||||
auto text = channelName + " is live!";
|
||||
builder->message().searchText = text;
|
||||
auto text = QString("%1 is live!").arg(channelName);
|
||||
builder->message().messageText = text;
|
||||
builder->message().searchText = text;
|
||||
}
|
||||
|
||||
void TwitchMessageBuilder::liveSystemMessage(const QString &channelName,
|
||||
|
@ -1308,6 +1314,9 @@ void TwitchMessageBuilder::liveSystemMessage(const QString &channelName,
|
|||
->setLink({Link::UserInfo, channelName});
|
||||
builder->emplace<TextElement>("is live!", MessageElementFlag::Text,
|
||||
MessageColor::System);
|
||||
auto text = QString("%1 is live!").arg(channelName);
|
||||
builder->message().messageText = text;
|
||||
builder->message().searchText = text;
|
||||
}
|
||||
|
||||
void TwitchMessageBuilder::offlineSystemMessage(const QString &channelName,
|
||||
|
@ -1322,12 +1331,16 @@ void TwitchMessageBuilder::offlineSystemMessage(const QString &channelName,
|
|||
->setLink({Link::UserInfo, channelName});
|
||||
builder->emplace<TextElement>("is now offline.", MessageElementFlag::Text,
|
||||
MessageColor::System);
|
||||
auto text = QString("%1 is now offline.").arg(channelName);
|
||||
builder->message().messageText = text;
|
||||
builder->message().searchText = text;
|
||||
}
|
||||
|
||||
void TwitchMessageBuilder::hostingSystemMessage(const QString &channelName,
|
||||
MessageBuilder *builder,
|
||||
bool hostOn)
|
||||
{
|
||||
QString text;
|
||||
builder->emplace<TimestampElement>();
|
||||
builder->message().flags.set(MessageFlag::System);
|
||||
builder->message().flags.set(MessageFlag::DoNotTriggerNotification);
|
||||
|
@ -1340,6 +1353,7 @@ void TwitchMessageBuilder::hostingSystemMessage(const QString &channelName,
|
|||
channelName + ".", MessageElementFlag::Username,
|
||||
MessageColor::System, FontStyle::ChatMediumBold)
|
||||
->setLink({Link::UserInfo, channelName});
|
||||
text = QString("Now hosting %1.").arg(channelName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1351,7 +1365,11 @@ void TwitchMessageBuilder::hostingSystemMessage(const QString &channelName,
|
|||
builder->emplace<TextElement>("has gone offline. Exiting host mode.",
|
||||
MessageElementFlag::Text,
|
||||
MessageColor::System);
|
||||
text =
|
||||
QString("%1 has gone offline. Exiting host mode.").arg(channelName);
|
||||
}
|
||||
builder->message().messageText = text;
|
||||
builder->message().searchText = text;
|
||||
}
|
||||
|
||||
// irc variant
|
||||
|
|
Loading…
Reference in a new issue