Workaround for broken participant list: always show group moderation tools regardless of user permissions, change toggle mute chat to explicit mute and unmute so accidents can no longer happen

master
Zi Ree 2021-06-08 15:37:16 +02:00
parent 64b65c3719
commit a52eff1b89
10 changed files with 205 additions and 26 deletions

View File

@ -2153,6 +2153,14 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
registrar.add("FS.LeaveGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupleave", true));
registrar.add("FS.ActivateGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupactivate", true));
// hook up moderation tools
// if someone knows how to pass a parameter to these, let me know! - Zi
// also, I wish I could pass the group session id through these calls, but LLTextBase does not know it - Zi
registrar.add("FS.AllowGroupChat", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupchatallow", true));
registrar.add("FS.ForbidGroupChat", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupchatforbid", true));
registrar.add("FS.EjectGroupMember", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupeject", true));
registrar.add("FS.BanGroupMember", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupban", true));
enable_registrar.add("FS.WaitingForGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA));
enable_registrar.add("FS.HaveGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_HAVE_GROUP_DATA));
enable_registrar.add("FS.EnableJoinGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_CAN_JOIN_GROUP));
@ -2200,6 +2208,16 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
unblockButton->setVisible(is_blocked);
}
}
// <FS:Zi> hide the moderation tools in the context menu unless we are in a group IM floater
LLFloater* parent_floater = getParentByType<LLFloater>();
if (!parent_floater || parent_floater->getName() != "panel_im")
{
menu->getChild<LLView>("GroupModerationSubmenu")->setVisible(false);
menu->getChild<LLView>("GroupModerationSeparator")->setVisible(false);
}
// </FS:Zi>
menu->show(x, y);
LLMenuGL::showPopup(this, menu, x, y);
}

View File

@ -459,10 +459,15 @@ public:
{
LLAvatarActions::toggleMute(getAvatarId(), LLMute::flagTextChat);
}
else if (param == "toggle_allow_text_chat")
else if (param == "allow_text_chat")
{
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
speaker_mgr->toggleAllowTextChat(getAvatarId());
speaker_mgr->allowTextChat(getAvatarId(), true);
}
else if (param == "forbid_text_chat")
{
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
speaker_mgr->allowTextChat(getAvatarId(), false);
}
else if (param == "group_mute")
{
@ -482,7 +487,15 @@ public:
}
else if (param == "ban_member")
{
banGroupMember(getAvatarId());
// <FS:Zi> don't do safety checks as participant list is broken, just ban
// banGroupMember(getAvatarId());
std::vector<LLUUID> ids;
ids.push_back(getAvatarId());
LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mSessionID, LLGroupMgr::BAN_CREATE, ids);
LLGroupMgr::getInstance()->sendGroupMemberEjects(mSessionID, ids);
LLGroupMgr::getInstance()->sendGroupMembersRequest(mSessionID);
// </FS:Zi>
}
}

View File

@ -703,7 +703,7 @@ LLContextMenu* FSParticipantList::FSParticipantListMenu::createMenu()
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
registrar.add("ParticipantList.Sort", boost::bind(&FSParticipantList::FSParticipantListMenu::sortParticipantList, this, _2));
registrar.add("ParticipantList.ToggleAllowTextChat", boost::bind(&FSParticipantList::FSParticipantListMenu::toggleAllowTextChat, this, _2));
registrar.add("ParticipantList.AllowTextChat", boost::bind(&FSParticipantList::FSParticipantListMenu::allowTextChat, this, _2));
registrar.add("ParticipantList.ToggleMuteText", boost::bind(&FSParticipantList::FSParticipantListMenu::toggleMuteText, this, _2));
// [SL:KB] - Patch: Chat-GroupSessionEject | Checked: 2012-02-04 (Catznip-3.2.1) | Added: Catznip-3.2.1
registrar.add("ParticipantList.Eject", boost::bind(&LLGroupActions::ejectFromGroup, mParent.mSpeakerMgr->getSessionID(), mUUIDs.front()));
@ -780,14 +780,13 @@ void FSParticipantList::FSParticipantListMenu::sortParticipantList(const LLSD& u
}
}
void FSParticipantList::FSParticipantListMenu::toggleAllowTextChat(const LLSD& userdata)
void FSParticipantList::FSParticipantListMenu::allowTextChat(const LLSD& userdata)
{
LLIMSpeakerMgr* mgr = dynamic_cast<LLIMSpeakerMgr*>(mParent.mSpeakerMgr);
if (mgr)
{
const LLUUID speaker_id = mUUIDs.front();
mgr->toggleAllowTextChat(speaker_id);
mgr->allowTextChat(speaker_id, userdata.asString() == "allow");
}
}

View File

@ -179,7 +179,7 @@ protected:
bool checkContextMenuItem(const LLSD& userdata);
void sortParticipantList(const LLSD& userdata);
void toggleAllowTextChat(const LLSD& userdata);
void allowTextChat(const LLSD& userdata);
void toggleMute(const LLSD& userdata, U32 flags);
void toggleMuteText(const LLSD& userdata);
void toggleMuteVoice(const LLSD& userdata);

View File

@ -32,9 +32,13 @@
#include "llcommandhandler.h"
#include "llfloatersettingsdebug.h"
#include "llgroupactions.h"
#include "llgroupmgr.h"
#include "lllogchat.h"
#include "llnotificationsutil.h"
#include "llspeakers.h"
#include "fsfloaterimcontainer.h"
#include "fsfloaterim.h"
class FSSlurlCommandHandler : public LLCommandHandler
{
@ -138,19 +142,101 @@ public:
if (verb == "groupjoin")
{
LLGroupActions::join(LLUUID(target_id));
LLGroupActions::join(target_id);
return true;
}
if (verb == "groupleave")
{
LLGroupActions::leave(LLUUID(target_id));
LLGroupActions::leave(target_id);
return true;
}
if (verb == "groupactivate")
{
LLGroupActions::activate(LLUUID(target_id));
LLGroupActions::activate(target_id);
return true;
}
// please someone tell me there is an easier way to get the group UUID of the
// currently focused group, or transfer the UUID through the context menu somehow - Zi
LLFloater* focused_floater = gFloaterView->getFocusedFloater();
FSFloaterIM* floater_im;
// let's guess that the user has tabbed IMs
FSFloaterIMContainer* floater_container = dynamic_cast<FSFloaterIMContainer*>(focused_floater);
if (floater_container)
{
// get the active sub-floater inside the tabbed IMs
floater_im = dynamic_cast<FSFloaterIM*>(floater_container->getActiveFloater());
}
else
{
// no tabbed IMs or torn-off group floater, try if this is already what we wanted
floater_im = dynamic_cast<FSFloaterIM*>(focused_floater);
}
// still not an IM floater, give up
if (!floater_im)
{
return true;
}
// get the group's UUID
LLUUID group_id = floater_im->getKey();
// is this actually a valid IM session?
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(group_id);
if (!session)
{
return true;
}
// is this actually a valid group IM session?
if (!session->isGroupSessionType())
{
return true;
}
// finally! let's see what we came here to do
if (verb == "groupchatallow")
{
// no safety checks, just allow
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(group_id);
speaker_mgr->allowTextChat(target_id, true);
return true;
}
if (verb == "groupchatforbid")
{
// no safety checks, just mute
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(group_id);
speaker_mgr->allowTextChat(target_id, false);
return true;
}
if (verb == "groupeject")
{
// no safety checks, just eject
LLGroupActions::ejectFromGroup(group_id, target_id);
return true;
}
if (verb == "groupban")
{
std::vector<LLUUID> ids;
ids.push_back(target_id);
// no safety checks, just ban
LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, group_id, LLGroupMgr::BAN_CREATE, ids);
LLGroupMgr::getInstance()->sendGroupMemberEjects(group_id, ids);
LLGroupMgr::getInstance()->sendGroupMembersRequest(group_id);
return true;
}

View File

@ -819,10 +819,15 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
}
}
void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id)
// <FS:Zi> make text chat block in groups not a toggle to prevent accidental unmuting
// void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id)
void LLIMSpeakerMgr::allowTextChat(const LLUUID& speaker_id, bool allow)
{
LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id);
if (!speakerp) return;
// <FS:Zi> Don't test for presence in the group participants list, as the list
// is unreliable and this leads to situations where people can't be
// chat muted at all anymore
// LLPointer<LLSpeaker> speakerp = findSpeaker(speaker_id);
// if (!speakerp) return;
std::string url = gAgent.getRegionCapability("ChatSessionRequest");
LLSD data;
@ -831,8 +836,10 @@ void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id)
data["params"] = LLSD::emptyMap();
data["params"]["agent_id"] = speaker_id;
data["params"]["mute_info"] = LLSD::emptyMap();
// <FS:Zi> make text chat block in groups not a toggle to prevent accidental unmuting
//current value represents ability to type, so invert
data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText;
// data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText;
data["params"]["mute_info"]["text"] = !allow;
LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro",
boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data));

View File

@ -297,7 +297,9 @@ public:
void updateSpeakers(const LLSD& update);
void setSpeakers(const LLSD& speakers);
void toggleAllowTextChat(const LLUUID& speaker_id);
// <FS:Zi> make text chat block in groups not a toggle to prevent accidental unmuting
// void toggleAllowTextChat(const LLUUID& speaker_id);
void allowTextChat(const LLUUID& speaker_id, bool allow);
/**
* Mutes/Unmutes avatar for current group voice chat.

View File

@ -149,14 +149,20 @@
label="Moderator Options"
layout="topleft"
name="Moderator Options">
<menu_item_check
<menu_item_call
label="Allow text chat"
layout="topleft"
name="AllowTextChat">
<on_check function="AvatarIcon.Check" parameter="is_allowed_text_chat" />
<on_click function="AvatarIcon.Action" parameter="toggle_allow_text_chat" />
<on_click function="AvatarIcon.Action" parameter="allow_text_chat" />
<on_enable function="AvatarIcon.Enable" parameter="can_allow_text_chat" />
</menu_item_check>
</menu_item_call>
<menu_item_call
label="Forbid text chat"
layout="topleft"
name="ForbidTextChat">
<on_click function="AvatarIcon.Action" parameter="forbid_text_chat" />
<on_enable function="AvatarIcon.Enable" parameter="can_allow_text_chat" />
</menu_item_call>
<menu_item_call
label="Mute this participant"
layout="topleft"

View File

@ -166,19 +166,28 @@
<menu_item_separator
layout="topleft"
name="moderate_voice_separator" />
<menu_item_check
<menu_item_call
label="Allow text chat"
layout="topleft"
name="AllowTextChat">
<on_check
function="ParticipantList.CheckItem"
parameter="is_allowed_text_chat" />
<on_click
function="ParticipantList.ToggleAllowTextChat" />
function="ParticipantList.AllowTextChat"
parameter="allow" />
<on_enable
function="ParticipantList.EnableItem"
parameter="can_allow_text_chat" />
</menu_item_check>
</menu_item_call>
<menu_item_call
label="Forbid text chat"
layout="topleft"
name="ForbidTextChat">
<on_click
function="ParticipantList.AllowTextChat"
parameter="forbid" />
<on_enable
function="ParticipantList.EnableItem"
parameter="can_allow_text_chat" />
</menu_item_call>
<menu_item_call
label="Mute this participant"
layout="topleft"

View File

@ -117,6 +117,45 @@
</menu_item_check>
<menu_item_separator
layout="topleft" />
<!-- <FS:Zi> Add group moderation to agent URLs so we can moderate users that don't show
in the participants list for some reason -->
<context_menu
label="Moderator Options"
layout="topleft"
name="GroupModerationSubmenu">
<menu_item_call
label="Allow text chat"
layout="topleft"
name="AllowGroupChat">
<on_click function="FS.AllowGroupChat" />
<!-- on_enable function="AvatarIcon.Enable" parameter="can_allow_text_chat" /-->
</menu_item_call>
<menu_item_call
label="Forbid text chat"
layout="topleft"
name="ForbidGroupChat">
<on_click function="FS.ForbidGroupChat" />
<!-- on_enable function="AvatarIcon.Enable" parameter="can_allow_text_chat" /-->
</menu_item_call>
<menu_item_call
label="Ban member"
layout="topleft"
name="BanGroupMember">
<on_click function="FS.BanGroupMember" />
<!-- on_enable function="AvatarIcon.Enable" parameter="can_allow_text_chat" /-->
</menu_item_call>
<menu_item_call
label="Eject member"
layout="topleft"
name="BanEjectMember">
<on_click function="FS.EjectGroupMember" />
<!-- on_enable function="AvatarIcon.Enable" parameter="can_allow_text_chat" /-->
</menu_item_call>
</context_menu>
<menu_item_separator
name="GroupModerationSeparator"
layout="topleft" />
<!-- </FS:Zi> -->
<menu_item_call
label="Copy Name to clipboard"
layout="topleft"