mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +01:00
feat: handle Update(note)
This commit is contained in:
@@ -15,14 +15,18 @@ Notes.resolveId = async (uid, id) => {
|
||||
|
||||
// todo: when asserted, notes aren't added to a global sorted set
|
||||
// also, db.exists call is probably expensive
|
||||
Notes.assert = async (uid, input) => {
|
||||
Notes.assert = async (uid, input, options = {}) => {
|
||||
// Ensures that each note has been saved to the database
|
||||
await Promise.all(input.map(async (item) => {
|
||||
const id = activitypub.helpers.isUri(item) ? item : item.pid;
|
||||
const key = `post:${id}`;
|
||||
const exists = await db.exists(key);
|
||||
let exists = await db.exists(key);
|
||||
winston.verbose(`[activitypub/notes.assert] Asserting note id ${id}`);
|
||||
|
||||
if (options.update === true) {
|
||||
exists = false;
|
||||
}
|
||||
|
||||
if (!exists) {
|
||||
let postData;
|
||||
winston.verbose(`[activitypub/notes.assert] Not found, saving note to database`);
|
||||
|
||||
Reference in New Issue
Block a user