summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/notes/global-timeline.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-05-28 21:59:57 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-05-28 21:59:57 +0900
commit43eb8bd99b09532b76de30b257bf02f47525fe69 (patch)
tree29841b466b113658b07350157dc756930ab68f6d /src/server/api/endpoints/notes/global-timeline.ts
parentMerge branch 'master' of https://github.com/syuilo/misskey (diff)
downloadsharkey-43eb8bd99b09532b76de30b257bf02f47525fe69.tar.gz
sharkey-43eb8bd99b09532b76de30b257bf02f47525fe69.tar.bz2
sharkey-43eb8bd99b09532b76de30b257bf02f47525fe69.zip
notes/local-timeline と notes/global-timeline のサインインを不要に
Diffstat (limited to 'src/server/api/endpoints/notes/global-timeline.ts')
-rw-r--r--src/server/api/endpoints/notes/global-timeline.ts28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/server/api/endpoints/notes/global-timeline.ts b/src/server/api/endpoints/notes/global-timeline.ts
index d22a1763de..7cf06c3af1 100644
--- a/src/server/api/endpoints/notes/global-timeline.ts
+++ b/src/server/api/endpoints/notes/global-timeline.ts
@@ -9,7 +9,7 @@ import { pack } from '../../../../models/note';
/**
* Get timeline of global
*/
-module.exports = async (params, user, app) => {
+module.exports = async (params, user) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
if (limitErr) throw 'invalid limit param';
@@ -36,9 +36,9 @@ module.exports = async (params, user, app) => {
}
// ミュートしているユーザーを取得
- const mutedUserIds = (await Mute.find({
+ const mutedUserIds = user ? (await Mute.find({
muterId: user._id
- })).map(m => m.muteeId);
+ })).map(m => m.muteeId) : null;
//#region Construct query
const sort = {
@@ -46,17 +46,23 @@ module.exports = async (params, user, app) => {
};
const query = {
- // mute
- userId: {
+ // public only
+ visibility: 'public'
+ } as any;
+
+ if (mutedUserIds && mutedUserIds.length > 0) {
+ query.userId = {
$nin: mutedUserIds
- },
- '_reply.userId': {
+ };
+
+ query['_reply.userId'] = {
$nin: mutedUserIds
- },
- '_renote.userId': {
+ };
+
+ query['_renote.userId'] = {
$nin: mutedUserIds
- }
- } as any;
+ };
+ }
if (sinceId) {
sort._id = 1;