Apply suggestions

This commit is contained in:
Marie 2024-12-09 05:58:25 +01:00
parent 1d0fd4c40b
commit 152cc07483
No known key found for this signature in database
GPG key ID: 7ADF6C9CD9A28555
3 changed files with 9 additions and 4 deletions

View file

@ -10,6 +10,7 @@ import { NoteCreateService } from '@/core/NoteCreateService.js';
import type { ChannelsRepository, DriveFilesRepository, MiDriveFile, NoteScheduleRepository, NotesRepository, UsersRepository } from '@/models/_.js'; import type { ChannelsRepository, DriveFilesRepository, MiDriveFile, NoteScheduleRepository, NotesRepository, UsersRepository } from '@/models/_.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { NotificationService } from '@/core/NotificationService.js'; import { NotificationService } from '@/core/NotificationService.js';
import { IdentifiableError } from '@/misc/identifiable-error.js';
import { QueueLoggerService } from '../QueueLoggerService.js'; import { QueueLoggerService } from '../QueueLoggerService.js';
import type * as Bull from 'bullmq'; import type * as Bull from 'bullmq';
import type { ScheduleNotePostJobData } from '../types.js'; import type { ScheduleNotePostJobData } from '../types.js';
@ -119,6 +120,12 @@ export class ScheduleNotePostProcessorService {
reply, reply,
renote, renote,
channel, channel,
}).catch(async (err: IdentifiableError) => {
this.notificationService.createNotification(me.id, 'scheduledNoteFailed', {
reason: err.message,
});
await this.noteScheduleRepository.remove(data);
throw this.logger.error(`Schedule Note Failed Reason: ${err.message}`);
}); });
await this.noteScheduleRepository.remove(data); await this.noteScheduleRepository.remove(data);
this.notificationService.createNotification(me.id, 'scheduledNotePosted', { this.notificationService.createNotification(me.id, 'scheduledNotePosted', {

View file

@ -360,7 +360,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}, { }, {
delay, delay,
removeOnComplete: true, removeOnComplete: true,
jobId: noteId, jobId: `schedNote:${noteId}`,
}); });
} }

View file

@ -821,7 +821,7 @@ async function post(ev?: MouseEvent) {
const filesData = toRaw(files.value); const filesData = toRaw(files.value);
const isMissingAltText = filesData.filter( const isMissingAltText = filesData.filter(
file => file.type.startsWith('image/') || file.type.startsWith('video/') || file.type.startsWith('audio/') file => file.type.startsWith('image/') || file.type.startsWith('video/') || file.type.startsWith('audio/'),
).some(file => !file.comment); ).some(file => !file.comment);
if (isMissingAltText) { if (isMissingAltText) {
@ -914,8 +914,6 @@ async function post(ev?: MouseEvent) {
claimAchievement('notes1'); claimAchievement('notes1');
} }
poll.value = null;
const text = postData.text ?? ''; const text = postData.text ?? '';
const lowerCase = text.toLowerCase(); const lowerCase = text.toLowerCase();
if ((lowerCase.includes('love') || lowerCase.includes('❤')) && lowerCase.includes('sharkey')) { if ((lowerCase.includes('love') || lowerCase.includes('❤')) && lowerCase.includes('sharkey')) {