fix: don't include blocked users in join/part messages (#6181)
This commit is contained in:
@@ -117,6 +117,7 @@ void TwitchAccount::loadBlocks()
|
||||
this->blockToken_ = token;
|
||||
this->ignores_.clear();
|
||||
this->ignoresUserIds_.clear();
|
||||
this->ignoresUserLogins_.clear();
|
||||
|
||||
getHelix()->loadBlocks(
|
||||
getApp()->getAccounts()->twitch.getCurrent()->userId_,
|
||||
@@ -129,6 +130,7 @@ void TwitchAccount::loadBlocks()
|
||||
blockedUser.fromHelixBlock(block);
|
||||
this->ignores_.insert(blockedUser);
|
||||
this->ignoresUserIds_.insert(blockedUser.id);
|
||||
this->ignoresUserLogins_.insert(blockedUser.name);
|
||||
}
|
||||
},
|
||||
[](auto error) {
|
||||
@@ -138,51 +140,60 @@ void TwitchAccount::loadBlocks()
|
||||
std::move(token));
|
||||
}
|
||||
|
||||
void TwitchAccount::blockUser(const QString &userId, const QObject *caller,
|
||||
void TwitchAccount::blockUser(const QString &userId, const QString &userLogin,
|
||||
const QObject *caller,
|
||||
std::function<void()> onSuccess,
|
||||
std::function<void()> onFailure)
|
||||
{
|
||||
getHelix()->blockUser(
|
||||
userId, caller,
|
||||
[this, userId, onSuccess = std::move(onSuccess)] {
|
||||
[this, userId, userLogin, onSuccess = std::move(onSuccess)] {
|
||||
assertInGuiThread();
|
||||
|
||||
TwitchUser blockedUser;
|
||||
blockedUser.id = userId;
|
||||
blockedUser.name = userLogin;
|
||||
this->ignores_.insert(blockedUser);
|
||||
this->ignoresUserIds_.insert(blockedUser.id);
|
||||
this->ignoresUserLogins_.insert(blockedUser.name);
|
||||
onSuccess();
|
||||
},
|
||||
std::move(onFailure));
|
||||
}
|
||||
|
||||
void TwitchAccount::unblockUser(const QString &userId, const QObject *caller,
|
||||
void TwitchAccount::unblockUser(const QString &userId, const QString &userLogin,
|
||||
const QObject *caller,
|
||||
std::function<void()> onSuccess,
|
||||
std::function<void()> onFailure)
|
||||
{
|
||||
getHelix()->unblockUser(
|
||||
userId, caller,
|
||||
[this, userId, onSuccess = std::move(onSuccess)] {
|
||||
[this, userId, userLogin, onSuccess = std::move(onSuccess)] {
|
||||
assertInGuiThread();
|
||||
|
||||
TwitchUser ignoredUser;
|
||||
ignoredUser.id = userId;
|
||||
ignoredUser.name = userLogin;
|
||||
this->ignores_.erase(ignoredUser);
|
||||
this->ignoresUserIds_.erase(ignoredUser.id);
|
||||
this->ignoresUserLogins_.erase(ignoredUser.name);
|
||||
onSuccess();
|
||||
},
|
||||
std::move(onFailure));
|
||||
}
|
||||
|
||||
void TwitchAccount::blockUserLocally(const QString &userID)
|
||||
void TwitchAccount::blockUserLocally(const QString &userID,
|
||||
const QString &userLogin)
|
||||
{
|
||||
assertInGuiThread();
|
||||
assert(getApp()->isTest());
|
||||
|
||||
TwitchUser blockedUser;
|
||||
blockedUser.id = userID;
|
||||
blockedUser.name = userLogin;
|
||||
this->ignores_.insert(blockedUser);
|
||||
this->ignoresUserIds_.insert(blockedUser.id);
|
||||
this->ignoresUserLogins_.insert(blockedUser.name);
|
||||
}
|
||||
|
||||
const std::unordered_set<TwitchUser> &TwitchAccount::blocks() const
|
||||
@@ -197,6 +208,12 @@ const std::unordered_set<QString> &TwitchAccount::blockedUserIds() const
|
||||
return this->ignoresUserIds_;
|
||||
}
|
||||
|
||||
const std::unordered_set<QString> &TwitchAccount::blockedUserLogins() const
|
||||
{
|
||||
assertInGuiThread();
|
||||
return this->ignoresUserLogins_;
|
||||
}
|
||||
|
||||
// AutoModActions
|
||||
void TwitchAccount::autoModAllow(const QString msgID, ChannelPtr channel)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user