From 4fa3e33c4df9ed4e225ee0a089232e83bce8ce5e Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Tue, 2 Jun 2015 13:15:31 +0300
Subject: [PATCH] MAINT-2007 FIXED Restored the code for ejecting confirmation.
 Confirmation on banning was added.

---
 indra/newview/llpanelgrouproles.cpp           | 84 ++++++++++++++++++-
 indra/newview/llpanelgrouproles.h             |  3 +
 .../skins/default/xui/en/notifications.xml    | 27 ++++++
 3 files changed, 112 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index 2b71fd5ecef..2b7028827b3 100755
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -1155,7 +1155,37 @@ void LLPanelGroupMembersSubTab::onEjectMembers(void *userdata)
 
 	if ( selfp )
 	{
-		selfp->handleEjectMembers();
+		selfp->confirmEjectMembers();
+	}
+}
+
+void LLPanelGroupMembersSubTab::confirmEjectMembers()
+{
+	std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
+	if (selection.empty()) return;
+
+	S32 selection_count = selection.size();
+	if (selection_count == 1)
+	{
+		LLSD args;
+		std::string fullname;
+		gCacheName->getFullName(mMembersList->getValue(), fullname);
+		args["AVATAR_NAME"] = fullname;
+		LLSD payload;
+		LLNotificationsUtil::add("EjectGroupMemberWarning",
+				 	 	 	 	 args,
+								 payload,
+								 boost::bind(&LLPanelGroupMembersSubTab::handleEjectCallback, this, _1, _2));
+	}
+	else
+	{
+		LLSD args;
+		args["COUNT"] = llformat("%d", selection_count);
+		LLSD payload;
+		LLNotificationsUtil::add("EjectGroupMembersWarning",
+				 	 	 	 	 args,
+								 payload,
+								 boost::bind(&LLPanelGroupMembersSubTab::handleEjectCallback, this, _1, _2));
 	}
 }
 
@@ -1182,6 +1212,16 @@ void LLPanelGroupMembersSubTab::handleEjectMembers()
 	LLGroupMgr::getInstance()->sendGroupMemberEjects(mGroupID, selected_members);
 }
 
+bool LLPanelGroupMembersSubTab::handleEjectCallback(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	if (0 == option) // Eject button
+	{
+		handleEjectMembers();
+	}
+	return false;
+}
+
 void LLPanelGroupMembersSubTab::sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members)
 {
 	LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id);
@@ -1804,7 +1844,47 @@ void LLPanelGroupMembersSubTab::updateMembers()
 void LLPanelGroupMembersSubTab::onBanMember(void* user_data)
 {
 	LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
-	self->handleBanMember();
+	self->confirmBanMembers();
+}
+
+void LLPanelGroupMembersSubTab::confirmBanMembers()
+{
+	std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
+	if (selection.empty()) return;
+
+	S32 selection_count = selection.size();
+	if (selection_count == 1)
+	{
+		LLSD args;
+		std::string fullname;
+		gCacheName->getFullName(mMembersList->getValue(), fullname);
+		args["AVATAR_NAME"] = fullname;
+		LLSD payload;
+		LLNotificationsUtil::add("BanGroupMemberWarning",
+				 	 	 	 	 args,
+								 payload,
+								 boost::bind(&LLPanelGroupMembersSubTab::handleBanCallback, this, _1, _2));
+	}
+	else
+	{
+		LLSD args;
+		args["COUNT"] = llformat("%d", selection_count);
+		LLSD payload;
+		LLNotificationsUtil::add("BanGroupMembersWarning",
+				 	 	 	 	 args,
+								 payload,
+								 boost::bind(&LLPanelGroupMembersSubTab::handleBanCallback, this, _1, _2));
+	}
+}
+
+bool LLPanelGroupMembersSubTab::handleBanCallback(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	if (0 == option) // Eject button
+	{
+		handleBanMember();
+	}
+	return false;
 }
 
 void LLPanelGroupMembersSubTab::handleBanMember()
diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h
index 540b24ada64..9a696124a8c 100755
--- a/indra/newview/llpanelgrouproles.h
+++ b/indra/newview/llpanelgrouproles.h
@@ -171,6 +171,7 @@ class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab
 	void handleEjectMembers();
 	void sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members);
 	bool handleEjectCallback(const LLSD& notification, const LLSD& response);
+	void confirmEjectMembers();
 
 	static void onRoleCheck(LLUICtrl* check, void* user_data);
 	void handleRoleCheck(const LLUUID& role_id,
@@ -178,6 +179,8 @@ class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab
 
 	static void onBanMember(void* user_data);
 	void handleBanMember();
+	bool handleBanCallback(const LLSD& notification, const LLSD& response);
+	void confirmBanMembers();
 
 
 	void applyMemberChanges();
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 97d1fd0c0f2..554afaf3863 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -577,6 +577,33 @@ If you no longer wish to have these abilities granted to this role, disable them
       notext="Cancel"
       yestext="Eject"/>
   </notification>
+  
+  <notification
+    icon="alertmodal.tga"
+    name="BanGroupMemberWarning"
+    type="alertmodal">
+     You are about to ban [AVATAR_NAME] from the group.
+     <tag>group</tag>
+     <tag>confirm</tag>
+     <usetemplate
+      ignoretext="Confirm banning a participant from group"
+      name="okcancelignore"
+      notext="Cancel"
+      yestext="Ban"/>
+  </notification>
+  <notification
+    icon="alertmodal.tga"
+    name="BanGroupMembersWarning"
+    type="alertmodal">
+     You are about to ban [COUNT] members from group.
+     <tag>group</tag>
+     <tag>confirm</tag>
+     <usetemplate
+      ignoretext="Confirm banning multiple members from group"
+      name="okcancelignore"
+      notext="Cancel"
+      yestext="Ban"/>
+  </notification>
 
   <notification
    icon="alertmodal.tga"
-- 
GitLab