about summary refs log tree commit diff
path: root/streaming
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-05-30 01:01:08 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-29 18:01:08 +0200
commit91c789ec630757b1de6e0b84aa6b6dac55c6998b (patch)
treeeff9ed4b7d582822576c05777aaad48638fabdcf /streaming
parent9ead3d1cdbac2cc40d8926be116cbe15cbf7f24d (diff)
Don't stream toots from users who have blocked the recipient user (#3300)
* Don't stream toots from users who have blocked the recipient user

This filter was already applied on the `/api/v1/timelines/public` API, but
not yet for the Streaming API.

* Boosted status' account_id doesn't need for filtering in streaming/index.js

This filtering is only for public/hashtag timelines, but boosts already filtered on FanOutOnWriteService because those timelines don't show boosts.
Diffstat (limited to 'streaming')
-rw-r--r--streaming/index.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 52b5ccced..fe39cf21d 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -240,7 +240,7 @@ const startWorker = (workerId) => {
           }
 
           const unpackedPayload  = JSON.parse(payload);
-          const targetAccountIds = [unpackedPayload.account.id].concat(unpackedPayload.mentions.map(item => item.id)).concat(unpackedPayload.reblog ? [unpackedPayload.reblog.account.id] : []);
+          const targetAccountIds = [unpackedPayload.account.id].concat(unpackedPayload.mentions.map(item => item.id));
           const accountDomain    = unpackedPayload.account.acct.split('@')[1];
 
           if (Array.isArray(req.filteredLanguages) && req.filteredLanguages.includes(unpackedPayload.language)) {
@@ -250,7 +250,7 @@ const startWorker = (workerId) => {
           }
 
           const queries = [
-            client.query(`SELECT 1 FROM blocks WHERE account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 1)}) UNION SELECT 1 FROM mutes WHERE account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 1)})`, [req.accountId].concat(targetAccountIds)),
+            client.query(`SELECT 1 FROM blocks WHERE (account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 2)})) OR (account_id = $2 AND target_account_id = $1) UNION SELECT 1 FROM mutes WHERE account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 2)})`, [req.accountId, unpackedPayload.account.id].concat(targetAccountIds)),
           ];
 
           if (accountDomain) {