Add importCompleted notification. Send importCompleted when antenna/customEmoji/muting/userList is imported
The only userImportableEntities that don't notify are blocking and following because they fork off a batch of single Closes #891
This commit is contained in:
parent
69f3c8a58e
commit
a00a3c6841
14 changed files with 104 additions and 7 deletions
|
|
@ -12,6 +12,7 @@ import type { AntennasRepository, UsersRepository } from '@/models/_.js';
|
|||
import { DI } from '@/di-symbols.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import { NotificationService } from '@/core/NotificationService.js';
|
||||
import { DBAntennaImportJobData } from '../types.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
|
||||
|
|
@ -65,6 +66,7 @@ export class ImportAntennasProcessorService {
|
|||
private queueLoggerService: QueueLoggerService,
|
||||
private idService: IdService,
|
||||
private globalEventService: GlobalEventService,
|
||||
private notificationService: NotificationService,
|
||||
) {
|
||||
this.logger = this.queueLoggerService.logger.createSubLogger('import-antennas');
|
||||
}
|
||||
|
|
@ -106,6 +108,10 @@ export class ImportAntennasProcessorService {
|
|||
this.logger.debug('Antenna created: ' + result.id);
|
||||
this.globalEventService.publishInternalEvent('antennaCreated', result);
|
||||
}
|
||||
|
||||
this.notificationService.createNotification(job.data.user.id, 'importCompleted', {
|
||||
importedEntity: 'antenna',
|
||||
});
|
||||
} catch (err: any) {
|
||||
this.logger.error('Error importing antennas:', err);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import { bindThis } from '@/decorators.js';
|
|||
import type { Config } from '@/config.js';
|
||||
import { renderInlineError } from '@/misc/render-inline-error.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import { NotificationService } from '@/core/NotificationService.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
import type { DbUserImportJobData } from '../types.js';
|
||||
|
||||
|
|
@ -40,6 +41,7 @@ export class ImportCustomEmojisProcessorService {
|
|||
private driveService: DriveService,
|
||||
private downloadService: DownloadService,
|
||||
private queueLoggerService: QueueLoggerService,
|
||||
private notificationService: NotificationService,
|
||||
) {
|
||||
this.logger = this.queueLoggerService.logger.createSubLogger('import-custom-emojis');
|
||||
}
|
||||
|
|
@ -127,7 +129,12 @@ export class ImportCustomEmojisProcessorService {
|
|||
|
||||
cleanup();
|
||||
|
||||
this.logger.debug('Imported');
|
||||
this.notificationService.createNotification(job.data.user.id, 'importCompleted', {
|
||||
importedEntity: 'customEmoji',
|
||||
fileId: file.id,
|
||||
});
|
||||
|
||||
this.logger.debug('Imported', file.name);
|
||||
} catch (e) {
|
||||
this.logger.error('Error importing custom emojis:', e as Error);
|
||||
cleanup();
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { UtilityService } from '@/core/UtilityService.js';
|
|||
import { bindThis } from '@/decorators.js';
|
||||
import { renderInlineError } from '@/misc/render-inline-error.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import { NotificationService } from '@/core/NotificationService.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
import type { DbUserImportJobData } from '../types.js';
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ export class ImportMutingProcessorService {
|
|||
private remoteUserResolveService: RemoteUserResolveService,
|
||||
private downloadService: DownloadService,
|
||||
private queueLoggerService: QueueLoggerService,
|
||||
private notificationService: NotificationService,
|
||||
) {
|
||||
this.logger = this.queueLoggerService.logger.createSubLogger('import-muting');
|
||||
}
|
||||
|
|
@ -99,6 +101,11 @@ export class ImportMutingProcessorService {
|
|||
}
|
||||
}
|
||||
|
||||
this.notificationService.createNotification(job.data.user.id, 'importCompleted', {
|
||||
importedEntity: 'muting',
|
||||
fileId: file.id,
|
||||
});
|
||||
|
||||
this.logger.debug('Imported');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import { UtilityService } from '@/core/UtilityService.js';
|
|||
import { bindThis } from '@/decorators.js';
|
||||
import { renderInlineError } from '@/misc/render-inline-error.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import { NotificationService } from '@/core/NotificationService.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
import type { DbUserImportJobData } from '../types.js';
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ export class ImportUserListsProcessorService {
|
|||
private remoteUserResolveService: RemoteUserResolveService,
|
||||
private downloadService: DownloadService,
|
||||
private queueLoggerService: QueueLoggerService,
|
||||
private notificationService: NotificationService,
|
||||
) {
|
||||
this.logger = this.queueLoggerService.logger.createSubLogger('import-user-lists');
|
||||
}
|
||||
|
|
@ -109,6 +111,11 @@ export class ImportUserListsProcessorService {
|
|||
}
|
||||
}
|
||||
|
||||
this.notificationService.createNotification(job.data.user.id, 'importCompleted', {
|
||||
importedEntity: 'userList',
|
||||
fileId: file.id,
|
||||
});
|
||||
|
||||
this.logger.debug('Imported');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue