-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into omnichannel/directory
- Loading branch information
Showing
204 changed files
with
3,617 additions
and
3,709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { APIClass } from '.'; | ||
|
||
export declare const API: { | ||
v1: APIClass; | ||
default: APIClass; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { getInstances } from '../../../../server/stream/streamBroadcast'; | ||
import { hasPermission } from '../../../authorization/server'; | ||
import { API } from '../api'; | ||
|
||
API.v1.addRoute('instances.get', { authRequired: true }, { | ||
get() { | ||
if (!hasPermission(this.userId, 'view-statistics')) { | ||
return API.v1.unauthorized(); | ||
} | ||
|
||
return API.v1.success({ instances: getInstances() }); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useMemo } from 'react'; | ||
|
||
import { useSetting } from '../../../../client/contexts/SettingsContext'; | ||
import { addAction } from '../../../../client/views/room/lib/Toolbox'; | ||
import { useEndpointData } from '../../../../client/hooks/useEndpointData'; | ||
import { AsyncStatePhase } from '../../../../client/hooks/useAsyncState'; | ||
|
||
addAction('game-center', () => { | ||
const enabled = useSetting('Apps_Game_Center_enabled'); | ||
|
||
const { value = { externalComponents: [] }, phase: state, error } = useEndpointData('/apps/externalComponents'); | ||
|
||
const hasExternalComponents = value && value.externalComponents.length > 0; | ||
const hasError = !!error; | ||
return useMemo(() => | ||
(enabled | ||
&& state === AsyncStatePhase.LOADING | ||
&& !hasError | ||
&& hasExternalComponents | ||
? { | ||
groups: ['channel', 'group', 'direct'], | ||
id: 'game-center', | ||
title: 'Apps_Game_Center', | ||
icon: 'game', | ||
template: 'GameCenter', | ||
order: -1, | ||
} : null), [enabled, hasError, hasExternalComponents, state]); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { lazy, useMemo } from 'react'; | ||
|
||
import { addAction } from '../../../../client/views/room/lib/Toolbox'; | ||
import { usePermission } from '../../../../client/contexts/AuthorizationContext'; | ||
import { useSetting } from '../../../../client/contexts/SettingsContext'; | ||
|
||
addAction('autotranslate', () => { | ||
const hasPermission = usePermission('auto-translate'); | ||
const autoTranslateEnabled = useSetting('AutoTranslate_Enabled'); | ||
return useMemo(() => (hasPermission && autoTranslateEnabled ? { | ||
groups: ['channel', 'group', 'direct'], | ||
id: 'autotranslate', | ||
title: 'Auto_Translate', | ||
icon: 'language', | ||
template: lazy(() => import('../../../../client/views/room/contextualBar/AutoTranslate')), | ||
order: 20, | ||
full: true, | ||
} : null), [autoTranslateEnabled, hasPermission]); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { FC, lazy, LazyExoticComponent } from 'react'; | ||
|
||
import { addAction } from '../../../../client/views/room/lib/Toolbox'; | ||
|
||
addAction('channel-settings', { | ||
groups: ['channel', 'group'], | ||
id: 'channel-settings', | ||
anonymous: true, | ||
full: true, | ||
title: 'Room_Info', | ||
icon: 'info-circled', | ||
template: lazy(() => import('../../../../client/views/room/contextualBar/Info')) as LazyExoticComponent<FC>, | ||
order: 7, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useMemo, lazy, LazyExoticComponent, FC } from 'react'; | ||
|
||
import { addAction } from '../../../client/views/room/lib/Toolbox'; | ||
import { useSetting } from '../../../client/contexts/SettingsContext'; | ||
|
||
addAction('discussions', () => { | ||
const discussionEnabled = useSetting('Discussion_enabled'); | ||
|
||
return useMemo(() => (discussionEnabled ? { | ||
groups: ['channel', 'group', 'direct'], | ||
id: 'discussions', | ||
title: 'Discussions', | ||
icon: 'discussion', | ||
template: lazy(() => import('../../../client/views/room/contextualBar/Discussions')) as LazyExoticComponent<FC>, | ||
full: true, | ||
order: 1, | ||
} : null), [discussionEnabled]); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useMemo } from 'react'; | ||
import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; | ||
|
||
import { addAction } from '../../../client/views/room/lib/Toolbox'; | ||
import { useSetting } from '../../../client/contexts/SettingsContext'; | ||
import { usePermission } from '../../../client/contexts/AuthorizationContext'; | ||
import { useMethod } from '../../../client/contexts/ServerContext'; | ||
|
||
addAction('e2e', ({ room }) => { | ||
const e2eEnabled = useSetting('E2E_Enable'); | ||
const hasPermission = usePermission('edit-room', room._id); | ||
const toggleE2E = useMethod('saveRoomSettings'); | ||
|
||
const action = useMutableCallback(() => { | ||
toggleE2E(room._id, 'encrypted', !room.encrypted); | ||
}); | ||
|
||
const enabledOnRoom = !!room.encrypted; | ||
|
||
return useMemo(() => (e2eEnabled && hasPermission ? { | ||
groups: ['direct', 'group'], | ||
id: 'e2e', | ||
title: enabledOnRoom ? 'E2E_disable' : 'E2E_enable', | ||
icon: 'key', | ||
order: 13, | ||
action, | ||
} : null), [action, e2eEnabled, enabledOnRoom, hasPermission]); | ||
}); |
Oops, something went wrong.