This commit is contained in:
syuilo 2019-04-18 14:34:47 +09:00
parent 683e5b6abe
commit d78a5c0863
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
2 changed files with 27 additions and 2 deletions

View file

@ -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)) {

View file

@ -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' });