Skip to content

Commit

Permalink
removing unneeded changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc committed Oct 16, 2023
1 parent edfac05 commit 76243f7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 38 deletions.
12 changes: 2 additions & 10 deletions apps/meteor/app/api/server/v1/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from '@rocket.chat/rest-typings';
import { Meteor } from 'meteor/meteor';

import { translateForUserId } from '../../../../server/lib/translateForUser';
import { PendingAvatarImporter } from '../../../importer-pending-avatars/server/importer';
import { PendingFileImporter } from '../../../importer-pending-files/server/importer';
import { Importers } from '../../../importer/server';
Expand Down Expand Up @@ -201,16 +200,9 @@ API.v1.addRoute(
},
{
async get() {
const importers = Importers.getAllVisible();
const importers = Importers.getAllVisible().map(({ key, name }) => ({ key, name }));

const translatedImporters = await Promise.all(
importers.map(async ({ key, name }) => ({
key,
name: (await translateForUserId(name, this.userId)) || name,
})),
);

return API.v1.success(translatedImporters);
return API.v1.success(importers);
},
},
);
Expand Down
20 changes: 10 additions & 10 deletions apps/meteor/app/importer/server/classes/ImporterBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type OldSettings = {
* Base class for all of the importers.
*/
export class Importer {
private reportProgressHandler: ReturnType<typeof setTimeout> | undefined;
private _reportProgressHandler: ReturnType<typeof setTimeout> | undefined;

protected AdmZip = AdmZip;

Expand All @@ -44,7 +44,7 @@ export class Importer {

protected oldSettings: OldSettings;

protected lastProgressReportTotal = 0;
protected _lastProgressReportTotal = 0;

public importRecord: IImport;

Expand Down Expand Up @@ -77,7 +77,7 @@ export class Importer {
this.oldSettings = {};

this.progress.step = this.importRecord.status;
this.lastProgressReportTotal = 0;
this._lastProgressReportTotal = 0;
this.reloadCount();

this.logger.debug(`Constructed a new ${this.info.name} Importer.`);
Expand Down Expand Up @@ -332,12 +332,12 @@ export class Importer {
const count = this.progress.count.completed + this.progress.count.error;
const range = [ProgressStep.IMPORTING_USERS, ProgressStep.IMPORTING_CHANNELS].includes(this.progress.step) ? 50 : 500;

if (count % range === 0 || count >= this.progress.count.total || count - this.lastProgressReportTotal > range) {
this.lastProgressReportTotal = this.progress.count.completed + this.progress.count.error;
if (count % range === 0 || count >= this.progress.count.total || count - this._lastProgressReportTotal > range) {
this._lastProgressReportTotal = this.progress.count.completed + this.progress.count.error;
await this.updateRecord({ 'count.completed': this.progress.count.completed, 'count.error': this.progress.count.error });
this.reportProgress();
} else if (!this.reportProgressHandler) {
this.reportProgressHandler = setTimeout(() => {
} else if (!this._reportProgressHandler) {
this._reportProgressHandler = setTimeout(() => {
this.reportProgress();
}, 250);
}
Expand All @@ -351,9 +351,9 @@ export class Importer {
* Sends an updated progress to the websocket
*/
reportProgress() {
if (this.reportProgressHandler) {
clearTimeout(this.reportProgressHandler);
this.reportProgressHandler = undefined;
if (this._reportProgressHandler) {
clearTimeout(this._reportProgressHandler);
this._reportProgressHandler = undefined;
}
ImporterWebsocket.progressUpdated(this.progress);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/views/admin/import/NewImportPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function NewImportPage() {
refetchOnWindowFocus: false,
});

const options = useMemo(() => importers?.map(({ key, name }) => [key, name]) || [], [importers]);
const options = useMemo(() => importers?.map(({ key, name }) => [key, t(name)]) || [], [importers, t]);

const importerKey = useRouteParameter('importerKey');
const importer = useMemo(() => (importers || []).find(({ key }) => key === importerKey), [importerKey, importers]);
Expand Down
17 changes: 0 additions & 17 deletions apps/meteor/server/lib/translateForUser.ts

This file was deleted.

0 comments on commit 76243f7

Please sign in to comment.