From a1eb7144f5e226264cb6bc9f3545456a8de3ec78 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Tue, 23 Sep 2025 21:47:11 +0300 Subject: SL-20598 Fix user not being able to reset display name --- indra/newview/llfloaterdisplayname.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloaterdisplayname.cpp') diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp index 236aadfbc1..4843a48e66 100644 --- a/indra/newview/llfloaterdisplayname.cpp +++ b/indra/newview/llfloaterdisplayname.cpp @@ -56,6 +56,7 @@ private: void onCacheSetName(bool success, const std::string& reason, const LLSD& content); + bool mIsLockedOut = false; }; LLFloaterDisplayName::LLFloaterDisplayName(const LLSD& key) : @@ -72,8 +73,8 @@ void LLFloaterDisplayName::onOpen(const LLSD& key) LLAvatarNameCache::get(gAgent.getID(), &av_name); F64 now_secs = LLDate::now().secondsSinceEpoch(); - - if (now_secs < av_name.mNextUpdate) + mIsLockedOut = now_secs < av_name.mNextUpdate; + if (mIsLockedOut) { // ...can't update until some time in the future F64 next_update_local_secs = @@ -167,18 +168,19 @@ void LLFloaterDisplayName::onReset() } getChild("display_name_editor")->setValue(av_name.getUserName()); - if (getChild("display_name_editor")->getEnabled()) + if (mIsLockedOut) { - // UI is enabled, fill the first field - getChild("display_name_confirm")->clear(); - getChild("display_name_confirm")->setFocus(true); + // UI is disabled. + // We should allow resetting even if user already + // set a display name, enable save button + getChild("display_name_confirm")->setValue(av_name.getUserName()); + getChild("save_btn")->setEnabled(true); } else { - // UI is disabled, looks like we should allow resetting - // even if user already set a display name, enable save button - getChild("display_name_confirm")->setValue(av_name.getUserName()); - getChild("save_btn")->setEnabled(true); + // UI is enabled, focus on the confirm field + getChild("display_name_confirm")->clear(); + getChild("display_name_confirm")->setFocus(true); } } -- cgit v1.2.3