Allow chat with moderators when private chat is locked.

This commit is contained in:
Ghazi Triki 2018-05-08 16:56:36 +01:00
parent 70c31c1a50
commit 138663dc77
3 changed files with 29 additions and 9 deletions

View File

@ -29,7 +29,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<fx:Declarations>
<mate:Listener type="{LockControlEvent.CHANGED_LOCK_SETTINGS}" method="lockSettingsChanged" />
<mate:Listener type="{ChangeMyRole.CHANGE_MY_ROLE_EVENT}" method="refreshRole" />
<mate:Listener type="{UserStatusChangedEvent.USER_STATUS_CHANGED}" method="refreshRole" />
<mate:Listener type="{UserJoinedEvent.JOINED}" method="handleUserJoinedEvent" />
<mate:Listener type="{UserLeftEvent.LEFT}" method="handleUserLeftEvent" />
</fx:Declarations>
@ -49,10 +49,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.core.events.LockControlEvent;
import org.bigbluebutton.core.events.UserStatusChangedEvent;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.main.events.UserJoinedEvent;
import org.bigbluebutton.main.events.UserLeftEvent;
import org.bigbluebutton.main.model.users.events.ChangeMyRole;
import org.bigbluebutton.modules.chat.events.ChatNoiseEnabledEvent;
import org.bigbluebutton.modules.chat.events.ChatOptionsEvent;
import org.bigbluebutton.modules.chat.events.ChatToolbarButtonEvent;
@ -164,16 +164,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
refreshListStatus();
}
private function refreshRole(e:ChangeMyRole):void {
private function refreshRole(e:Event):void {
clearBtn.visible = clearBtn.enabled = clearBtn.includeInLayout = clrBtnVisible = UsersUtil.amIModerator();
refreshListStatus();
}
private function refreshListStatus():void {
handler.disableModeratorsFilter();
if (UsersUtil.amIModerator() || UsersUtil.amIPresenter()) return; // Settings only affect viewers.
usersList.enabled = ! LiveMeeting.inst().me.disableMyPrivateChat;
if (LiveMeeting.inst().me.disableMyPrivateChat) {
handler.enableModeratorsFilter();
}
}
public function sendSaveEvent():void{

View File

@ -43,7 +43,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mate:Listener type="{ShortcutEvent.SEND_MESSAGE}" method="remoteSendMessage" />
<mate:Listener type="{BBBEvent.RECONNECT_DISCONNECTED_EVENT}" receive="refreshChat(event)"/>
<mate:Listener type="{LockControlEvent.CHANGED_LOCK_SETTINGS}" method="lockSettingsChanged" />
<mate:Listener type="{ChangeMyRole.CHANGE_MY_ROLE_EVENT}" method="refreshRole" />
<mate:Listener type="{UserStatusChangedEvent.USER_STATUS_CHANGED}" method="refreshRole" />
</fx:Declarations>
<fx:Script>
@ -59,15 +59,16 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.as3commons.lang.StringUtils;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.common.Role;
import org.bigbluebutton.core.Options;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.events.LockControlEvent;
import org.bigbluebutton.core.events.UserStatusChangedEvent;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.events.UserJoinedEvent;
import org.bigbluebutton.main.events.UserLeftEvent;
import org.bigbluebutton.main.model.users.events.ChangeMyRole;
import org.bigbluebutton.modules.chat.ChatUtil;
import org.bigbluebutton.modules.chat.events.ChatEvent;
import org.bigbluebutton.modules.chat.events.ChatHistoryEvent;
@ -589,11 +590,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
if (publicChat) {
txtMsgArea.enabled = sendBtn.enabled = !LiveMeeting.inst().me.disableMyPublicChat;
} else {
txtMsgArea.enabled = sendBtn.enabled = !LiveMeeting.inst().me.disableMyPrivateChat;
txtMsgArea.enabled = sendBtn.enabled = !LiveMeeting.inst().me.disableMyPrivateChat || LiveMeeting.inst().users.getUser(chatWithUserID).role == Role.MODERATOR;
}
}
private function refreshRole(e:ChangeMyRole):void {
private function refreshRole(e:Event):void {
applyLockSettings();
}

View File

@ -3,6 +3,7 @@ package org.bigbluebutton.modules.chat.views
import mx.collections.ArrayCollection;
import mx.collections.Sort;
import org.bigbluebutton.common.Role;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.core.model.users.User2x;
@ -72,6 +73,20 @@ package org.bigbluebutton.modules.chat.views
public function handleUserLeftEvent(userId: String):void {
removeUser(userId, users);
}
public function enableModeratorsFilter():void {
users.filterFunction = filterModeratorsOnly;
users.refresh();
}
public function disableModeratorsFilter():void {
users.filterFunction = null;
users.refresh();
}
private function filterModeratorsOnly(item:Object):Boolean {
return LiveMeeting.inst().users.getUser(item.userId).role == Role.MODERATOR;
}
private function sortFunction(a:Object, b:Object, array:Array = null):int {
/*