diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/SendGroupChatMessageMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/SendGroupChatMessageMsgHdlr.scala index 929e91ae34..7f9a103701 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/SendGroupChatMessageMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/SendGroupChatMessageMsgHdlr.scala @@ -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) diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index 9f62ab5ee9..24bb3f9db7 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -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, diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/message-form/component.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/message-form/component.jsx index ab87a9068d..2665dcbc87 100755 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/message-form/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/message-form/component.jsx @@ -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() ? ( { this.form = ref; }} onSubmit={this.handleSubmit} diff --git a/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx index b39f580306..013bb29314 100755 --- a/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx @@ -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() ? ( { this.form = ref; }} onSubmit={this.handleSubmit} diff --git a/bigbluebutton-html5/imports/ui/components/lock-viewers/component.jsx b/bigbluebutton-html5/imports/ui/components/lock-viewers/component.jsx index 6521f8ecba..4b6cc95e6b 100755 --- a/bigbluebutton-html5/imports/ui/components/lock-viewers/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/lock-viewers/component.jsx @@ -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 { - {CHAT_ENABLED ? ( + {isChatEnabled() ? ( - {CHAT_ENABLED ? ( + {isChatEnabled() ? ( diff --git a/bigbluebutton-html5/imports/ui/components/shortcut-help/component.jsx b/bigbluebutton-html5/imports/ui/components/shortcut-help/component.jsx index decab2c6c8..63e7397a93 100644 --- a/bigbluebutton-html5/imports/ui/components/shortcut-help/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/shortcut-help/component.jsx @@ -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 ( {`${accessMod} + ${shortcut.accesskey}`} diff --git a/bigbluebutton-html5/imports/ui/components/subscriptions/component.jsx b/bigbluebutton-html5/imports/ui/components/subscriptions/component.jsx index f3f7588a29..994e829335 100755 --- a/bigbluebutton-html5/imports/ui/components/subscriptions/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/subscriptions/component.jsx @@ -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: [ { diff --git a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/component.jsx b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/component.jsx index 0f640b5969..7b5a1fcd8c 100755 --- a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/component.jsx @@ -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 ( - {CHAT_ENABLED ? : null} + {isChatEnabled() ? : null} {currentUser.role === ROLE_MODERATOR ? : null} {showWaitingRoom && currentUser.role === ROLE_MODERATOR diff --git a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-item/component.jsx b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-item/component.jsx index 30689612cb..b8b27d80d5 100644 --- a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-item/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-item/component.jsx @@ -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 diff --git a/bigbluebutton-html5/imports/ui/services/features/index.js b/bigbluebutton-html5/imports/ui/services/features/index.js index 2347c2ca04..821a14255a 100644 --- a/bigbluebutton-html5/imports/ui/services/features/index.js +++ b/bigbluebutton-html5/imports/ui/services/features/index.js @@ -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; +} diff --git a/bigbluebutton-web/grails-app/conf/bigbluebutton.properties b/bigbluebutton-web/grails-app/conf/bigbluebutton.properties index bab06edd54..4edcb6fca1 100755 --- a/bigbluebutton-web/grails-app/conf/bigbluebutton.properties +++ b/bigbluebutton-web/grails-app/conf/bigbluebutton.properties @@ -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