summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authormaxim_productengine <mnikolenko@productengine.com>2019-07-08 13:47:21 +0300
committermaxim_productengine <mnikolenko@productengine.com>2019-07-08 13:47:21 +0300
commit38a0a95431a67a9fac924a372189b6c4364d5c5f (patch)
tree791ffb74fbc860443fced351e3976797506d6e45 /indra
parent139c66b684a463cea0d0d9420b3ba40a9ffb65a6 (diff)
SL-11554 [Legacy Profiles] The avatar permissions values are not saved/shown correctly in some cases
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llcallingcard.cpp1
-rw-r--r--indra/newview/llpanelprofile.cpp64
-rw-r--r--indra/newview/llpanelprofile.h6
3 files changed, 34 insertions, 37 deletions
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index 6d20b23e9f..89e2db9404 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -639,6 +639,7 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg)
if(mBuddyInfo.find(agent_related) != mBuddyInfo.end())
{
(mBuddyInfo[agent_related])->setRightsTo(new_rights);
+ mChangedBuddyIDs.insert(agent_related);
}
}
else
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 86b6163f45..2c07ff576d 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -1294,8 +1294,6 @@ BOOL LLPanelProfileNotes::postBuild()
mEditObjectRights = getChild<LLCheckBoxCtrl>("objects_check");
mNotesEditor = getChild<LLTextEditor>("notes_edit");
- mOnlineStatus->setCommitCallback(boost::bind(&LLPanelProfileNotes::onCommitRights, this));
- mMapRights->setCommitCallback(boost::bind(&LLPanelProfileNotes::onCommitRights, this));
mEditObjectRights->setCommitCallback(boost::bind(&LLPanelProfileNotes::onCommitRights, this));
mNotesEditor->setCommitCallback(boost::bind(&LLPanelProfileNotes::onCommitNotes,this));
@@ -1315,6 +1313,7 @@ void LLPanelProfileNotes::onOpen(const LLSD& key)
void LLPanelProfileNotes::apply()
{
onCommitNotes();
+ applyRights();
}
void LLPanelProfileNotes::fillRightsData()
@@ -1347,40 +1346,48 @@ void LLPanelProfileNotes::onCommitNotes()
}
void LLPanelProfileNotes::rightsConfirmationCallback(const LLSD& notification,
- const LLSD& response, S32 rights)
+ const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(getAvatarId(), rights);
- }
- else
+ if (option != 0)
{
mEditObjectRights->setValue(mEditObjectRights->getValue().asBoolean() ? FALSE : TRUE);
}
}
-void LLPanelProfileNotes::confirmModifyRights(bool grant, S32 rights)
+void LLPanelProfileNotes::confirmModifyRights(bool grant)
{
LLSD args;
args["NAME"] = LLSLURL("agent", getAvatarId(), "completename").getSLURLString();
- if (grant)
- {
- LLNotificationsUtil::add("GrantModifyRights", args, LLSD(),
- boost::bind(&LLPanelProfileNotes::rightsConfirmationCallback, this,
- _1, _2, rights));
- }
- else
- {
- LLNotificationsUtil::add("RevokeModifyRights", args, LLSD(),
- boost::bind(&LLPanelProfileNotes::rightsConfirmationCallback, this,
- _1, _2, rights));
- }
+
+ LLNotificationsUtil::add(grant ? "GrantModifyRights" : "RevokeModifyRights", args, LLSD(),
+ boost::bind(&LLPanelProfileNotes::rightsConfirmationCallback, this, _1, _2));
+
}
void LLPanelProfileNotes::onCommitRights()
{
+ const LLRelationship* buddy_relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
+
+ if (!buddy_relationship)
+ {
+ LL_WARNS("LegacyProfile") << "Trying to modify rights for non-friend avatar. Skipped." << LL_ENDL;
+ return;
+ }
+
+ bool allow_modify_objects = mEditObjectRights->getValue().asBoolean();
+
+ // if modify objects checkbox clicked
+ if (buddy_relationship->isRightGrantedTo(
+ LLRelationship::GRANT_MODIFY_OBJECTS) != allow_modify_objects)
+ {
+ confirmModifyRights(allow_modify_objects);
+ }
+}
+
+void LLPanelProfileNotes::applyRights()
+{
const LLRelationship* buddy_relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
if (!buddy_relationship)
@@ -1405,20 +1412,7 @@ void LLPanelProfileNotes::onCommitRights()
rights |= LLRelationship::GRANT_MODIFY_OBJECTS;
}
- bool allow_modify_objects = mEditObjectRights->getValue().asBoolean();
-
- // if modify objects checkbox clicked
- if (buddy_relationship->isRightGrantedTo(
- LLRelationship::GRANT_MODIFY_OBJECTS) != allow_modify_objects)
- {
- confirmModifyRights(allow_modify_objects, rights);
- }
- // only one checkbox can trigger commit, so store the rest of rights
- else
- {
- LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(
- getAvatarId(), rights);
- }
+ LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(getAvatarId(), rights);
}
void LLPanelProfileNotes::processProperties(void* data, EAvatarProcessorType type)
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index 9eeb926549..d4f9499894 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -371,12 +371,14 @@ protected:
*/
void fillRightsData();
- void rightsConfirmationCallback(const LLSD& notification, const LLSD& response, S32 rights);
- void confirmModifyRights(bool grant, S32 rights);
+ void rightsConfirmationCallback(const LLSD& notification, const LLSD& response);
+ void confirmModifyRights(bool grant);
void onCommitRights();
void onCommitNotes();
void enableCheckboxes(bool enable);
+ void applyRights();
+
LLCheckBoxCtrl* mOnlineStatus;
LLCheckBoxCtrl* mMapRights;
LLCheckBoxCtrl* mEditObjectRights;