fix: compare settings before updating them (#5240)

This commit is contained in:
pajlada 2024-03-09 16:03:26 +01:00 committed by GitHub
parent 2e77b47ea1
commit 2361d30e4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 4 deletions

View file

@ -75,6 +75,7 @@
- Bugfix: Fixed triple click on message also selecting moderation buttons. (#4961) - Bugfix: Fixed triple click on message also selecting moderation buttons. (#4961)
- Bugfix: Fixed a freeze from a bad regex in _Ignores_. (#4965, #5126) - Bugfix: Fixed a freeze from a bad regex in _Ignores_. (#4965, #5126)
- Bugfix: Fixed badge highlight changes not immediately being reflected. (#5110) - Bugfix: Fixed badge highlight changes not immediately being reflected. (#5110)
- Bugfix: Fixed emotes being reloaded when pressing "Cancel" in the settings dialog, causing a slowdown. (#5240)
- Bugfix: Fixed some emotes not appearing when using _Ignores_. (#4965, #5126) - Bugfix: Fixed some emotes not appearing when using _Ignores_. (#4965, #5126)
- Bugfix: Fixed lookahead/-behind not working in _Ignores_. (#4965, #5126) - Bugfix: Fixed lookahead/-behind not working in _Ignores_. (#4965, #5126)
- Bugfix: Fixed Image Uploader accidentally deleting images with some hosts when link resolver was enabled. (#4971) - Bugfix: Fixed Image Uploader accidentally deleting images with some hosts when link resolver was enabled. (#4971)

@ -1 +1 @@
Subproject commit 41ef7899b1cce35982f2dac600b2034375574f49 Subproject commit ceac9c7e97d2d2b97f40ecd0b421e358d7525cbc

View file

@ -13,13 +13,16 @@ class ChatterinoSetting : public pajlada::Settings::Setting<Type>
{ {
public: public:
ChatterinoSetting(const std::string &path) ChatterinoSetting(const std::string &path)
: pajlada::Settings::Setting<Type>(path) : pajlada::Settings::Setting<Type>(
path, pajlada::Settings::SettingOption::CompareBeforeSet)
{ {
_registerSetting(this->getData()); _registerSetting(this->getData());
} }
ChatterinoSetting(const std::string &path, const Type &defaultValue) ChatterinoSetting(const std::string &path, const Type &defaultValue)
: pajlada::Settings::Setting<Type>(path, defaultValue) : pajlada::Settings::Setting<Type>(
path, defaultValue,
pajlada::Settings::SettingOption::CompareBeforeSet)
{ {
_registerSetting(this->getData()); _registerSetting(this->getData());
} }

View file

@ -7,6 +7,11 @@ ChannelLog::ChannelLog(QString channelName)
{ {
} }
bool ChannelLog::operator==(const ChannelLog &other) const
{
return this->channelName_ == other.channelName_;
}
QString ChannelLog::channelName() const QString ChannelLog::channelName() const
{ {
return this->channelName_.toLower(); return this->channelName_.toLower();

View file

@ -9,6 +9,7 @@
#include "controllers/moderationactions/ModerationAction.hpp" #include "controllers/moderationactions/ModerationAction.hpp"
#include "controllers/nicknames/Nickname.hpp" #include "controllers/nicknames/Nickname.hpp"
#include "debug/Benchmark.hpp" #include "debug/Benchmark.hpp"
#include "pajlada/settings/signalargs.hpp"
#include "util/Clamp.hpp" #include "util/Clamp.hpp"
#include "util/PersistSignalVector.hpp" #include "util/PersistSignalVector.hpp"
#include "util/WindowsHelper.hpp" #include "util/WindowsHelper.hpp"
@ -257,7 +258,10 @@ void Settings::restoreSnapshot()
continue; continue;
} }
setting->marshalJSON(snapshot[path]); pajlada::Settings::SignalArgs args;
args.compareBeforeSet = true;
setting->marshalJSON(snapshot[path], std::move(args));
} }
} }