Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into chatterino7
Browse files Browse the repository at this point in the history
Now we're on commit ddbeb35; Changes from upstream we've pulled

- Bugfix: Disabled /popout and /streamlink from working in non-twitch channels (e.g. /whispers) when supplied no arguments. (Chatterino#3541)
- Bugfix: Fixed automod and unban messages showing when moderation actions were disabled (Chatterino#3548)
  • Loading branch information
zneix committed Jan 28, 2022
2 parents 5372f32 + ddbeb35 commit a86079d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 23 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
- Bugfix: Fixed being unable to drag the user card window from certain spots. (#3508)
- Bugfix: Fixed being unable to open a usercard from inside a usercard while "Automatically close user popup when it loses focus" was enabled. (#3518)
- Bugfix: Usercards no longer close when the originating window (e.g. a search popup) is closed. (#3518)
- Bugfix: Disabled /popout and /streamlink from working in non-twitch channels (e.g. /whispers) when supplied no arguments. (#3541)
- Bugfix: Fixed automod and unban messages showing when moderation actions were disabled (#3548)
- Dev: Batch checking live status for channels with live notifications that aren't connected. (#3442)
- Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)
Expand Down
54 changes: 34 additions & 20 deletions src/controllers/commands/CommandController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,47 +655,61 @@ void CommandController::initialize(Settings &, Paths &paths)
return "";
});

this->registerCommand(
"/streamlink", [](const QStringList &words, ChannelPtr channel) {
QString target(words.size() < 2 ? channel->getName() : words[1]);
this->registerCommand("/streamlink", [](const QStringList &words,
ChannelPtr channel) {
QString target(words.value(1));

if (words.size() < 2 &&
(!channel->isTwitchChannel() || channel->isEmpty()))
if (target.isEmpty())
{
if (channel->getType() == Channel::Type::Twitch &&
!channel->isEmpty())
{
target = channel->getName();
}
else
{
channel->addMessage(makeSystemMessage(
"/streamlink [channel]. Open specified Twitch channel in "
"streamlink. If no channel argument is specified, open the "
"current Twitch channel instead."));
return "";
}
}

stripChannelName(target);
openStreamlinkForChannel(target);
stripChannelName(target);
openStreamlinkForChannel(target);

return "";
});
return "";
});

this->registerCommand(
"/popout", [](const QStringList &words, ChannelPtr channel) {
QString target(words.size() < 2 ? channel->getName() : words[1]);
this->registerCommand("/popout", [](const QStringList &words,
ChannelPtr channel) {
QString target(words.value(1));

if (words.size() < 2 &&
(!channel->isTwitchChannel() || channel->isEmpty()))
if (target.isEmpty())
{
if (channel->getType() == Channel::Type::Twitch &&
!channel->isEmpty())
{
target = channel->getName();
}
else
{
channel->addMessage(makeSystemMessage(
"Usage: /popout <channel>. You can also use the command "
"without arguments in any Twitch channel to open its "
"popout chat."));
return "";
}
}

stripChannelName(target);
QDesktopServices::openUrl(
QUrl(QString("https://www.twitch.tv/popout/%1/chat?popout=")
.arg(target)));
stripChannelName(target);
QDesktopServices::openUrl(
QUrl(QString("https://www.twitch.tv/popout/%1/chat?popout=")
.arg(target)));

return "";
});
return "";
});

this->registerCommand("/clearmessages", [](const auto & /*words*/,
ChannelPtr channel) {
Expand Down
6 changes: 4 additions & 2 deletions src/messages/MessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ std::pair<MessagePtr, MessagePtr> makeAutomodMessage(
// Builder for AutoMod message with explanation
builder.message().loginName = "automod";
builder.message().flags.set(MessageFlag::PubSub);
builder.message().flags.set(MessageFlag::Timeout);
builder.message().flags.set(MessageFlag::AutoMod);

// AutoMod shield badge
builder.emplace<BadgeElement>(makeAutoModBadge(),
Expand Down Expand Up @@ -129,7 +131,6 @@ std::pair<MessagePtr, MessagePtr> makeAutomodMessage(
// 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")
Expand All @@ -145,6 +146,8 @@ std::pair<MessagePtr, MessagePtr> makeAutomodMessage(
builder2.emplace<TwitchModerationElement>();
builder2.message().loginName = action.target.login;
builder2.message().flags.set(MessageFlag::PubSub);
builder2.message().flags.set(MessageFlag::Timeout);
builder2.message().flags.set(MessageFlag::AutoMod);

// sender username
builder2
Expand All @@ -160,7 +163,6 @@ std::pair<MessagePtr, MessagePtr> makeAutomodMessage(
// 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.displayName, action.message);
builder2.message().messageText = text2;
Expand Down
3 changes: 2 additions & 1 deletion src/messages/layouts/MessageLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags flags)
}

if (getSettings()->hideModerationActions &&
this->message_->flags.has(MessageFlag::Timeout))
(this->message_->flags.has(MessageFlag::Timeout) ||
this->message_->flags.has(MessageFlag::Untimeout)))
{
continue;
}
Expand Down

0 comments on commit a86079d

Please sign in to comment.