fix: update currently-selected username on username update (#6739)

Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
SonicSegFault
2026-01-16 08:34:36 -05:00
committed by GitHub
parent 31ef6eeddf
commit f4f49742c1
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -44,7 +44,7 @@
- Bugfix: Fixed <kbd>CMD</kbd> + <kbd>DELETE</kbd> 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)
@@ -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<TwitchAccount> &account)
login.compare(account->getUserName(), Qt::CaseInsensitive) != 0)
{
account->setUserName(login);
const std::string basePath =
"/accounts/uid" + account->getUserId().toStdString();
pajlada::Settings::Setting<QString>::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();
}