Implements disabledFeatures-chat

This commit is contained in:
Gustavo Trott 2022-03-09 11:19:25 -03:00
parent 2719bd4f65
commit 057b7514b1
12 changed files with 26 additions and 27 deletions

View File

@ -14,6 +14,7 @@ trait SendGroupChatMessageMsgHdlr extends HandlerHelpers {
def handle(msg: SendGroupChatMessageMsg, state: MeetingState2x,
liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
val chatDisabled: Boolean = liveMeeting.props.meetingProp.disabledFeatures.contains("chat")
var chatLocked: Boolean = false
for {
@ -37,7 +38,7 @@ trait SendGroupChatMessageMsgHdlr extends HandlerHelpers {
}
}
if (!(applyPermissionCheck && chatLocked)) {
if (!chatDisabled && !(applyPermissionCheck && chatLocked)) {
val newState = for {
sender <- GroupChatApp.findGroupChatUser(msg.header.userId, liveMeeting.users2x)
chat <- state.groupChats.find(msg.body.chatId)

View File

@ -24,9 +24,9 @@ import { layoutSelectInput, layoutDispatch } from '../../ui/components/layout/co
import VideoService from '/imports/ui/components/video-provider/service';
import DebugWindow from '/imports/ui/components/debug-window/component';
import { ACTIONS, PANELS } from '../../ui/components/layout/enums';
import { isChatEnabled } from '/imports/ui/services/features';
const CHAT_CONFIG = Meteor.settings.public.chat;
const CHAT_ENABLED = CHAT_CONFIG.enabled;
const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id;
const BREAKOUT_END_NOTIFY_DELAY = 50;
@ -256,7 +256,7 @@ class Base extends Component {
if (sidebarContentPanel === PANELS.NONE || Session.equals('subscriptionsReady', true)) {
if (!checkedUserSettings) {
if (getFromUserSettings('bbb_show_participants_on_login', Meteor.settings.public.layout.showParticipantsOnLogin) && !deviceInfo.isPhone) {
if (CHAT_ENABLED && getFromUserSettings('bbb_show_public_chat_on_login', !Meteor.settings.public.chat.startClosed)) {
if (isChatEnabled() && getFromUserSettings('bbb_show_public_chat_on_login', !Meteor.settings.public.chat.startClosed)) {
layoutContextDispatch({
type: ACTIONS.SET_SIDEBAR_NAVIGATION_IS_OPEN,
value: true,

View File

@ -4,6 +4,7 @@ import deviceInfo from '/imports/utils/deviceInfo';
import PropTypes from 'prop-types';
import Styled from './styles';
import { notify } from '/imports/ui/services/notification';
import { isChatEnabled } from '/imports/ui/services/features';
const propTypes = {
intl: PropTypes.shape({
@ -48,9 +49,6 @@ const messages = defineMessages({
},
});
const CHAT_CONFIG = Meteor.settings.public.chat;
const CHAT_ENABLED = CHAT_CONFIG.enabled;
class MessageForm extends PureComponent {
constructor(props) {
super(props);
@ -231,7 +229,7 @@ class MessageForm extends PureComponent {
const { hasErrors, error, message } = this.state;
return CHAT_ENABLED ? (
return isChatEnabled() ? (
<Styled.Form
ref={(ref) => { this.form = ref; }}
onSubmit={this.handleSubmit}

View File

@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
import _ from 'lodash';
import TypingIndicatorContainer from './typing-indicator/container';
import Styled from './styles';
import { isChatEnabled } from '/imports/ui/services/features';
const propTypes = {
intl: PropTypes.object.isRequired,
@ -60,7 +61,6 @@ const messages = defineMessages({
});
const CHAT_CONFIG = Meteor.settings.public.chat;
const CHAT_ENABLED = CHAT_CONFIG.enabled;
class MessageForm extends PureComponent {
constructor(props) {
@ -259,7 +259,7 @@ class MessageForm extends PureComponent {
const { hasErrors, error, message } = this.state;
return CHAT_ENABLED ? (
return isChatEnabled() ? (
<Styled.Form
ref={(ref) => { this.form = ref; }}
onSubmit={this.handleSubmit}

View File

@ -4,8 +4,7 @@ import PropTypes from 'prop-types';
import Toggle from '/imports/ui/components/common/switch/component';
import NotesService from '/imports/ui/components/notes/service';
import Styled from './styles';
const CHAT_ENABLED = Meteor.settings.public.chat.enabled;
import { isChatEnabled } from '/imports/ui/services/features';
const intlMessages = defineMessages({
lockViewersTitle: {
@ -252,7 +251,7 @@ class LockViewersComponent extends Component {
</Styled.Col>
</Styled.Row>
{CHAT_ENABLED ? (
{isChatEnabled() ? (
<Fragment>
<Styled.Row>
<Styled.Col aria-hidden="true">

View File

@ -3,8 +3,7 @@ import Toggle from '/imports/ui/components/common/switch/component';
import { defineMessages, injectIntl } from 'react-intl';
import BaseMenu from '../base/component';
import Styled from './styles';
const CHAT_ENABLED = Meteor.settings.public.chat.enabled;
import { isChatEnabled } from '/imports/ui/services/features';
const intlMessages = defineMessages({
notificationSectionTitle: {
@ -88,7 +87,7 @@ class NotificationMenu extends BaseMenu {
</Styled.ColHeading>
</Styled.Row>
{CHAT_ENABLED ? (
{isChatEnabled() ? (
<Styled.Row>
<Styled.Col>
<Styled.Label>

View File

@ -7,6 +7,7 @@ import Modal from '/imports/ui/components/common/modal/simple/component';
import _ from 'lodash';
import Styled from './styles';
import withShortcutHelper from './service';
import { isChatEnabled } from '/imports/ui/services/features';
const intlMessages = defineMessages({
title: {
@ -99,9 +100,6 @@ const intlMessages = defineMessages({
},
});
const CHAT_CONFIG = Meteor.settings.public.chat;
const CHAT_ENABLED = CHAT_CONFIG.enabled;
const ShortcutHelpComponent = (props) => {
const { intl, shortcuts } = props;
const { browserName } = browserInfo;
@ -134,7 +132,7 @@ const ShortcutHelpComponent = (props) => {
}
const shortcutItems = shortcuts.map((shortcut) => {
if (!CHAT_ENABLED && shortcut.descId.indexOf('Chat') !== -1) return null;
if (!isChatEnabled() && shortcut.descId.indexOf('Chat') !== -1) return null;
return (
<tr key={_.uniqueId('hotkey-item-')}>
<Styled.KeyCell>{`${accessMod} + ${shortcut.accesskey}`}</Styled.KeyCell>

View File

@ -15,9 +15,9 @@ import {
localUsersSync,
} from '/client/collection-mirror-initializer';
import SubscriptionRegistry, { subscriptionReactivity } from '../../services/subscription-registry/subscriptionRegistry';
import { isChatEnabled } from '/imports/ui/services/features';
const CHAT_CONFIG = Meteor.settings.public.chat;
const CHAT_ENABLED = CHAT_CONFIG.enabled;
const PUBLIC_GROUP_CHAT_ID = CHAT_CONFIG.public_group_id;
const PUBLIC_CHAT_TYPE = CHAT_CONFIG.type_public;
const TYPING_INDICATOR_ENABLED = CHAT_CONFIG.typingIndicator.enabled;
@ -82,7 +82,7 @@ export default withTracker(() => {
let subscriptionsHandlers = SUBSCRIPTIONS.map((name) => {
let subscriptionHandlers = subscriptionErrorHandler;
if ((!TYPING_INDICATOR_ENABLED && name.indexOf('typing') !== -1)
|| (!CHAT_ENABLED && name.indexOf('chat') !== -1)) return null;
|| (!isChatEnabled() && name.indexOf('chat') !== -1)) return null;
if (name === 'users') {
subscriptionHandlers = {
@ -142,7 +142,7 @@ export default withTracker(() => {
const ready = subscriptionsHandlers.every(handler => handler.ready());
let groupChatMessageHandler = {};
if (CHAT_ENABLED && ready) {
if (isChatEnabled() && ready) {
const chatsCount = GroupChat.find({
$or: [
{

View File

@ -8,12 +8,12 @@ import UserCaptionsContainer from './user-captions/container';
import WaitingUsersContainer from './waiting-users/container';
import UserPollsContainer from './user-polls/container';
import BreakoutRoomContainer from './breakout-room/container';
import { isChatEnabled } from '/imports/ui/services/features';
const propTypes = {
currentUser: PropTypes.shape({}).isRequired,
};
const CHAT_ENABLED = Meteor.settings.public.chat.enabled;
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
class UserContent extends PureComponent {
@ -31,7 +31,7 @@ class UserContent extends PureComponent {
return (
<Styled.Content data-test="userListContent">
{CHAT_ENABLED ? <UserMessagesContainer /> : null}
{isChatEnabled() ? <UserMessagesContainer /> : null}
{currentUser.role === ROLE_MODERATOR ? <UserCaptionsContainer /> : null}
<UserNotesContainer />
{showWaitingRoom && currentUser.role === ROLE_MODERATOR

View File

@ -15,6 +15,7 @@ import BBBMenu from '/imports/ui/components/common/menu/component';
import Styled from './styles';
import { PANELS, ACTIONS } from '../../../../layout/enums';
import WhiteboardService from '/imports/ui/components/whiteboard/service';
import { isChatEnabled } from '/imports/ui/services/features';
const messages = defineMessages({
presenter: {
@ -169,7 +170,6 @@ const propTypes = {
isMe: PropTypes.func.isRequired,
};
const CHAT_ENABLED = Meteor.settings.public.chat.enabled;
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
const LABEL = Meteor.settings.public.user.label;
@ -354,7 +354,7 @@ class UserListItem extends PureComponent {
icon: userIsPinned ? 'pin-video_off' : 'pin-video_on',
},
{
allowed: CHAT_ENABLED
allowed: isChatEnabled()
&& enablePrivateChat
&& !isDialInUser
&& !meetingIsBreakout

View File

@ -27,3 +27,7 @@ export function isPollingEnabled() {
export function isExternalVideoEnabled() {
return getDisabledFeatures().indexOf('externalVideos') === -1 && Meteor.settings.public.externalVideoPlayer.enabled;
}
export function isChatEnabled() {
return getDisabledFeatures().indexOf('chat') === -1 && Meteor.settings.public.chat.enabled;
}

View File

@ -409,7 +409,7 @@ endWhenNoModerator=false
endWhenNoModeratorDelayInMinutes=1
# List of features to disable (comma-separated)
# Available options: externalVideos, learningDashboard, polls, screenshare
# Available options: chat, externalVideos, learningDashboard, polls, screenshare
#disabledFeatures=
# Allow endpoint with current BigBlueButton version