mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Merge pull request #1007 from pphop/pphop-show-ignored
Show ignored users messages anyway setting
This commit is contained in:
commit
695d200d79
|
@ -12,6 +12,8 @@ class Paths;
|
|||
|
||||
class IgnoreModel;
|
||||
|
||||
enum class ShowIgnoredUsersMessages { Never, IfModerator, IfBroadcaster };
|
||||
|
||||
class IgnoreController final : public Singleton
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -80,6 +80,19 @@ bool TwitchMessageBuilder::isIgnored() const
|
|||
{
|
||||
if (sourceUserID == user.id)
|
||||
{
|
||||
switch (static_cast<ShowIgnoredUsersMessages>(
|
||||
getSettings()->showIgnoredUsersMessages.getValue()))
|
||||
{
|
||||
case ShowIgnoredUsersMessages::IfModerator:
|
||||
if (this->channel->isMod() ||
|
||||
this->channel->isBroadcaster())
|
||||
return false;
|
||||
break;
|
||||
case ShowIgnoredUsersMessages::IfBroadcaster:
|
||||
if (this->channel->isBroadcaster())
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
log("Blocking message because it's from blocked user {}",
|
||||
user.name);
|
||||
return true;
|
||||
|
|
|
@ -128,6 +128,7 @@ public:
|
|||
/// Ingored Users
|
||||
BoolSetting enableTwitchIgnoredUsers = {"/ignore/enableTwitchIgnoredUsers",
|
||||
true};
|
||||
IntSetting showIgnoredUsersMessages = {"/ignore/showIgnoredUsers", 0};
|
||||
|
||||
/// Moderation
|
||||
QStringSetting timeoutAction = {"/moderation/timeoutAction", "Disable"};
|
||||
|
|
|
@ -77,8 +77,24 @@ void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users,
|
|||
|
||||
auto anyways = users.emplace<QHBoxLayout>().withoutMargin();
|
||||
{
|
||||
anyways.emplace<QLabel>("Show anyways if:");
|
||||
anyways.emplace<QComboBox>();
|
||||
anyways.emplace<QLabel>("Show messages from ignored users anyways:");
|
||||
|
||||
auto combo = anyways.emplace<QComboBox>().getElement();
|
||||
combo->addItems(
|
||||
{"Never", "If you are Moderator", "If you are Broadcaster"});
|
||||
|
||||
auto &setting = getSettings()->showIgnoredUsersMessages;
|
||||
|
||||
setting.connect(
|
||||
[combo](const int value) { combo->setCurrentIndex(value); });
|
||||
|
||||
QObject::connect(combo,
|
||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[&setting](int index) {
|
||||
if (index != -1)
|
||||
setting = index;
|
||||
});
|
||||
|
||||
anyways->addStretch(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue