From d561756d58613f51f1fc17237225b7a412c51f64 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Tue, 8 Dec 2020 22:09:59 +0200
Subject: [PATCH] SL-14497 Unblocking does not remove voice block

---
 indra/newview/llagent.cpp             |  2 +-
 indra/newview/llenvironment.cpp       |  2 +-
 indra/newview/llmutelist.cpp          |  2 ++
 indra/newview/lloutputmonitorctrl.cpp | 10 +++++++---
 indra/newview/lloutputmonitorctrl.h   |  3 ++-
 indra/newview/llwlhandlers.cpp        |  2 +-
 6 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 6e45cfad8ec..c65bc0fa50d 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -965,7 +965,7 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
             }
             else
             {
-                regionp->setCapabilitiesReceivedCallback([](LLUUID region_id) {LLAppViewer::instance()->updateNameLookupUrl(); });
+                regionp->setCapabilitiesReceivedCallback([](const LLUUID &region_id) {LLAppViewer::instance()->updateNameLookupUrl(); });
             }
 		}
 
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index a8780d6365a..74c1b99e4d3 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -1029,7 +1029,7 @@ void LLEnvironment::onRegionChange()
     }
     if (!cur_region->capabilitiesReceived())
     {
-        cur_region->setCapabilitiesReceivedCallback([](LLUUID region_id) {  LLEnvironment::instance().requestRegion(); });
+        cur_region->setCapabilitiesReceivedCallback([](const LLUUID &region_id) {  LLEnvironment::instance().requestRegion(); });
         return;
     }
     requestRegion();
diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp
index 8a10a38b377..f7ad28f9cdf 100644
--- a/indra/newview/llmutelist.cpp
+++ b/indra/newview/llmutelist.cpp
@@ -428,6 +428,7 @@ BOOL LLMuteList::remove(const LLMute& mute, U32 flags)
 		}
 		
 		// Must be after erase.
+		notifyObservers();
 		notifyObserversDetailed(localmute);
 	}
 	else
@@ -441,6 +442,7 @@ BOOL LLMuteList::remove(const LLMute& mute, U32 flags)
 			updateRemove(mute);
 			mLegacyMutes.erase(legacy_it);
 			// Must be after erase.
+			notifyObservers();
 			notifyObserversDetailed(mute);
 		}
 	}
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp
index e9fe493d7ec..7129641c20a 100644
--- a/indra/newview/lloutputmonitorctrl.cpp
+++ b/indra/newview/lloutputmonitorctrl.cpp
@@ -312,10 +312,14 @@ void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& s
 	}
 }
 
-void LLOutputMonitorCtrl::onChange()
+void LLOutputMonitorCtrl::onChangeDetailed(const LLMute& mute)
 {
-	// check only blocking on voice. EXT-3542
-	mIsMuted = LLMuteList::getInstance()->isMuted(mSpeakerId, LLMute::flagVoiceChat);
+    if (mute.mID == mSpeakerId)
+    {
+        // Check only blocking on voice.
+        // Logic goes in reverse, if flag is set, action is allowed
+        mIsMuted = !(LLMute::flagVoiceChat & mute.mFlags);
+    }
 }
 
 // virtual
diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h
index 98966d39ee0..e80745e1dfb 100644
--- a/indra/newview/lloutputmonitorctrl.h
+++ b/indra/newview/lloutputmonitorctrl.h
@@ -105,7 +105,8 @@ class LLOutputMonitorCtrl
 	void			setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id = LLUUID::null, bool show_other_participants_speaking = false);
 
 	//called by mute list
-	virtual void onChange();
+    virtual void onChange() {};
+	virtual void onChangeDetailed(const LLMute& mute);
 
 	/**
 	 * Implementation of LLSpeakingIndicator interface.
diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp
index 6b8374fd48c..730aa3774ff 100644
--- a/indra/newview/llwlhandlers.cpp
+++ b/indra/newview/llwlhandlers.cpp
@@ -51,7 +51,7 @@ bool LLEnvironmentRequest::initiate(LLEnvironment::environment_apply_fn cb)
 	if (!cur_region->capabilitiesReceived())
 	{
 		LL_INFOS("WindlightCaps") << "Deferring windlight settings request until we've got region caps" << LL_ENDL;
-        cur_region->setCapabilitiesReceivedCallback([cb](LLUUID region_id) { LLEnvironmentRequest::onRegionCapsReceived(region_id, cb); });
+        cur_region->setCapabilitiesReceivedCallback([cb](const LLUUID &region_id) { LLEnvironmentRequest::onRegionCapsReceived(region_id, cb); });
 		return false;
 	}
 
-- 
GitLab