Merge remote-tracking branch 'origin/master' into zneix/enhancement/login-overhaul

This commit is contained in:
zneix 2021-08-14 23:52:46 +02:00
commit bcb19d7016
No known key found for this signature in database
GPG key ID: 911916E0523B22F6
9 changed files with 38 additions and 37 deletions

View file

@ -6,6 +6,9 @@
- Minor: Remove TwitchEmotes.com attribution and the open/copy options when right-clicking a Twitch Emote. (#2214, #3136) - Minor: Remove TwitchEmotes.com attribution and the open/copy options when right-clicking a Twitch Emote. (#2214, #3136)
- Minor: Strip leading @ and trailing , from username in /user and /usercard commands. (#3143) - Minor: Strip leading @ and trailing , from username in /user and /usercard commands. (#3143)
- Minor: Display a system message when reloading subscription emotes to match BTTV/FFZ behavior (#3135) - Minor: Display a system message when reloading subscription emotes to match BTTV/FFZ behavior (#3135)
- Minor: Added a setting to hide similar messages by any user. (#2716)
- Minor: Duplicate spaces now count towards the display message length. (#3002)
- Bugfix: Notifications for moderators about other moderators deleting messages can now be disabled. (#3121)
- Bugfix: Moderation mode and active filters are now preserved when opening a split as a popup. (#3113, #3130) - Bugfix: Moderation mode and active filters are now preserved when opening a split as a popup. (#3113, #3130)
- Bugfix: Fixed a bug that caused all badge highlights to use the same color. (#3132, #3134) - Bugfix: Fixed a bug that caused all badge highlights to use the same color. (#3132, #3134)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103) - Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)

View file

@ -286,7 +286,7 @@ void Application::initPubsub()
auto chan = auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID); this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty()) if (chan->isEmpty() || getSettings()->hideDeletionActions)
{ {
return; return;
} }

View file

@ -112,11 +112,10 @@ float IrcMessageHandler::similarity(
MessagePtr msg, const LimitedQueueSnapshot<MessagePtr> &messages) MessagePtr msg, const LimitedQueueSnapshot<MessagePtr> &messages)
{ {
float similarityPercent = 0.0f; float similarityPercent = 0.0f;
int bySameUser = 0; int checked = 0;
for (int i = 1; bySameUser < getSettings()->hideSimilarMaxMessagesToCheck; for (int i = 1; i <= messages.size(); ++i)
++i)
{ {
if (messages.size() < i) if (checked >= getSettings()->hideSimilarMaxMessagesToCheck)
{ {
break; break;
} }
@ -126,11 +125,12 @@ float IrcMessageHandler::similarity(
{ {
break; break;
} }
if (msg->loginName != prevMsg->loginName) if (getSettings()->hideSimilarBySameUser &&
msg->loginName != prevMsg->loginName)
{ {
continue; continue;
} }
++bySameUser; ++checked;
similarityPercent = std::max( similarityPercent = std::max(
similarityPercent, similarityPercent,
relativeSimilarity(msg->messageText, prevMsg->messageText)); relativeSimilarity(msg->messageText, prevMsg->messageText));

View file

@ -184,29 +184,7 @@ MessagePtr TwitchMessageBuilder::build()
this->emplace<TimestampElement>( this->emplace<TimestampElement>(
calculateMessageTimestamp(this->ircMessage)); calculateMessageTimestamp(this->ircMessage));
bool addModerationElement = true; if (this->shouldAddModerationElements())
if (this->senderIsBroadcaster)
{
addModerationElement = false;
}
else
{
bool hasUserType = this->tags.contains("user-type");
if (hasUserType)
{
QString userType = this->tags.value("user-type").toString();
if (userType == "mod")
{
if (!args.isStaffOrBroadcaster)
{
addModerationElement = false;
}
}
}
}
if (addModerationElement)
{ {
this->emplace<TwitchModerationElement>(); this->emplace<TwitchModerationElement>();
} }
@ -1230,6 +1208,24 @@ Outcome TwitchMessageBuilder::tryParseCheermote(const QString &string)
return Success; return Success;
} }
bool TwitchMessageBuilder::shouldAddModerationElements() const
{
if (this->senderIsBroadcaster)
{
// You cannot timeout the broadcaster
return false;
}
if (this->tags.value("user-type").toString() == "mod" &&
!this->args.isStaffOrBroadcaster)
{
// You cannot timeout moderators UNLESS you are Twitch Staff or the broadcaster of the channel
return false;
}
return true;
}
void TwitchMessageBuilder::appendChannelPointRewardMessage( void TwitchMessageBuilder::appendChannelPointRewardMessage(
const ChannelPointReward &reward, MessageBuilder *builder, bool isMod, const ChannelPointReward &reward, MessageBuilder *builder, bool isMod,
bool isBroadcaster) bool isBroadcaster)

View file

@ -90,6 +90,8 @@ private:
void appendFfzBadges(); void appendFfzBadges();
Outcome tryParseCheermote(const QString &string); Outcome tryParseCheermote(const QString &string);
bool shouldAddModerationElements() const;
QString roomID_; QString roomID_;
bool hasBits_ = false; bool hasBits_ = false;
QString bits; QString bits;

View file

@ -392,6 +392,8 @@ public:
BoolSetting colorSimilarDisabled = {"/similarity/colorSimilarDisabled", BoolSetting colorSimilarDisabled = {"/similarity/colorSimilarDisabled",
true}; true};
BoolSetting hideSimilar = {"/similarity/hideSimilar", false}; BoolSetting hideSimilar = {"/similarity/hideSimilar", false};
BoolSetting hideSimilarBySameUser = {"/similarity/hideSimilarBySameUser",
true};
BoolSetting hideSimilarMyself = {"/similarity/hideSimilarMyself", false}; BoolSetting hideSimilarMyself = {"/similarity/hideSimilarMyself", false};
BoolSetting shownSimilarTriggerHighlights = { BoolSetting shownSimilarTriggerHighlights = {
"/similarity/shownSimilarTriggerHighlights", false}; "/similarity/shownSimilarTriggerHighlights", false};

View file

@ -520,11 +520,11 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCheckbox("Title", s.headerStreamTitle); layout.addCheckbox("Title", s.headerStreamTitle);
layout.addSubtitle("R9K"); layout.addSubtitle("R9K");
layout.addDescription( layout.addDescription("Hide similar messages. Toggle hidden "
"Hide similar messages by the same user. Toggle hidden " "messages by pressing Ctrl+H.");
"messages by pressing Ctrl+H.");
layout.addCheckbox("Hide similar messages", s.similarityEnabled); layout.addCheckbox("Hide similar messages", s.similarityEnabled);
//layout.addCheckbox("Gray out matches", s.colorSimilarDisabled); //layout.addCheckbox("Gray out matches", s.colorSimilarDisabled);
layout.addCheckbox("By the same user", s.hideSimilarBySameUser);
layout.addCheckbox("Hide my own messages", s.hideSimilarMyself); layout.addCheckbox("Hide my own messages", s.hideSimilarMyself);
layout.addCheckbox("Receive notification sounds from hidden messages", layout.addCheckbox("Receive notification sounds from hidden messages",
s.shownSimilarTriggerHighlights); s.shownSimilarTriggerHighlights);

View file

@ -262,10 +262,11 @@ Split::Split(QWidget *parent)
if (getSettings()->askOnImageUpload.getValue()) if (getSettings()->askOnImageUpload.getValue())
{ {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setWindowTitle("Chatterino");
msgBox.setText("Image upload"); msgBox.setText("Image upload");
msgBox.setInformativeText( msgBox.setInformativeText(
"You are uploading an image to a 3rd party service not in " "You are uploading an image to a 3rd party service not in "
"control of the chatterino team. You may not be able to " "control of the Chatterino team. You may not be able to "
"remove the image from the site. Are you okay with this?"); "remove the image from the site. Are you okay with this?");
msgBox.addButton(QMessageBox::Cancel); msgBox.addButton(QMessageBox::Cancel);
msgBox.addButton(QMessageBox::Yes); msgBox.addButton(QMessageBox::Yes);

View file

@ -639,9 +639,6 @@ void SplitInput::editTextChanged()
this->textChanged.invoke(text); this->textChanged.invoke(text);
text = text.trimmed(); text = text.trimmed();
static QRegularExpression spaceRegex("\\s\\s+");
text = text.replace(spaceRegex, " ");
text = text =
app->commands->execCommand(text, this->split_->getChannel(), true); app->commands->execCommand(text, this->split_->getChannel(), true);
} }