about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-11-17 21:16:52 -0600
committermultiple creatures <dev@multiple-creature.party>2019-11-18 02:19:05 -0600
commitb1049bc149d5a9891d50a6e7546f91c278a5b086 (patch)
tree8241da9612d7c5e55bf0b745ff3b9fbdedfd9bfb
parent68fa5ca1b7c2ea8cb4bb1bcfa17210457f3df6b6 (diff)
When streaming posts to timelines, do not apply filters to the author's own posts.
-rw-r--r--streaming/index.js17
1 files changed, 11 insertions, 6 deletions
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;
       }