Increase max number of blocked users loaded from 100 to 1,000 (#4721)
Also includes a little refactor of how the requests are made & how the blocked users are stored
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include "common/UniqueAccess.hpp"
|
||||
#include "controllers/accounts/Account.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
#include "providers/twitch/TwitchUser.hpp"
|
||||
#include "util/CancellationToken.hpp"
|
||||
#include "util/QStringHash.hpp"
|
||||
|
||||
#include <QColor>
|
||||
@@ -15,12 +17,11 @@
|
||||
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
struct TwitchUser;
|
||||
class Channel;
|
||||
using ChannelPtr = std::shared_ptr<Channel>;
|
||||
|
||||
@@ -72,15 +73,15 @@ public:
|
||||
bool isAnon() const;
|
||||
|
||||
void loadBlocks();
|
||||
void blockUser(QString userId, const QObject *caller,
|
||||
void blockUser(const QString &userId, const QObject *caller,
|
||||
std::function<void()> onSuccess,
|
||||
std::function<void()> onFailure);
|
||||
void unblockUser(QString userId, const QObject *caller,
|
||||
void unblockUser(const QString &userId, const QObject *caller,
|
||||
std::function<void()> onSuccess,
|
||||
std::function<void()> onFailure);
|
||||
|
||||
SharedAccessGuard<const std::set<QString>> accessBlockedUserIds() const;
|
||||
SharedAccessGuard<const std::set<TwitchUser>> accessBlocks() const;
|
||||
[[nodiscard]] const std::unordered_set<TwitchUser> &blocks() const;
|
||||
[[nodiscard]] const std::unordered_set<QString> &blockedUserIds() const;
|
||||
|
||||
void loadEmotes(std::weak_ptr<Channel> weakChannel = {});
|
||||
// loadUserstateEmotes loads emote sets that are part of the USERSTATE emote-sets key
|
||||
@@ -105,10 +106,11 @@ private:
|
||||
const bool isAnon_;
|
||||
Atomic<QColor> color_;
|
||||
|
||||
mutable std::mutex ignoresMutex_;
|
||||
QStringList userstateEmoteSets_;
|
||||
UniqueAccess<std::set<TwitchUser>> ignores_;
|
||||
UniqueAccess<std::set<QString>> ignoresUserIds_;
|
||||
|
||||
ScopedCancellationToken blockToken_;
|
||||
std::unordered_set<TwitchUser> ignores_;
|
||||
std::unordered_set<QString> ignoresUserIds_;
|
||||
|
||||
// std::map<UserId, TwitchAccountEmoteData> emotes;
|
||||
UniqueAccess<TwitchAccountEmoteData> emotes_;
|
||||
|
||||
Reference in New Issue
Block a user