Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(file-sharing): Uses feature to determine is upload enabled.
damenchoc7b6af1df372
diff --git a/react/features/base/jwt/constants.ts b/react/features/base/jwt/constants.tsindex 18f03f99fc..f411589bfa 100644--- a/react/features/base/jwt/constants.ts+++ b/react/features/base/jwt/constants.ts@@ -7,6 +7,7 @@ export const MEET_FEATURES: Record<string, ParticipantFeaturesKey> = {BRANDING: 'branding',CALENDAR: 'calendar',CREATE_POLLS: 'create-polls',+ FILE_UPLOAD: 'file-upload',FLIP: 'flip',INBOUND_CALL: 'inbound-call',LIVESTREAMING: 'livestreaming',diff --git a/react/features/base/participants/types.ts b/react/features/base/participants/types.tsindex 9322ead9e4..e965c63527 100644--- a/react/features/base/participants/types.ts+++ b/react/features/base/participants/types.ts@@ -58,6 +58,7 @@ export interface IParticipantFeatures {'branding'?: boolean | string;'calendar'?: boolean | string;'create-polls'?: boolean | string;+ 'file-upload'?: boolean | string;'flip'?: boolean | string;'inbound-call'?: boolean | string;'livestreaming'?: boolean | string;diff --git a/react/features/file-sharing/components/web/FileSharing.tsx b/react/features/file-sharing/components/web/FileSharing.tsxindex 874efeb711..f9b633fa62 100644--- a/react/features/file-sharing/components/web/FileSharing.tsx+++ b/react/features/file-sharing/components/web/FileSharing.tsx@@ -9,11 +9,16 @@ import { IconCloudUpload, IconDownload, IconTrash } from '../../../base/icons/svimport Button from '../../../base/ui/components/web/Button';import { BUTTON_TYPES } from '../../../base/ui/constants.web';import Icon from '../../../base/icons/components/Icon';-import { isLocalParticipantModerator } from '../../../base/participants/functions';import { withPixelLineHeight } from '../../../base/styles/functions.web';import BaseTheme from '../../../base/ui/components/BaseTheme.web';import { downloadFile, removeFile } from '../../actions';-import { formatFileSize, formatTimestamp, getFileIcon, processFiles } from '../../functions.any';+import {+ isFileUploadingEnabled,+ formatFileSize,+ formatTimestamp,+ getFileIcon,+ processFiles+} from '../../functions.any';const useStyles = makeStyles()(theme => {return {@@ -207,7 +212,7 @@ const FileSharing = () => {const store = useStore();const { files } = useSelector((state: IReduxState) => state['features/file-sharing']);const sortedFiles = Array.from(files.values()).sort((a, b) => a.fileName.localeCompare(b.fileName));- const isModerator = useSelector(isLocalParticipantModerator);+ const isUploadEnabled = useSelector(isFileUploadingEnabled);const handleDragEnter = useCallback((e: React.DragEvent) => {e.preventDefault();@@ -255,7 +260,7 @@ const FileSharing = () => {return (<div className = { classes.container }>{- isModerator && (+ isUploadEnabled && (<><divclassName = { `${classes.dropZone} ${@@ -341,7 +346,7 @@ const FileSharing = () => {size = { 24 }src = { IconDownload } />{- isModerator && (+ isUploadEnabled && (<IconclassName = { `${classes.actionIcon} actionIconVisibility` }color = { BaseTheme.palette.icon01 }@@ -372,7 +377,7 @@ const FileSharing = () => {)}{- isModerator && (+ isUploadEnabled && (<ButtonaccessibilityLabel = { t('fileSharing.uploadFile') }className = { classes.uploadButton }diff --git a/react/features/file-sharing/functions.any.ts b/react/features/file-sharing/functions.any.tsindex 6ae2f3805c..d005e36e62 100644--- a/react/features/file-sharing/functions.any.ts+++ b/react/features/file-sharing/functions.any.ts@@ -6,6 +6,8 @@ import {IconVolumeUp} from '../base/icons/svg';import { getLocalizedDateFormatter } from '../base/i18n/dateUtil';+import { isJwtFeatureEnabled } from '../base/jwt/functions';+import { MEET_FEATURES } from '../base/jwt/constants';import { showErrorNotification } from '../notifications/actions';import { NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants';@@ -140,3 +142,13 @@ export const processFiles = (fileList: FileList | File[], store: IStore) => {dispatch(uploadFiles(newFiles as File[]));}};++/**+ * Determines if file uploading is enabled based on JWT feature flags and file sharing settings.+ *+ * @param {IReduxState} state - Current state.+ * @returns {boolean} Indication of whether local user can upload files.+ */+export function isFileUploadingEnabled(state: IReduxState): boolean {+ return isJwtFeatureEnabled(state, MEET_FEATURES.FILE_UPLOAD, false) && isFileSharingEnabled(state);+}