Skip to content
Snippets Groups Projects
Commit aaf6c795 authored by Mnikolenko ProductEngine's avatar Mnikolenko ProductEngine
Browse files

MAINT-3374 FIXED Don't show username after display name if this setting is disabled.

parent 807383b3
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,7 @@ static const std::string DISPLAY_NAME_EXPIRES("display_name_expires");
static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update");
bool LLAvatarName::sUseDisplayNames = true;
bool LLAvatarName::sUseUsernames = true;
// Minimum time-to-live (in seconds) for a name entry.
// Avatar name should always guarantee to expire reasonably soon by default
......@@ -81,6 +82,16 @@ bool LLAvatarName::useDisplayNames()
return sUseDisplayNames;
}
void LLAvatarName::setUseUsernames(bool use)
{
sUseUsernames = use;
}
bool LLAvatarName::useUsernames()
{
return sUseUsernames;
}
LLSD LLAvatarName::asLLSD() const
{
LLSD sd;
......@@ -168,7 +179,11 @@ std::string LLAvatarName::getCompleteName() const
}
else
{
name = mDisplayName + " (" + mUsername + ")";
name = mDisplayName;
if(sUseUsernames)
{
name += " (" + mUsername + ")";
}
}
}
else
......
......@@ -54,6 +54,9 @@ class LL_COMMON_API LLAvatarName
static void setUseDisplayNames(bool use);
static bool useDisplayNames();
static void setUseUsernames(bool use);
static bool useUsernames();
// A name object is valid if not temporary and not yet expired (default is expiration not checked)
bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); }
......@@ -128,6 +131,9 @@ class LL_COMMON_API LLAvatarName
// Global flag indicating if display name should be used or not
// This will affect the output of the high level "get" methods
static bool sUseDisplayNames;
// Flag indicating if username should be shown after display name or not
static bool sUseUsernames;
};
#endif
......@@ -680,6 +680,15 @@ void LLAvatarNameCache::setUseDisplayNames(bool use)
}
}
void LLAvatarNameCache::setUseUsernames(bool use)
{
if (use != LLAvatarName::useUsernames())
{
LLAvatarName::setUseUsernames(use);
mUseDisplayNamesSignal();
}
}
void LLAvatarNameCache::erase(const LLUUID& agent_id)
{
sCache.erase(agent_id);
......
......@@ -80,6 +80,8 @@ namespace LLAvatarNameCache
// Set display name: flips the switch and triggers the callbacks.
void setUseDisplayNames(bool use);
void setUseUsernames(bool use);
void insert(const LLUUID& agent_id, const LLAvatarName& av_name);
void erase(const LLUUID& agent_id);
......
......@@ -238,6 +238,7 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response
void handleNameTagOptionChanged(const LLSD& newvalue)
{
LLAvatarNameCache::setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames"));
LLVOAvatar::invalidateNameTags();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment