From 977a4373c52790265a69cf72f31137dfd2cb79c9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 21 Jan 2019 00:32:54 +0900 Subject: [PATCH] [Server] Fix #2745 --- CHANGELOG.md | 1 + .../api/endpoints/notes/user-list-timeline.ts | 18 ++++++++++++------ src/server/api/stream/channels/user-list.ts | 7 ++++++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35575f272..b4cf19147 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ unreleased * ハッシュタグ判定の強化 * ストーク機能の廃止 * ソーシャルタイムラインにフォロワー限定投稿が含まれていない問題を修正 +* リストタイムラインでフォロワー限定投稿が含まれていない問題を修正 * ストリームで投稿が流れてきたとき、返信先が「この投稿は非公開です」となる問題を修正 * 関係のない返信がタイムラインに流れる問題を修正 * 常にメディアを閲覧注意として投稿するオプションが機能していなかった問題を修正 diff --git a/src/server/api/endpoints/notes/user-list-timeline.ts b/src/server/api/endpoints/notes/user-list-timeline.ts index eab3b9788..99b063377 100644 --- a/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/src/server/api/endpoints/notes/user-list-timeline.ts @@ -4,6 +4,7 @@ import Mute from '../../../../models/mute'; import { packMany } from '../../../../models/note'; import UserList from '../../../../models/user-list'; import define from '../../define'; +import { getFriends } from '../../common/get-friends'; export const meta = { desc: { @@ -101,7 +102,7 @@ export const meta = { }; export default define(meta, (ps, user) => new Promise(async (res, rej) => { - const [list, mutedUserIds] = await Promise.all([ + const [list, followings, mutedUserIds] = await Promise.all([ // リストを取得 // Fetch the list UserList.findOne({ @@ -109,6 +110,10 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { userId: user._id }), + // フォローを取得 + // Fetch following + getFriends(user._id, true, false), + // ミュートしているユーザーを取得 Mute.find({ muterId: user._id @@ -146,16 +151,17 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { }] })); - const visibleQuery = user == null ? [{ - visibility: { $in: [ 'public', 'home' ] } - }] : [{ - visibility: { $in: [ 'public', 'home' ] } + const visibleQuery = [{ + visibility: { $in: ['public', 'home'] } }, { // myself (for specified/private) userId: user._id }, { // to me (for specified) - visibleUserIds: { $in: [ user._id ] } + visibleUserIds: { $in: [user._id] } + }, { + visibility: 'followers', + userId: { $in: followings.map(f => f.id) } }]; const query = { diff --git a/src/server/api/stream/channels/user-list.ts b/src/server/api/stream/channels/user-list.ts index dbdd8afb0..5debf4177 100644 --- a/src/server/api/stream/channels/user-list.ts +++ b/src/server/api/stream/channels/user-list.ts @@ -1,5 +1,6 @@ import autobind from 'autobind-decorator'; import Channel from '../channel'; +import { pack } from '../../../../models/note'; export default class extends Channel { public readonly chName = 'userList'; @@ -11,7 +12,11 @@ export default class extends Channel { const listId = params.listId as string; // Subscribe stream - this.subscriber.on(`userListStream:${listId}`, data => { + this.subscriber.on(`userListStream:${listId}`, async data => { + // 再パック + if (data.type == 'note') data.body = await pack(data.body.id, this.user, { + detail: true + }); this.send(data); }); }