Skip to content

Commit

Permalink
Merge branch 'develop' into omnichannel/directory
Browse files Browse the repository at this point in the history
  • Loading branch information
renatobecker authored Dec 22, 2020
2 parents a4221a4 + 731f225 commit 749ccfd
Show file tree
Hide file tree
Showing 204 changed files with 3,617 additions and 3,709 deletions.
2 changes: 1 addition & 1 deletion .snapcraft/resources/preparecaddy
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ caddy_arch=_linux_$caddy_arch

echo "Downloading Caddy for $caddy_os/$caddy_arch$caddy_arm..."
caddy_file="caddy_linux_$caddy_arch${caddy_arm}_custom$caddy_dl_ext"
caddy_url="https://github.com/mholt/caddy/releases/download/$caddy_version/caddy_$caddy_version$caddy_arch$caddy_arm.tar.gz"
caddy_url="https://github.com/caddyserver/caddy/releases/download/$caddy_version/caddy_$caddy_version$caddy_arch$caddy_arm.tar.gz"
echo "$caddy_url"

curl -L "$caddy_url" -o "$caddy_file"
Expand Down
6 changes: 6 additions & 0 deletions app/api/server/api.d.ts
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;
};
1 change: 1 addition & 0 deletions app/api/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ import './v1/webdav';
import './v1/oauthapps';
import './v1/custom-sounds';
import './v1/custom-user-status';
import './v1/instances';

export { API, APIClass, defaultRateLimiterOptions } from './api';
13 changes: 13 additions & 0 deletions app/api/server/v1/instances.ts
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() });
},
});
1 change: 1 addition & 0 deletions app/apps/client/gameCenter/gameCenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ReactiveVar } from 'meteor/reactive-var';

import { modal } from '../../../ui-utils/client';
import { APIClient, t, handleError } from '../../../utils/client';
import './gameCenter.html';

const getExternalComponents = async (instance) => {
try {
Expand Down
31 changes: 0 additions & 31 deletions app/apps/client/gameCenter/tabBar.js

This file was deleted.

28 changes: 28 additions & 0 deletions app/apps/client/gameCenter/tabBar.ts
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]);
});
28 changes: 0 additions & 28 deletions app/autotranslate/client/lib/tabBar.js

This file was deleted.

19 changes: 19 additions & 0 deletions app/autotranslate/client/lib/tabBar.ts
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]);
});
16 changes: 0 additions & 16 deletions app/channel-settings/client/startup/tabBar.js

This file was deleted.

14 changes: 14 additions & 0 deletions app/channel-settings/client/startup/tabBar.ts
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,
});
1 change: 0 additions & 1 deletion app/discussion/client/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Templates
import './views/creationDialog/CreateDiscussion';
import './views/DiscussionTabbar';

// Other UI extensions
import './lib/messageTypes/discussionMessage';
Expand Down
17 changes: 0 additions & 17 deletions app/discussion/client/tabBar.js

This file was deleted.

18 changes: 18 additions & 0 deletions app/discussion/client/tabBar.ts
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]);
});
11 changes: 0 additions & 11 deletions app/discussion/client/views/DiscussionTabbar.js

This file was deleted.

37 changes: 0 additions & 37 deletions app/e2e/client/tabbar.js

This file was deleted.

28 changes: 28 additions & 0 deletions app/e2e/client/tabbar.ts
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]);
});
Loading

0 comments on commit 749ccfd

Please sign in to comment.