Skip to content
Snippets Groups Projects
Commit d5d9668a authored by Paul Guslisty's avatar Paul Guslisty
Browse files

Fixed low bug EXT-6488 (Teleport menuitem is enabled for offline residents in...

Fixed low bug EXT-6488 (Teleport menuitem is enabled for offline residents in the context menu and inspectors)

- Added a check for a teleport offer ability. In XML created a paremeter and check it in source code.

Reviewed by Leyla Farazha at https://codereview.productengine.com/secondlife/r/86/

--HG--
branch : product-engine
parent 7fa6e0ad
No related branches found
No related tags found
No related merge requests found
......@@ -442,6 +442,20 @@ void LLAvatarActions::toggleBlock(const LLUUID& id)
LLMuteList::getInstance()->add(mute);
}
}
// static
bool LLAvatarActions::canOfferTeleport(const LLUUID& id)
{
// First use LLAvatarTracker::isBuddy()
// If LLAvatarTracker::instance().isBuddyOnline function only is used
// then for avatars that are online and not a friend it will return false.
// But we should give an ability to offer a teleport for such avatars.
if(LLAvatarTracker::instance().isBuddy(id))
{
return LLAvatarTracker::instance().isBuddyOnline(id);
}
return true;
}
void LLAvatarActions::inviteToGroup(const LLUUID& id)
{
......
......@@ -171,6 +171,12 @@ class LLAvatarActions
*/
static void csr(const LLUUID& id, std::string name);
/**
* Checks whether can offer teleport to the avatar
* Can't offer only for offline friends
*/
static bool canOfferTeleport(const LLUUID& id);
private:
static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
......
......@@ -137,6 +137,7 @@ class LLInspectAvatar : public LLInspect, LLTransientFloater
void onVolumeChange(const LLSD& data);
bool enableMute();
bool enableUnmute();
bool enableTeleportOffer();
// Is used to determine if "Add friend" option should be enabled in gear menu
bool isNotFriend();
......@@ -235,6 +236,7 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
boost::bind(&LLInspectAvatar::onVisibleZoomIn, this));
mEnableCallbackRegistrar.add("InspectAvatar.Gear.Enable", boost::bind(&LLInspectAvatar::isNotFriend, this));
mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableCall", boost::bind(&LLAvatarActions::canCall));
mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableTeleportOffer", boost::bind(&LLInspectAvatar::enableTeleportOffer, this));
mEnableCallbackRegistrar.add("InspectAvatar.EnableMute", boost::bind(&LLInspectAvatar::enableMute, this));
mEnableCallbackRegistrar.add("InspectAvatar.EnableUnmute", boost::bind(&LLInspectAvatar::enableUnmute, this));
......@@ -764,6 +766,11 @@ bool LLInspectAvatar::enableUnmute()
}
}
bool LLInspectAvatar::enableTeleportOffer()
{
return LLAvatarActions::canOfferTeleport(mAvatarID);
}
//////////////////////////////////////////////////////////////////////////////
// LLInspectAvatarUtil
//////////////////////////////////////////////////////////////////////////////
......
......@@ -226,6 +226,11 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata)
return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id))
|| gAgent.isGodlike();
}
else if(item == std::string("can_offer_teleport"))
{
const LLUUID& id = mUUIDs.front();
return LLAvatarActions::canOfferTeleport(id);
}
return false;
}
......
......@@ -40,6 +40,8 @@
name="teleport">
<menu_item_call.on_click
function="InspectAvatar.Teleport"/>
<menu_item_call.on_enable
function="InspectAvatar.Gear.EnableTeleportOffer"/>
</menu_item_call>
<menu_item_call
label="Invite to Group"
......
......@@ -88,5 +88,8 @@
name="teleport">
<menu_item_call.on_click
function="Avatar.OfferTeleport"/>
<menu_item_call.on_enable
function="Avatar.EnableItem"
parameter="can_offer_teleport"/>
</menu_item_call>
</context_menu>
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