summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteEditService.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-11-28 11:17:27 +0000
committerdakkar <dakkar@thenautilus.net>2024-11-28 11:17:27 +0000
commiteb25238a8eca0ef2adab4aab80de44375c086ed5 (patch)
treeea246e1c8d4d2dbc79054c7d4750213beb1cfae7 /packages/backend/src/core/NoteEditService.ts
parenthonour blocks and "signing required" for note versions (diff)
parentmerge: Bump develop version (!789) (diff)
downloadsharkey-eb25238a8eca0ef2adab4aab80de44375c086ed5.tar.gz
sharkey-eb25238a8eca0ef2adab4aab80de44375c086ed5.tar.bz2
sharkey-eb25238a8eca0ef2adab4aab80de44375c086ed5.zip
Merge branch 'develop' into feature/2024.10
Diffstat (limited to 'packages/backend/src/core/NoteEditService.ts')
-rw-r--r--packages/backend/src/core/NoteEditService.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts
index 1bb3a723b1..f1c7bcbea5 100644
--- a/packages/backend/src/core/NoteEditService.ts
+++ b/packages/backend/src/core/NoteEditService.ts
@@ -471,8 +471,9 @@ export class NoteEditService implements OnApplicationShutdown {
const poll = await this.pollsRepository.findOneBy({ noteId: oldnote.id });
const oldPoll = poll ? { choices: poll.choices, multiple: poll.multiple, expiresAt: poll.expiresAt } : null;
+ const pollChanged = data.poll != null && JSON.stringify(data.poll) !== JSON.stringify(oldPoll);
- if (Object.keys(update).length > 0 || filesChanged) {
+ if (Object.keys(update).length > 0 || filesChanged || pollChanged) {
const exists = await this.noteEditRepository.findOneBy({ noteId: oldnote.id });
await this.noteEditRepository.insert({
@@ -544,7 +545,7 @@ export class NoteEditService implements OnApplicationShutdown {
}));
}
- if (data.poll != null && JSON.stringify(data.poll) !== JSON.stringify(oldPoll)) {
+ if (pollChanged) {
// Start transaction
await this.db.transaction(async transactionalEntityManager => {
await transactionalEntityManager.update(MiNote, oldnote.id, note);
@@ -609,10 +610,11 @@ export class NoteEditService implements OnApplicationShutdown {
if (data.poll && data.poll.expiresAt) {
const delay = data.poll.expiresAt.getTime() - Date.now();
- this.queueService.endedPollNotificationQueue.remove(note.id);
+ this.queueService.endedPollNotificationQueue.remove(`pollEnd:${note.id}`);
this.queueService.endedPollNotificationQueue.add(note.id, {
noteId: note.id,
}, {
+ jobId: `pollEnd:${note.id}`,
delay,
removeOnComplete: true,
});