diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js index 8ef3aac620..2425aea057 100644 --- a/src/activitypub/inbox.js +++ b/src/activitypub/inbox.js @@ -72,11 +72,9 @@ inbox.like = async (req) => { inbox.announce = async (req) => { const { actor, object, published, to, cc } = req.body; - let timestamp = Date.now(); - try { - timestamp = new Date(published).getTime(); - } catch (e) { - // ok to fail + let timestamp = new Date(published); + if (timestamp.toString() === 'Invalid Date') { + timestamp = Date.now(); } const assertion = await activitypub.actors.assert(actor); diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js index 747d896936..e360182b68 100644 --- a/src/activitypub/notes.js +++ b/src/activitypub/notes.js @@ -59,7 +59,7 @@ Notes.assert = async (uid, input, options = {}) => { }; Notes.updateLocalRecipients = async (id, { to, cc }) => { - const recipients = new Set([...to, ...cc]); + const recipients = new Set([...(to || []), ...(cc || [])]); const uids = new Set(); await Promise.all(Array.from(recipients).map(async (recipient) => { const { type, id } = await activitypub.helpers.resolveLocalId(recipient);