diff options
Diffstat (limited to 'src/server/api/endpoints/notes/timeline.ts')
| -rw-r--r-- | src/server/api/endpoints/notes/timeline.ts | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/server/api/endpoints/notes/timeline.ts b/src/server/api/endpoints/notes/timeline.ts index faa8ccf3ca..3e3fa8c4aa 100644 --- a/src/server/api/endpoints/notes/timeline.ts +++ b/src/server/api/endpoints/notes/timeline.ts @@ -8,7 +8,8 @@ import getParams from '../../get-params'; export const meta = { desc: { - ja: 'タイムラインを取得します。' + ja: 'タイムラインを取得します。', + en: 'Get timeline of myself.' }, requireCredential: true, @@ -59,6 +60,13 @@ export const meta = { } }), + includeLocalRenotes: $.bool.optional.note({ + default: true, + desc: { + ja: 'Renoteされたローカルの投稿を含めるかどうか' + } + }), + mediaOnly: $.bool.optional.note({ desc: { ja: 'true にすると、メディアが添付された投稿だけ取得します' @@ -67,9 +75,6 @@ export const meta = { } }; -/** - * Get timeline of myself - */ export default async (params: any, user: ILocalUser) => { const [ps, psErr] = getParams(meta, params); if (psErr) throw psErr; @@ -172,6 +177,22 @@ export default async (params: any, user: ILocalUser) => { }); } + if (ps.includeLocalRenotes === false) { + query.$and.push({ + $or: [{ + '_renote.user.host': { $ne: null } + }, { + renoteId: null + }, { + text: { $ne: null } + }, { + mediaIds: { $ne: [] } + }, { + poll: { $ne: null } + }] + }); + } + if (ps.mediaOnly) { query.$and.push({ mediaIds: { $exists: true, $ne: [] } |