diff --git a/CHANGELOG.md b/CHANGELOG.md index bc8ddc2c..90753e23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,7 @@ - Bugfix: Fixed CMD + DELETE behavior in the user notes editing dialog for macOS. (#6676) - Bugfix: Fixed a potential crash when closing Chatterino with a slow network connection. (#6645) - Bugfix: Disable "Sort Tabs Alphabetically" action when notebook layout is locked. (#6710) -- Bugfix: Fix highlight mentions not updating when username changes. (#6723) +- Bugfix: Fix highlight mentions not updating when username changes. (#6723, #6739) - Bugfix: Fixed Return and Enter being treated as different keys on Mac OS. (#6726) - Dev: Update release documentation. (#6498) - Dev: Make code sanitizers opt in with the `CHATTERINO_SANITIZER_SUPPORT` CMake option. After that's enabled, use the `SANITIZE_*` flag to enable individual sanitizers. (#6493) diff --git a/src/providers/twitch/TwitchAccountManager.cpp b/src/providers/twitch/TwitchAccountManager.cpp index 1efeeff9..c2ae98ce 100644 --- a/src/providers/twitch/TwitchAccountManager.cpp +++ b/src/providers/twitch/TwitchAccountManager.cpp @@ -17,6 +17,7 @@ #include "providers/twitch/TwitchCommon.hpp" #include "providers/twitch/TwitchIrcServer.hpp" #include "providers/twitch/TwitchUser.hpp" +#include "singletons/Settings.hpp" #include "util/QCompareTransparent.hpp" #include "util/SharedPtrElementLess.hpp" @@ -71,6 +72,18 @@ void checkMissingScopes(const std::shared_ptr &account) login.compare(account->getUserName(), Qt::CaseInsensitive) != 0) { account->setUserName(login); + const std::string basePath = + "/accounts/uid" + account->getUserId().toStdString(); + pajlada::Settings::Setting::set(basePath + "/username", + login); + auto &manager = app->getAccounts()->twitch; + auto currentUsername = manager.getCurrent()->getUserName(); + if (currentUsername.compare(manager.currentUsername.getValue(), + Qt::CaseInsensitive) != 0) + { + manager.currentUsername = currentUsername; + } + getSettings()->requestSave(); app->getAccounts()->twitch.currentUserNameChanged.invoke(); }