Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Sep 28, 2023
1 parent 526e084 commit 4de9078
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/server/api/endpoints/notes/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,16 @@ export default define(meta, async (ps, user, app) => {
throw new ApiError(meta.errors.noSuchNote);
}

const updatedAt = new Date();
const text = ps.text?.trim();
const cw = ps.cw ?? null;
const updates = {
updatedAt: new Date(),
text: ps.text?.trim(),
cw: ps.cw ?? null,
// TODO: tags, mentions, emojis
};

await Note.update({ _id: note._id }, {
$set: {
updatedAt, text, cw,
// TODO: tags, mentions, emojis
}
$set: updates
});

publishNoteStream(note._id, 'updated', {
updatedAt, text, cw,
});
publishNoteStream(note._id, 'updated', updates);
});

0 comments on commit 4de9078

Please sign in to comment.