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, def handle(msg: SendGroupChatMessageMsg, state: MeetingState2x,
liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = { liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
val chatDisabled: Boolean = liveMeeting.props.meetingProp.disabledFeatures.contains("chat")
var chatLocked: Boolean = false var chatLocked: Boolean = false
for { for {
@ -37,7 +38,7 @@ trait SendGroupChatMessageMsgHdlr extends HandlerHelpers {
} }
} }
if (!(applyPermissionCheck && chatLocked)) { if (!chatDisabled && !(applyPermissionCheck && chatLocked)) {
val newState = for { val newState = for {
sender <- GroupChatApp.findGroupChatUser(msg.header.userId, liveMeeting.users2x) sender <- GroupChatApp.findGroupChatUser(msg.header.userId, liveMeeting.users2x)
chat <- state.groupChats.find(msg.body.chatId) 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 VideoService from '/imports/ui/components/video-provider/service';
import DebugWindow from '/imports/ui/components/debug-window/component'; import DebugWindow from '/imports/ui/components/debug-window/component';
import { ACTIONS, PANELS } from '../../ui/components/layout/enums'; import { ACTIONS, PANELS } from '../../ui/components/layout/enums';
import { isChatEnabled } from '/imports/ui/services/features';
const CHAT_CONFIG = Meteor.settings.public.chat; const CHAT_CONFIG = Meteor.settings.public.chat;
const CHAT_ENABLED = CHAT_CONFIG.enabled;
const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id; const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id;
const BREAKOUT_END_NOTIFY_DELAY = 50; const BREAKOUT_END_NOTIFY_DELAY = 50;
@ -256,7 +256,7 @@ class Base extends Component {
if (sidebarContentPanel === PANELS.NONE || Session.equals('subscriptionsReady', true)) { if (sidebarContentPanel === PANELS.NONE || Session.equals('subscriptionsReady', true)) {
if (!checkedUserSettings) { if (!checkedUserSettings) {
if (getFromUserSettings('bbb_show_participants_on_login', Meteor.settings.public.layout.showParticipantsOnLogin) && !deviceInfo.isPhone) { 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({ layoutContextDispatch({
type: ACTIONS.SET_SIDEBAR_NAVIGATION_IS_OPEN, type: ACTIONS.SET_SIDEBAR_NAVIGATION_IS_OPEN,
value: true, value: true,

View File

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

View File

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

View File

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

View File

@ -7,6 +7,7 @@ import Modal from '/imports/ui/components/common/modal/simple/component';
import _ from 'lodash'; import _ from 'lodash';
import Styled from './styles'; import Styled from './styles';
import withShortcutHelper from './service'; import withShortcutHelper from './service';
import { isChatEnabled } from '/imports/ui/services/features';
const intlMessages = defineMessages({ const intlMessages = defineMessages({
title: { 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 ShortcutHelpComponent = (props) => {
const { intl, shortcuts } = props; const { intl, shortcuts } = props;
const { browserName } = browserInfo; const { browserName } = browserInfo;
@ -134,7 +132,7 @@ const ShortcutHelpComponent = (props) => {
} }
const shortcutItems = shortcuts.map((shortcut) => { 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 ( return (
<tr key={_.uniqueId('hotkey-item-')}> <tr key={_.uniqueId('hotkey-item-')}>
<Styled.KeyCell>{`${accessMod} + ${shortcut.accesskey}`}</Styled.KeyCell> <Styled.KeyCell>{`${accessMod} + ${shortcut.accesskey}`}</Styled.KeyCell>

View File

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

View File

@ -8,12 +8,12 @@ import UserCaptionsContainer from './user-captions/container';
import WaitingUsersContainer from './waiting-users/container'; import WaitingUsersContainer from './waiting-users/container';
import UserPollsContainer from './user-polls/container'; import UserPollsContainer from './user-polls/container';
import BreakoutRoomContainer from './breakout-room/container'; import BreakoutRoomContainer from './breakout-room/container';
import { isChatEnabled } from '/imports/ui/services/features';
const propTypes = { const propTypes = {
currentUser: PropTypes.shape({}).isRequired, currentUser: PropTypes.shape({}).isRequired,
}; };
const CHAT_ENABLED = Meteor.settings.public.chat.enabled;
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator; const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
class UserContent extends PureComponent { class UserContent extends PureComponent {
@ -31,7 +31,7 @@ class UserContent extends PureComponent {
return ( return (
<Styled.Content data-test="userListContent"> <Styled.Content data-test="userListContent">
{CHAT_ENABLED ? <UserMessagesContainer /> : null} {isChatEnabled() ? <UserMessagesContainer /> : null}
{currentUser.role === ROLE_MODERATOR ? <UserCaptionsContainer /> : null} {currentUser.role === ROLE_MODERATOR ? <UserCaptionsContainer /> : null}
<UserNotesContainer /> <UserNotesContainer />
{showWaitingRoom && currentUser.role === ROLE_MODERATOR {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 Styled from './styles';
import { PANELS, ACTIONS } from '../../../../layout/enums'; import { PANELS, ACTIONS } from '../../../../layout/enums';
import WhiteboardService from '/imports/ui/components/whiteboard/service'; import WhiteboardService from '/imports/ui/components/whiteboard/service';
import { isChatEnabled } from '/imports/ui/services/features';
const messages = defineMessages({ const messages = defineMessages({
presenter: { presenter: {
@ -169,7 +170,6 @@ const propTypes = {
isMe: PropTypes.func.isRequired, isMe: PropTypes.func.isRequired,
}; };
const CHAT_ENABLED = Meteor.settings.public.chat.enabled;
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator; const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
const LABEL = Meteor.settings.public.user.label; const LABEL = Meteor.settings.public.user.label;
@ -354,7 +354,7 @@ class UserListItem extends PureComponent {
icon: userIsPinned ? 'pin-video_off' : 'pin-video_on', icon: userIsPinned ? 'pin-video_off' : 'pin-video_on',
}, },
{ {
allowed: CHAT_ENABLED allowed: isChatEnabled()
&& enablePrivateChat && enablePrivateChat
&& !isDialInUser && !isDialInUser
&& !meetingIsBreakout && !meetingIsBreakout

View File

@ -27,3 +27,7 @@ export function isPollingEnabled() {
export function isExternalVideoEnabled() { export function isExternalVideoEnabled() {
return getDisabledFeatures().indexOf('externalVideos') === -1 && Meteor.settings.public.externalVideoPlayer.enabled; 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 endWhenNoModeratorDelayInMinutes=1
# List of features to disable (comma-separated) # List of features to disable (comma-separated)
# Available options: externalVideos, learningDashboard, polls, screenshare # Available options: chat, externalVideos, learningDashboard, polls, screenshare
#disabledFeatures= #disabledFeatures=
# Allow endpoint with current BigBlueButton version # Allow endpoint with current BigBlueButton version