summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Guslisty <pguslisty@productengine.com>2010-03-25 09:04:01 +0200
committerPaul Guslisty <pguslisty@productengine.com>2010-03-25 09:04:01 +0200
commitd5d9668a59895874951fb3e5927ea0159270a6e8 (patch)
tree399972f600e972976bc08982b7024d76c6c4e435
parent7fa6e0ad6c7a916b45ca1ff7f6603ca2a5726a97 (diff)
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
-rw-r--r--indra/newview/llavataractions.cpp14
-rw-r--r--indra/newview/llavataractions.h6
-rw-r--r--indra/newview/llinspectavatar.cpp7
-rw-r--r--indra/newview/llpanelpeoplemenus.cpp5
-rw-r--r--indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml2
-rw-r--r--indra/newview/skins/default/xui/en/menu_people_nearby.xml3
6 files changed, 37 insertions, 0 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index cb518f0ad6..699916b0d6 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -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)
{
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index a7f3acad4f..9adf6efec7 100644
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -171,6 +171,12 @@ public:
*/
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);
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 35cb9b3468..94ea236757 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -137,6 +137,7 @@ private:
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
//////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index 854651cd01..313ed4b70e 100644
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -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;
}
diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
index 1b002b1c32..a5ac5f76e1 100644
--- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
@@ -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"
diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby.xml b/indra/newview/skins/default/xui/en/menu_people_nearby.xml
index 014a52bb4f..d2e35e4cc0 100644
--- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml
@@ -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>