summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/notes
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2019-01-29 17:34:43 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-01-29 17:34:43 +0900
commit2ed9e26a4fc6ece9b510538ac6c48a62eb8536d1 (patch)
treebbefc668c1b611d1ad083bf7fed49381ed70ce14 /src/server/api/endpoints/notes
parentSort tasks by topological ordering (diff)
downloadsharkey-2ed9e26a4fc6ece9b510538ac6c48a62eb8536d1.tar.gz
sharkey-2ed9e26a4fc6ece9b510538ac6c48a62eb8536d1.tar.bz2
sharkey-2ed9e26a4fc6ece9b510538ac6c48a62eb8536d1.zip
リプライ/メンションされていれば非フォロワーへのフォロワー限定でも参照可能に (#4033)
* 非メンション/リプライ投稿がmentionsにあるかどうかはvisibilityと関係ないので削除 * リプライ/メンションされていれば非フォロワーでも参照可能に
Diffstat (limited to 'src/server/api/endpoints/notes')
-rw-r--r--src/server/api/endpoints/notes/mentions.ts13
-rw-r--r--src/server/api/endpoints/notes/replies.ts13
2 files changed, 22 insertions, 4 deletions
diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts
index 8747590606..e37d475df7 100644
--- a/src/server/api/endpoints/notes/mentions.ts
+++ b/src/server/api/endpoints/notes/mentions.ts
@@ -53,14 +53,23 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
const visibleQuery = [{
visibility: { $in: [ 'public', 'home' ] }
}, {
- // myself (for specified/private)
+ // myself (for followers/specified/private)
userId: user._id
}, {
// to me (for specified)
visibleUserIds: { $in: [ user._id ] }
}, {
visibility: 'followers',
- userId: { $in: followings.map(f => f.id) }
+ $or: [{
+ // フォロワーの投稿
+ userId: { $in: followings.map(f => f.id) },
+ }, {
+ // 自分の投稿へのリプライ
+ '_reply.userId': user._id,
+ }, {
+ // 自分へのメンションが含まれている
+ mentions: { $in: [ user._id ] }
+ }]
}];
const query = {
diff --git a/src/server/api/endpoints/notes/replies.ts b/src/server/api/endpoints/notes/replies.ts
index 112156403d..199139c8e5 100644
--- a/src/server/api/endpoints/notes/replies.ts
+++ b/src/server/api/endpoints/notes/replies.ts
@@ -51,14 +51,23 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
}] : [{
visibility: { $in: [ 'public', 'home' ] }
}, {
- // myself (for specified/private)
+ // myself (for followers/specified/private)
userId: user._id
}, {
// to me (for specified)
visibleUserIds: { $in: [ user._id ] }
}, {
visibility: 'followers',
- userId: { $in: followings.map(f => f.id) }
+ $or: [{
+ // フォロワーの投稿
+ userId: { $in: followings.map(f => f.id) },
+ }, {
+ // 自分の投稿へのリプライ
+ '_reply.userId': user._id,
+ }, {
+ // 自分へのメンションが含まれている
+ mentions: { $in: [ user._id ] }
+ }]
}];
const q = {