From b1049bc149d5a9891d50a6e7546f91c278a5b086 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sun, 17 Nov 2019 21:16:52 -0600 Subject: When streaming posts to timelines, do not apply filters to the author's own posts. --- streaming/index.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'streaming/index.js') diff --git a/streaming/index.js b/streaming/index.js index 01bd6ea95..cde3069ba 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -328,6 +328,11 @@ const startWorker = (workerId) => { output(event, encodedPayload); }; + if (!req.accountId) { + log.error(req.requestId, `Unauthorized: ${accountId} is not logged in.`) + return; + } + if (notificationOnly && event !== 'notification') { return; } @@ -354,14 +359,14 @@ const startWorker = (workerId) => { const targetAccountIds = [unpackedPayload.account.id].concat(unpackedPayload.mentions.map(item => item.id)); const accountDomain = unpackedPayload.account.acct.split('@')[1]; - if (Array.isArray(req.chosenLanguages) && unpackedPayload.language !== null && req.chosenLanguages.indexOf(unpackedPayload.language) === -1) { - log.silly(req.requestId, `Message ${unpackedPayload.id} filtered by language (${unpackedPayload.language})`); - return; + // Don't filter user's own events. + if (req.accountId === unpackedPayload.account.id) { + transmit(); + return } - // When the account is not logged in, it is not necessary to confirm the block or mute - if (!req.accountId) { - transmit(); + if (Array.isArray(req.chosenLanguages) && unpackedPayload.language !== null && req.chosenLanguages.indexOf(unpackedPayload.language) === -1) { + log.silly(req.requestId, `Message ${unpackedPayload.id} filtered by language (${unpackedPayload.language})`); return; } -- cgit