chore: unsingletonize UserDataController (#5459)
The `user-data.json` file will save immediately on change, and on exit (on dtor) if necessary. So we don't need to manually call save
This commit is contained in:
@@ -37,11 +37,6 @@ UserDataController::UserDataController(const Paths &paths)
|
||||
this->users = this->setting.getValue();
|
||||
}
|
||||
|
||||
void UserDataController::save()
|
||||
{
|
||||
this->sm->save();
|
||||
}
|
||||
|
||||
std::optional<UserData> UserDataController::getUser(const QString &userID) const
|
||||
{
|
||||
std::shared_lock lock(this->usersMutex);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/Singleton.hpp"
|
||||
#include "controllers/userdata/UserData.hpp"
|
||||
#include "util/QStringHash.hpp"
|
||||
#include "util/RapidjsonHelpers.hpp"
|
||||
@@ -30,7 +29,7 @@ public:
|
||||
const QString &colorString) = 0;
|
||||
};
|
||||
|
||||
class UserDataController : public IUserDataController, public Singleton
|
||||
class UserDataController : public IUserDataController
|
||||
{
|
||||
public:
|
||||
explicit UserDataController(const Paths &paths);
|
||||
@@ -43,9 +42,6 @@ public:
|
||||
void setUserColor(const QString &userID,
|
||||
const QString &colorString) override;
|
||||
|
||||
protected:
|
||||
void save() override;
|
||||
|
||||
private:
|
||||
void update(std::unordered_map<QString, UserData> &&newUsers);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user