summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-04-18 14:34:47 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-04-18 14:34:47 +0900
commitd78a5c0863b75ad51f739caf6c6eb129cc958b36 (patch)
treef0e0facf7152380098fe36401f40d4786eb579df
parentAdd type annotations (diff)
downloadmisskey-d78a5c0863b75ad51f739caf6c6eb129cc958b36.tar.gz
misskey-d78a5c0863b75ad51f739caf6c6eb129cc958b36.tar.bz2
misskey-d78a5c0863b75ad51f739caf6c6eb129cc958b36.zip
Fix #4703
-rw-r--r--src/server/api/stream/channels/hybrid-timeline.ts4
-rw-r--r--test/streaming.ts25
2 files changed, 27 insertions, 2 deletions
diff --git a/src/server/api/stream/channels/hybrid-timeline.ts b/src/server/api/stream/channels/hybrid-timeline.ts
index 18e6aa8350..5bf23715ef 100644
--- a/src/server/api/stream/channels/hybrid-timeline.ts
+++ b/src/server/api/stream/channels/hybrid-timeline.ts
@@ -20,11 +20,11 @@ export default class extends Channel {
@autobind
private async onNote(note: any) {
- // 自分自身の投稿 または その投稿のユーザーをフォローしている または ローカルの投稿 の場合だけ
+ // 自分自身の投稿 または その投稿のユーザーをフォローしている または ホームのローカルの投稿 の場合だけ
if (!(
this.user!.id === note.userId ||
this.following.includes(note.userId) ||
- note.user.host == null
+ (note.user.host == null && note.visibility === 'home')
)) return;
if (['followers', 'specified'].includes(note.visibility)) {
diff --git a/test/streaming.ts b/test/streaming.ts
index a29517148a..a9c90c216f 100644
--- a/test/streaming.ts
+++ b/test/streaming.ts
@@ -484,6 +484,31 @@ describe('Streaming', () => {
});
}));
+ it('フォローしていないローカルユーザーのホーム投稿は流れない', () => new Promise(async done => {
+ const alice = await signup({ username: 'alice' });
+ const bob = await signup({ username: 'bob' });
+
+ let fired = false;
+
+ const ws = await connectStream(alice, 'hybridTimeline', ({ type, body }) => {
+ if (type == 'note') {
+ fired = true;
+ }
+ });
+
+ // ホーム投稿
+ post(bob, {
+ text: 'foo',
+ visibility: 'home'
+ });
+
+ setTimeout(() => {
+ assert.strictEqual(fired, false);
+ ws.close();
+ done();
+ }, 3000);
+ }));
+
it('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', () => new Promise(async done => {
const alice = await signup({ username: 'alice' });
const bob = await signup({ username: 'bob' });