mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 00:43:49 +01:00
[backend] Fix errors in updateNote
This fixes incoming federation of poll edits
This commit is contained in:
parent
4d3d1b270c
commit
8b78709378
@ -568,7 +568,7 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Whether to tell clients the note has been updated and requires refresh.
|
// Whether to tell clients the note has been updated and requires refresh.
|
||||||
let publishing = false;
|
let updating = false;
|
||||||
|
|
||||||
// Text parsing
|
// Text parsing
|
||||||
let text: string | null = null;
|
let text: string | null = null;
|
||||||
@ -591,7 +591,6 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||||||
? post.attachment
|
? post.attachment
|
||||||
: [post.attachment]
|
: [post.attachment]
|
||||||
: [];
|
: [];
|
||||||
const files = fileList.map((f) => (f.sensitive = post.sensitive));
|
|
||||||
|
|
||||||
// Fetch files
|
// Fetch files
|
||||||
const limit = promiseLimit(2);
|
const limit = promiseLimit(2);
|
||||||
@ -617,7 +616,7 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||||||
|
|
||||||
if (notEmpty(update)) {
|
if (notEmpty(update)) {
|
||||||
await DriveFiles.update(file.id, update);
|
await DriveFiles.update(file.id, update);
|
||||||
publishing = true;
|
updating = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
@ -733,7 +732,7 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||||||
for (let i = 0; i < poll.choices.length; i++) {
|
for (let i = 0; i < poll.choices.length; i++) {
|
||||||
if (dbPoll.votes[i] !== poll.votes?.[i]) {
|
if (dbPoll.votes[i] !== poll.votes?.[i]) {
|
||||||
await Polls.update({ noteId: note.id }, { votes: poll?.votes });
|
await Polls.update({ noteId: note.id }, { votes: poll?.votes });
|
||||||
publishing = true;
|
updating = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -757,10 +756,10 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||||||
updatedAt: update.updatedAt,
|
updatedAt: update.updatedAt,
|
||||||
});
|
});
|
||||||
|
|
||||||
publishing = true;
|
updating = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (publishing) {
|
if (updating) {
|
||||||
// Publish update event for the updated note details
|
// Publish update event for the updated note details
|
||||||
publishNoteStream(note.id, "updated", {
|
publishNoteStream(note.id, "updated", {
|
||||||
updatedAt: update.updatedAt,
|
updatedAt: update.updatedAt,
|
||||||
@ -773,4 +772,6 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||||||
|
|
||||||
publishNoteUpdatesStream("updated", updatedNote);
|
publishNoteUpdatesStream("updated", updatedNote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,7 @@ export interface IPost extends IObject {
|
|||||||
quoteUrl?: string;
|
quoteUrl?: string;
|
||||||
quoteUri?: string;
|
quoteUri?: string;
|
||||||
_misskey_talk: boolean;
|
_misskey_talk: boolean;
|
||||||
|
_misskey_content?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IQuestion extends IObject {
|
export interface IQuestion extends IObject {
|
||||||
|
Loading…
Reference in New Issue
Block a user