Chore: deprecate refreshClients methods (#26956)

Co-authored-by: Guilherme Gazzo <5263975+ggazzo@users.noreply.github.com>
pull/21974/head^2
Felipe 3 years ago committed by GitHub
parent b0cbb19778
commit 1bb9ee554d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      apps/meteor/app/assets/server/assets.ts
  2. 28
      apps/meteor/client/views/admin/settings/groups/AssetsGroupPage.tsx

@ -16,6 +16,7 @@ import { getURL } from '../../utils/lib/getURL';
import { getExtension } from '../../utils/lib/mimeTypes';
import { hasPermission } from '../../authorization/server';
import { RocketChatFile } from '../../file';
import { methodDeprecationLogger } from '../../lib/server/lib/deprecationWarningLogger';
const RocketChatAssetsInstance = new RocketChatFile.GridFS({
name: 'assets',
@ -416,6 +417,8 @@ WebAppHashing.calculateClientHash = function (manifest, includeFilter, runtimeCo
Meteor.methods({
refreshClients() {
methodDeprecationLogger.warn('refreshClients will be deprecated in future versions of Rocket.Chat');
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'refreshClients',

@ -1,6 +1,4 @@
import { ISetting } from '@rocket.chat/core-typings';
import { Button } from '@rocket.chat/fuselage';
import { useToastMessageDispatch, useMethod, useTranslation } from '@rocket.chat/ui-contexts';
import React, { memo, ReactElement } from 'react';
import { useEditableSettingsGroupSections } from '../../EditableSettingsContext';
@ -12,33 +10,9 @@ type AssetsGroupPageProps = ISetting;
function AssetsGroupPage({ _id, ...group }: AssetsGroupPageProps): ReactElement {
const sections = useEditableSettingsGroupSections(_id);
const solo = sections.length === 1;
const t = useTranslation();
const refreshClients = useMethod('refreshClients');
const dispatchToastMessage = useToastMessageDispatch();
const handleApplyAndRefreshAllClientsButtonClick = async (): Promise<void> => {
try {
await refreshClients();
dispatchToastMessage({
type: 'success',
message: t('Clients_will_refresh_in_a_few_seconds'),
});
} catch (error) {
dispatchToastMessage({ type: 'error', message: error });
}
};
return (
<GroupPage
_id={_id}
{...group}
headerButtons={
<>
<Button onClick={handleApplyAndRefreshAllClientsButtonClick}>{t('Apply_and_refresh_all_clients')}</Button>
</>
}
>
<GroupPage _id={_id} {...group}>
{sections.map((sectionName) => (
<Section key={sectionName} groupId={_id} hasReset={false} sectionName={sectionName} solo={solo} />
))}

Loading…
Cancel
Save