mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-21 17:37:29 -07:00
[backend] Fix errors in updateNote
This fixes incoming federation of poll edits
This commit is contained in:
parent
4d3d1b270c
commit
8b78709378
2 changed files with 8 additions and 6 deletions
|
@ -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.
|
||||
let publishing = false;
|
||||
let updating = false;
|
||||
|
||||
// Text parsing
|
||||
let text: string | null = null;
|
||||
|
@ -591,7 +591,6 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||
? post.attachment
|
||||
: [post.attachment]
|
||||
: [];
|
||||
const files = fileList.map((f) => (f.sensitive = post.sensitive));
|
||||
|
||||
// Fetch files
|
||||
const limit = promiseLimit(2);
|
||||
|
@ -617,7 +616,7 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||
|
||||
if (notEmpty(update)) {
|
||||
await DriveFiles.update(file.id, update);
|
||||
publishing = true;
|
||||
updating = true;
|
||||
}
|
||||
|
||||
return file;
|
||||
|
@ -733,7 +732,7 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||
for (let i = 0; i < poll.choices.length; i++) {
|
||||
if (dbPoll.votes[i] !== poll.votes?.[i]) {
|
||||
await Polls.update({ noteId: note.id }, { votes: poll?.votes });
|
||||
publishing = true;
|
||||
updating = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -757,10 +756,10 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||
updatedAt: update.updatedAt,
|
||||
});
|
||||
|
||||
publishing = true;
|
||||
updating = true;
|
||||
}
|
||||
|
||||
if (publishing) {
|
||||
if (updating) {
|
||||
// Publish update event for the updated note details
|
||||
publishNoteStream(note.id, "updated", {
|
||||
updatedAt: update.updatedAt,
|
||||
|
@ -773,4 +772,6 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
|||
|
||||
publishNoteUpdatesStream("updated", updatedNote);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -138,6 +138,7 @@ export interface IPost extends IObject {
|
|||
quoteUrl?: string;
|
||||
quoteUri?: string;
|
||||
_misskey_talk: boolean;
|
||||
_misskey_content?: string;
|
||||
}
|
||||
|
||||
export interface IQuestion extends IObject {
|
||||
|
|
Loading…
Reference in a new issue