mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
fix: better handling of missing of invalid to, cc, timestamp values
This commit is contained in:
@@ -72,11 +72,9 @@ inbox.like = async (req) => {
|
|||||||
|
|
||||||
inbox.announce = async (req) => {
|
inbox.announce = async (req) => {
|
||||||
const { actor, object, published, to, cc } = req.body;
|
const { actor, object, published, to, cc } = req.body;
|
||||||
let timestamp = Date.now();
|
let timestamp = new Date(published);
|
||||||
try {
|
if (timestamp.toString() === 'Invalid Date') {
|
||||||
timestamp = new Date(published).getTime();
|
timestamp = Date.now();
|
||||||
} catch (e) {
|
|
||||||
// ok to fail
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const assertion = await activitypub.actors.assert(actor);
|
const assertion = await activitypub.actors.assert(actor);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ Notes.assert = async (uid, input, options = {}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Notes.updateLocalRecipients = async (id, { to, cc }) => {
|
Notes.updateLocalRecipients = async (id, { to, cc }) => {
|
||||||
const recipients = new Set([...to, ...cc]);
|
const recipients = new Set([...(to || []), ...(cc || [])]);
|
||||||
const uids = new Set();
|
const uids = new Set();
|
||||||
await Promise.all(Array.from(recipients).map(async (recipient) => {
|
await Promise.all(Array.from(recipients).map(async (recipient) => {
|
||||||
const { type, id } = await activitypub.helpers.resolveLocalId(recipient);
|
const { type, id } = await activitypub.helpers.resolveLocalId(recipient);
|
||||||
|
|||||||
Reference in New Issue
Block a user