Merge branch 'master' of https://github.com/fourtf/chatterino2
This commit is contained in:
@@ -46,21 +46,19 @@ struct ModeChangedAction : PubSubAction {
|
||||
} args;
|
||||
};
|
||||
|
||||
struct TimeoutAction : PubSubAction {
|
||||
using PubSubAction::PubSubAction;
|
||||
|
||||
ActionUser target;
|
||||
|
||||
QString reason;
|
||||
uint32_t duration;
|
||||
};
|
||||
|
||||
struct BanAction : PubSubAction {
|
||||
using PubSubAction::PubSubAction;
|
||||
|
||||
ActionUser target;
|
||||
|
||||
QString reason;
|
||||
|
||||
uint32_t duration = 0;
|
||||
|
||||
bool isBan() const
|
||||
{
|
||||
return this->duration == 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct UnbanAction : PubSubAction {
|
||||
@@ -72,6 +70,11 @@ struct UnbanAction : PubSubAction {
|
||||
Banned,
|
||||
TimedOut,
|
||||
} previousState;
|
||||
|
||||
bool wasBan() const
|
||||
{
|
||||
return this->previousState == Banned;
|
||||
}
|
||||
};
|
||||
|
||||
struct ClearChatAction : PubSubAction {
|
||||
|
||||
@@ -300,7 +300,7 @@ PubSubManager::PubSubManager()
|
||||
};
|
||||
|
||||
this->moderationActionHandlers["timeout"] = [this](const auto &data, const auto &roomID) {
|
||||
TimeoutAction action(data, roomID);
|
||||
BanAction action(data, roomID);
|
||||
|
||||
getCreatedByUser(data, action.source);
|
||||
getTargetUser(data, action.target);
|
||||
@@ -329,7 +329,7 @@ PubSubManager::PubSubManager()
|
||||
}
|
||||
}
|
||||
|
||||
this->sig.moderation.userTimedOut.invoke(action);
|
||||
this->sig.moderation.userBanned.invoke(action);
|
||||
} catch (const std::runtime_error &ex) {
|
||||
debug::Log("Error parsing moderation action: {}", ex.what());
|
||||
}
|
||||
|
||||
@@ -102,7 +102,6 @@ public:
|
||||
Signal<ModeChangedAction> modeChanged;
|
||||
Signal<ModerationStateAction> moderationStateChanged;
|
||||
|
||||
Signal<TimeoutAction> userTimedOut;
|
||||
Signal<BanAction> userBanned;
|
||||
Signal<UnbanAction> userUnbanned;
|
||||
} moderation;
|
||||
|
||||
Reference in New Issue
Block a user