From 023a69720876eaec0135b8536e1945db95336a36 Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Mon, 3 Jun 2019 17:19:05 +0300
Subject: [PATCH] SL-11344 FIXED Private notes are not saved for another avatar

---
 indra/newview/llfloaterprofile.cpp | 12 +-----------
 indra/newview/llpanelprofile.cpp   | 22 ++++++++++++++++------
 indra/newview/llpanelprofile.h     |  3 +++
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/indra/newview/llfloaterprofile.cpp b/indra/newview/llfloaterprofile.cpp
index 216bcb0580f..f2863e1e27e 100644
--- a/indra/newview/llfloaterprofile.cpp
+++ b/indra/newview/llfloaterprofile.cpp
@@ -54,12 +54,6 @@ void LLFloaterProfile::onOpen(const LLSD& key)
 {
     mPanelProfile->onOpen(key);
 
-    if (mAvatarId == gAgentID)
-    {
-        getChild<LLUICtrl>("ok_btn")->setVisible(TRUE);
-        getChild<LLUICtrl>("cancel_btn")->setVisible(TRUE);
-    }
-
     // Update the avatar name.
     mNameCallbackConnection = LLAvatarNameCache::get(mAvatarId, boost::bind(&LLFloaterProfile::onAvatarNameCache, this, _1, _2));
 }
@@ -91,11 +85,7 @@ void LLFloaterProfile::showClassified(const LLUUID& classified_id, bool edit)
 
 void LLFloaterProfile::onOKBtn()
 {
-    if (mAvatarId == gAgentID)
-    {
-        mPanelProfile->apply();
-    }
-
+    mPanelProfile->apply();
     closeFloater();
 }
 
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 6c0b1b90470..a60493a3609 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -1514,6 +1514,13 @@ void LLPanelProfile::onTabChange()
     {
         active_panel->updateData();
     }
+    updateBtnsVisibility();
+}
+
+void LLPanelProfile::updateBtnsVisibility()
+{
+    getChild<LLUICtrl>("ok_btn")->setVisible(((getSelfProfile() && !getEmbedded()) || isNotesTabSelected()));
+    getChild<LLUICtrl>("cancel_btn")->setVisible(((getSelfProfile() && !getEmbedded()) || isNotesTabSelected()));
 }
 
 void LLPanelProfile::onOpen(const LLSD& key)
@@ -1557,12 +1564,7 @@ void LLPanelProfile::onOpen(const LLSD& key)
     resetLoading();
     updateData();
 
-    // Only show commit buttons on own profile on floater version
-    if (getSelfProfile() && !getEmbedded())
-    {
-        getChild<LLUICtrl>("ok_btn")->setVisible(TRUE);
-        getChild<LLUICtrl>("cancel_btn")->setVisible(TRUE);
-    }
+    updateBtnsVisibility();
 
     // KC - Not handling pick and classified opening thru onOpen
     // because this would make unique profile floaters per slurl
@@ -1597,6 +1599,10 @@ void LLPanelProfile::apply()
 
         //KC - Classifieds handles this itself
     }
+    else
+    {
+        mPanelNotes->apply();
+    }
 }
 
 void LLPanelProfile::showPick(const LLUUID& pick_id)
@@ -1613,6 +1619,10 @@ bool LLPanelProfile::isPickTabSelected()
 	return (mTabContainer->getCurrentPanel() == mPanelPicks);
 }
 
+bool LLPanelProfile::isNotesTabSelected()
+{
+	return (mTabContainer->getCurrentPanel() == mPanelNotes);
+}
 
 void LLPanelProfile::showClassified(const LLUUID& classified_id, bool edit)
 {
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index 7d22b64dbec..9eeb926549b 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -409,6 +409,9 @@ class LLPanelProfile
 
     void showPick(const LLUUID& pick_id = LLUUID::null);
     bool isPickTabSelected();
+    bool isNotesTabSelected();
+
+    void updateBtnsVisibility();
 
     void showClassified(const LLUUID& classified_id = LLUUID::null, bool edit = false);
 
-- 
GitLab