feat: アンケート終了通知

Resolve #4664
This commit is contained in:
syuilo
2022-03-06 16:06:27 +09:00
parent 8bb586c1fd
commit 2442592ef1
14 changed files with 108 additions and 10 deletions

View File

@ -34,6 +34,7 @@ import { deliverToRelays } from '../relay.js';
import { Channel } from '@/models/entities/channel.js';
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
import { getAntennas } from '@/misc/antenna-cache.js';
import { endedPollNotificationQueue } from '@/queue/queues.js';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
@ -296,6 +297,15 @@ export default async (user: { id: User['id']; username: User['username']; host:
incRenoteCount(data.renote);
}
if (data.poll && data.poll.expiresAt) {
const delay = data.poll.expiresAt.getTime() - Date.now();
endedPollNotificationQueue.add({
noteId: note.id,
}, {
delay
});
}
if (!silent) {
if (Users.isLocalUser(user)) activeUsersChart.write(user);