2023-10-03 11:26:11 +00:00
|
|
|
|
/*
|
2024-02-13 15:59:27 +00:00
|
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-10-03 11:26:11 +00:00
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
*/
|
|
|
|
|
|
2023-10-09 03:36:25 +00:00
|
|
|
|
// How to run:
|
|
|
|
|
// pnpm jest -- e2e/timelines.ts
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
import * as assert from 'assert';
|
2024-07-02 05:47:07 +00:00
|
|
|
|
import { setTimeout } from 'node:timers/promises';
|
2024-06-22 03:43:03 +00:00
|
|
|
|
import { Redis } from 'ioredis';
|
2024-07-02 05:47:07 +00:00
|
|
|
|
import { api, post, randomString, sendEnvUpdateRequest, signup, uploadUrl } from '../utils.js';
|
2024-07-25 07:37:46 +00:00
|
|
|
|
import { loadConfig } from '@/config.js';
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2023-10-04 02:32:33 +00:00
|
|
|
|
function genHost() {
|
|
|
|
|
return randomString() + '.example.com';
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
function waitForPushToTl() {
|
2024-07-02 05:47:07 +00:00
|
|
|
|
return setTimeout(500);
|
2023-10-04 07:12:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-22 03:43:03 +00:00
|
|
|
|
let redisForTimelines: Redis;
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
describe('Timelines', () => {
|
2024-06-22 03:43:03 +00:00
|
|
|
|
beforeAll(() => {
|
|
|
|
|
redisForTimelines = new Redis(loadConfig().redisForTimelines);
|
|
|
|
|
});
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
describe('Home TL', () => {
|
|
|
|
|
test.concurrent('自分の visibility: followers なノートが含まれる', async () => {
|
|
|
|
|
const [alice] = await Promise.all([signup()]);
|
|
|
|
|
|
|
|
|
|
const aliceNote = await post(alice, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'hi');
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーのノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーの visibility: followers なノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi');
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('withReplies: false でフォローしているユーザーの他人への返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('withReplies: true でフォローしているユーザーの他人への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
await api('following/update', { userId: bob.id, withReplies: true }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('withReplies: true でフォローしているユーザーの他人へのDM返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
await api('following/update', { userId: bob.id, withReplies: true }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id, visibility: 'specified', visibleUserIds: [carolNote.id] });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('withReplies: true でフォローしているユーザーの他人の visibility: followers な投稿への返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
await api('following/update', { userId: bob.id, withReplies: true }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('withReplies: true でフォローしているユーザーの行った別のフォローしているユーザーの visibility: followers な投稿への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
await api('following/create', { userId: carol.id }, alice);
|
|
|
|
|
await api('following/create', { userId: carol.id }, bob);
|
|
|
|
|
await api('following/update', { userId: bob.id, withReplies: true }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === carolNote.id)?.text, 'hi');
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('withReplies: true でフォローしているユーザーの行った別のフォローしているユーザーの投稿への visibility: specified な返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
await api('following/create', { userId: carol.id }, alice);
|
|
|
|
|
await api('following/update', { userId: bob.id, withReplies: true }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id, visibility: 'specified', visibleUserIds: [carolNote.id] });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('withReplies: false でフォローしているユーザーのそのユーザー自身への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { text: 'hi', replyId: bobNote1.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-10 23:18:00 +00:00
|
|
|
|
test.concurrent('withReplies: false でフォローしているユーザーからの自分への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: aliceNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
test.concurrent('自分の他人への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
const aliceNote = await post(alice, { text: 'hi', replyId: bobNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーの他人の投稿のリノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { renoteId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('[withRenotes: false] フォローしているユーザーの他人の投稿のリノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { renoteId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', {
|
2023-10-03 11:26:11 +00:00
|
|
|
|
withRenotes: false,
|
|
|
|
|
}, alice);
|
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('[withRenotes: false] フォローしているユーザーの他人の投稿の引用が含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', renoteId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', {
|
2023-10-03 11:26:11 +00:00
|
|
|
|
withRenotes: false,
|
|
|
|
|
}, alice);
|
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーの他人への visibility: specified なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'specified', visibleUserIds: [carol.id] });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーが行ったミュートしているユーザーのリノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
await api('mute/create', { userId: carol.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', renoteId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('withReplies: true でフォローしているユーザーが行ったミュートしているユーザーの投稿への返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
await api('following/update', { userId: bob.id, withReplies: true }, alice);
|
|
|
|
|
await api('mute/create', { userId: carol.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているリモートユーザーのノートが含まれる', async () => {
|
2023-10-04 02:32:33 +00:00
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup({ host: genHost() })]);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-01-08 08:43:52 +00:00
|
|
|
|
await sendEnvUpdateRequest({ key: 'FORCE_FOLLOW_REMOTE_USER_FOR_TESTING', value: 'true' });
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-01-08 08:43:52 +00:00
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているリモートユーザーの visibility: home なノートが含まれる', async () => {
|
2023-10-04 02:32:33 +00:00
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup({ host: genHost() })]);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-01-08 08:43:52 +00:00
|
|
|
|
await sendEnvUpdateRequest({ key: 'FORCE_FOLLOW_REMOTE_USER_FOR_TESTING', value: 'true' });
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-01-08 08:43:52 +00:00
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'home' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('[withFiles: true] フォローしているユーザーのファイル付きノートのみ含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const [bobFile, carolFile] = await Promise.all([
|
2023-12-22 00:06:13 +00:00
|
|
|
|
uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/assets/main/public/icon.png'),
|
|
|
|
|
uploadUrl(carol, 'https://raw.githubusercontent.com/misskey-dev/assets/main/public/icon.png'),
|
2023-10-03 11:26:11 +00:00
|
|
|
|
]);
|
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { fileIds: [bobFile.id] });
|
|
|
|
|
const carolNote1 = await post(carol, { text: 'hi' });
|
|
|
|
|
const carolNote2 = await post(carol, { fileIds: [carolFile.id] });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100, withFiles: true }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote1.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote2.id), false);
|
2024-07-20 12:33:20 +00:00
|
|
|
|
}, 1000 * 10);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーのチャンネル投稿が含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const channel = await api('channels/create', { name: 'channel' }, bob).then(x => x.body);
|
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', channelId: channel.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
});
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
|
|
|
|
test.concurrent('自分の visibility: specified なノートが含まれる', async () => {
|
|
|
|
|
const [alice] = await Promise.all([signup()]);
|
|
|
|
|
|
|
|
|
|
const aliceNote = await post(alice, { text: 'hi', visibility: 'specified' });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'hi');
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーの自身を visibleUserIds に指定した visibility: specified なノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'specified', visibleUserIds: [alice.id] });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi');
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしていないユーザーの自身を visibleUserIds に指定した visibility: specified なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'specified', visibleUserIds: [alice.id] });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーの自身を visibleUserIds に指定していない visibility: specified なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'specified', visibleUserIds: [carol.id] });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしていないユーザーからの visibility: specified なノートに返信したときの自身のノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'specified', visibleUserIds: [alice.id] });
|
|
|
|
|
const aliceNote = await post(alice, { text: 'ok', visibility: 'specified', visibleUserIds: [bob.id], replyId: bobNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'ok');
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/* TODO
|
|
|
|
|
test.concurrent('自身の visibility: specified なノートへのフォローしていないユーザーからの返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const aliceNote = await post(alice, { text: 'hi', visibility: 'specified', visibleUserIds: [bob.id] });
|
|
|
|
|
const bobNote = await post(bob, { text: 'ok', visibility: 'specified', visibleUserIds: [alice.id], replyId: aliceNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === bobNote.id).text, 'ok');
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// ↑の挙動が理想だけど実装が面倒かも
|
|
|
|
|
test.concurrent('自身の visibility: specified なノートへのフォローしていないユーザーからの返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const aliceNote = await post(alice, { text: 'hi', visibility: 'specified', visibleUserIds: [bob.id] });
|
|
|
|
|
const bobNote = await post(bob, { text: 'ok', visibility: 'specified', visibleUserIds: [alice.id], replyId: aliceNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/timeline', { limit: 100 }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
2024-07-25 07:37:46 +00:00
|
|
|
|
|
|
|
|
|
test.concurrent('FTT: ローカルユーザーの HTL にはプッシュされる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
await api('following/create', {
|
|
|
|
|
userId: alice.id,
|
|
|
|
|
}, bob);
|
|
|
|
|
|
|
|
|
|
const aliceNote = await post(alice, { text: 'I\'m Alice.' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'I\'m Bob.' });
|
|
|
|
|
const carolNote = await post(carol, { text: 'I\'m Carol.' });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
|
|
|
|
// NOTE: notes/timeline だと DB へのフォールバックが効くので Redis を直接見て確かめる
|
|
|
|
|
assert.strictEqual(await redisForTimelines.exists(`list:homeTimeline:${bob.id}`), 1);
|
|
|
|
|
|
|
|
|
|
const bobHTL = await redisForTimelines.lrange(`list:homeTimeline:${bob.id}`, 0, -1);
|
|
|
|
|
assert.strictEqual(bobHTL.includes(aliceNote.id), true);
|
|
|
|
|
assert.strictEqual(bobHTL.includes(bobNote.id), true);
|
|
|
|
|
assert.strictEqual(bobHTL.includes(carolNote.id), false);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('FTT: リモートユーザーの HTL にはプッシュされない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup({ host: genHost() })]);
|
|
|
|
|
|
|
|
|
|
await api('following/create', {
|
|
|
|
|
userId: alice.id,
|
|
|
|
|
}, bob);
|
|
|
|
|
|
|
|
|
|
await post(alice, { text: 'I\'m Alice.' });
|
|
|
|
|
await post(bob, { text: 'I\'m Bob.' });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
|
|
|
|
// NOTE: notes/timeline だと DB へのフォールバックが効くので Redis を直接見て確かめる
|
|
|
|
|
assert.strictEqual(await redisForTimelines.exists(`list:homeTimeline:${bob.id}`), 0);
|
|
|
|
|
});
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('Local TL', () => {
|
|
|
|
|
test.concurrent('visibility: home なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi', visibility: 'home' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-11 01:15:44 +00:00
|
|
|
|
test.concurrent('他人の他人への返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-11 01:15:44 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), true);
|
2023-10-11 01:15:44 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-22 07:23:50 +00:00
|
|
|
|
test.concurrent('他人のその人自身への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { text: 'hi', replyId: bobNote1.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-22 07:23:50 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
2023-10-22 07:23:50 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-05 00:31:03 +00:00
|
|
|
|
test.concurrent('チャンネル投稿が含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const channel = await api('channels/create', { name: 'channel' }, bob).then(x => x.body);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', channelId: channel.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
test.concurrent('リモートユーザーのノートが含まれない', async () => {
|
2023-10-04 02:32:33 +00:00
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup({ host: genHost() })]);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 含まれても良いと思うけど実装が面倒なので含まれない
|
|
|
|
|
test.concurrent('フォローしているユーザーの visibility: home なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: carol.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi', visibility: 'home' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('ミュートしているユーザーのノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('mute/create', { userId: carol.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーが行ったミュートしているユーザーのリノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
await api('mute/create', { userId: carol.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', renoteId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('withReplies: true でフォローしているユーザーが行ったミュートしているユーザーの投稿への返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
await api('following/update', { userId: bob.id, withReplies: true }, alice);
|
|
|
|
|
await api('mute/create', { userId: carol.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-10 23:18:00 +00:00
|
|
|
|
test.concurrent('withReplies: false でフォローしているユーザーからの自分への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: aliceNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-11 01:15:44 +00:00
|
|
|
|
test.concurrent('[withReplies: true] 他人の他人への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100, withReplies: true }, alice);
|
2023-10-11 01:15:44 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-11 01:15:44 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
test.concurrent('[withFiles: true] ファイル付きノートのみ含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2023-12-22 00:06:13 +00:00
|
|
|
|
const file = await uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/assets/main/public/icon.png');
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { fileIds: [file.id] });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100, withFiles: true }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
2024-07-20 12:33:20 +00:00
|
|
|
|
}, 1000 * 10);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('Social TL', () => {
|
|
|
|
|
test.concurrent('ローカルユーザーのノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('ローカルユーザーの visibility: home なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'home' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているローカルユーザーの visibility: home なノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'home' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-10 23:18:00 +00:00
|
|
|
|
test.concurrent('withReplies: false でフォローしているユーザーからの自分への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: aliceNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-11 01:15:44 +00:00
|
|
|
|
test.concurrent('他人の他人への返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
|
2023-10-11 01:15:44 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), true);
|
2023-10-11 01:15:44 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
test.concurrent('リモートユーザーのノートが含まれない', async () => {
|
2023-10-04 02:32:33 +00:00
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup({ host: genHost() })]);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/local-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているリモートユーザーのノートが含まれる', async () => {
|
2023-10-04 02:32:33 +00:00
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup({ host: genHost() })]);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-01-08 08:43:52 +00:00
|
|
|
|
await sendEnvUpdateRequest({ key: 'FORCE_FOLLOW_REMOTE_USER_FOR_TESTING', value: 'true' });
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-01-08 08:43:52 +00:00
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているリモートユーザーの visibility: home なノートが含まれる', async () => {
|
2023-10-04 02:32:33 +00:00
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup({ host: genHost() })]);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-01-08 08:43:52 +00:00
|
|
|
|
await sendEnvUpdateRequest({ key: 'FORCE_FOLLOW_REMOTE_USER_FOR_TESTING', value: 'true' });
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-01-08 08:43:52 +00:00
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'home' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-11 01:15:44 +00:00
|
|
|
|
test.concurrent('[withReplies: true] 他人の他人への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/hybrid-timeline', { limit: 100, withReplies: true }, alice);
|
2023-10-11 01:15:44 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-11 01:15:44 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
test.concurrent('[withFiles: true] ファイル付きノートのみ含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2023-12-22 00:06:13 +00:00
|
|
|
|
const file = await uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/assets/main/public/icon.png');
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { fileIds: [file.id] });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/hybrid-timeline', { limit: 100, withFiles: true }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
2024-07-20 12:33:20 +00:00
|
|
|
|
}, 1000 * 10);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('User List TL', () => {
|
|
|
|
|
test.concurrent('リスインしているフォローしていないユーザーのノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('リスインしているフォローしていないユーザーの visibility: home なノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'home' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('リスインしているフォローしていないユーザーの visibility: followers なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('リスインしているフォローしていないユーザーの他人への返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('リスインしているフォローしていないユーザーのユーザー自身への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { text: 'hi', replyId: bobNote1.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-10 23:18:00 +00:00
|
|
|
|
test.concurrent('withReplies: false でリスインしているフォローしていないユーザーからの自分への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-03-07 00:51:57 +00:00
|
|
|
|
await api('users/lists/update-membership', { listId: list.id, userId: bob.id, withReplies: false }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: aliceNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-07 00:51:57 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-10 23:18:00 +00:00
|
|
|
|
});
|
|
|
|
|
|
2024-03-07 00:51:57 +00:00
|
|
|
|
test.concurrent('withReplies: false でリスインしているフォローしていないユーザーの他人への返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
|
|
|
|
await api('users/lists/update-membership', { listId: list.id, userId: bob.id, withReplies: false }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2024-03-07 00:51:57 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2024-03-07 00:51:57 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
test.concurrent('withReplies: true でリスインしているフォローしていないユーザーの他人への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
|
|
|
|
await api('users/lists/update-membership', { listId: list.id, userId: bob.id, withReplies: true }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('リスインしているフォローしているユーザーの visibility: home なノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'home' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('リスインしているフォローしているユーザーの visibility: followers なノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi');
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-22 01:40:53 +00:00
|
|
|
|
test.concurrent('リスインしている自分の visibility: followers なノートが含まれる', async () => {
|
|
|
|
|
const [alice] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: alice.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-22 01:40:53 +00:00
|
|
|
|
const aliceNote = await post(alice, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-22 01:40:53 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'hi');
|
2023-10-22 01:40:53 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-06 08:36:54 +00:00
|
|
|
|
test.concurrent('リスインしているユーザーのチャンネルノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const channel = await api('channels/create', { name: 'channel' }, bob).then(x => x.body);
|
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-06 08:36:54 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', channelId: channel.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-06 08:36:54 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-06 08:36:54 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
test.concurrent('[withFiles: true] リスインしているユーザーのファイル付きノートのみ含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2023-12-22 00:06:13 +00:00
|
|
|
|
const file = await uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/assets/main/public/icon.png');
|
2023-10-03 11:26:11 +00:00
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { fileIds: [file.id] });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id, withFiles: true }, alice);
|
2023-10-03 11:26:11 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
2024-07-20 12:33:20 +00:00
|
|
|
|
}, 1000 * 10);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
|
|
|
|
test.concurrent('リスインしているユーザーの自身宛ての visibility: specified なノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'specified', visibleUserIds: [alice.id] });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi');
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('リスインしているユーザーの自身宛てではない visibility: specified なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
|
|
|
|
await api('users/lists/push', { listId: list.id, userId: carol.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'specified', visibleUserIds: [carol.id] });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
2023-10-03 11:26:11 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-04 02:24:46 +00:00
|
|
|
|
describe('User TL', () => {
|
2023-10-04 02:48:51 +00:00
|
|
|
|
test.concurrent('ノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-04 02:48:51 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id }, alice);
|
2023-10-04 02:48:51 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-04 02:48:51 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-04 02:24:46 +00:00
|
|
|
|
test.concurrent('フォローしていないユーザーの visibility: followers なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-04 02:24:46 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id }, alice);
|
2023-10-04 02:24:46 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-04 02:24:46 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('フォローしているユーザーの visibility: followers なノートが含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('following/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-04 02:24:46 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-04 02:24:46 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id }, alice);
|
2023-10-04 02:24:46 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi');
|
2023-10-04 02:24:46 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-08 23:54:57 +00:00
|
|
|
|
test.concurrent('自身の visibility: followers なノートが含まれる', async () => {
|
|
|
|
|
const [alice] = await Promise.all([signup()]);
|
|
|
|
|
|
|
|
|
|
const aliceNote = await post(alice, { text: 'hi', visibility: 'followers' });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: alice.id }, alice);
|
2023-10-08 23:54:57 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
|
assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'hi');
|
2023-10-08 23:54:57 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-05 00:31:03 +00:00
|
|
|
|
test.concurrent('チャンネル投稿が含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const channel = await api('channels/create', { name: 'channel' }, bob).then(x => x.body);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', channelId: channel.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id }, alice);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-05 00:31:03 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-04 02:24:46 +00:00
|
|
|
|
test.concurrent('[withReplies: false] 他人への返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-04 02:24:46 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id }, alice);
|
2023-10-04 02:24:46 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), false);
|
2023-10-04 02:24:46 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('[withReplies: true] 他人への返信が含まれる', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { text: 'hi', replyId: carolNote.id });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-04 02:24:46 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id, withReplies: true }, alice);
|
2023-10-04 02:24:46 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
2023-10-04 02:24:46 +00:00
|
|
|
|
});
|
2023-10-04 02:48:51 +00:00
|
|
|
|
|
2023-10-04 05:47:45 +00:00
|
|
|
|
test.concurrent('[withReplies: true] 他人への visibility: specified な返信が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { text: 'hi', replyId: carolNote.id, visibility: 'specified' });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-04 05:47:45 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id, withReplies: true }, alice);
|
2023-10-04 05:47:45 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), false);
|
2023-10-04 05:47:45 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-04 02:48:51 +00:00
|
|
|
|
test.concurrent('[withFiles: true] ファイル付きノートのみ含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2023-12-22 00:06:13 +00:00
|
|
|
|
const file = await uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/assets/main/public/icon.png');
|
2023-10-04 02:48:51 +00:00
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { fileIds: [file.id] });
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-04 02:48:51 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id, withFiles: true }, alice);
|
2023-10-04 02:48:51 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), false);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
2024-07-20 12:33:20 +00:00
|
|
|
|
}, 1000 * 10);
|
2023-10-04 06:33:02 +00:00
|
|
|
|
|
2023-10-05 00:48:45 +00:00
|
|
|
|
test.concurrent('[withChannelNotes: true] チャンネル投稿が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const channel = await api('channels/create', { name: 'channel' }, bob).then(x => x.body);
|
2023-10-05 00:48:45 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', channelId: channel.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id, withChannelNotes: true }, alice);
|
2023-10-05 00:48:45 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-05 00:48:45 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-10 23:02:29 +00:00
|
|
|
|
test.concurrent('[withChannelNotes: true] 他人が取得した場合センシティブチャンネル投稿が含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const channel = await api('channels/create', { name: 'channel', isSensitive: true }, bob).then(x => x.body);
|
2023-10-10 23:02:29 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', channelId: channel.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id, withChannelNotes: true }, alice);
|
2023-10-10 23:02:29 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-10 23:02:29 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('[withChannelNotes: true] 自分が取得した場合センシティブチャンネル投稿が含まれる', async () => {
|
|
|
|
|
const [bob] = await Promise.all([signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const channel = await api('channels/create', { name: 'channel', isSensitive: true }, bob).then(x => x.body);
|
2023-10-10 23:02:29 +00:00
|
|
|
|
const bobNote = await post(bob, { text: 'hi', channelId: channel.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id, withChannelNotes: true }, bob);
|
2023-10-10 23:02:29 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
2023-10-10 23:02:29 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
test.concurrent('ミュートしているユーザーに関連する投稿が含まれない', async () => {
|
|
|
|
|
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('mute/create', { userId: carol.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-04 07:12:44 +00:00
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', renoteId: carolNote.id });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id }, alice);
|
2023-10-04 07:12:44 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-04 07:12:44 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-04 06:33:02 +00:00
|
|
|
|
test.concurrent('ミュートしていても userId に指定したユーザーの投稿が含まれる', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
await api('mute/create', { userId: bob.id }, alice);
|
2024-07-02 05:47:07 +00:00
|
|
|
|
await setTimeout(1000);
|
2023-10-04 07:48:34 +00:00
|
|
|
|
const bobNote1 = await post(bob, { text: 'hi' });
|
|
|
|
|
const bobNote2 = await post(bob, { text: 'hi', replyId: bobNote1.id });
|
|
|
|
|
const bobNote3 = await post(bob, { text: 'hi', renoteId: bobNote1.id });
|
2023-10-04 06:33:02 +00:00
|
|
|
|
|
2023-10-04 07:12:44 +00:00
|
|
|
|
await waitForPushToTl();
|
2023-10-04 06:33:02 +00:00
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id }, alice);
|
2023-10-04 06:33:02 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote1.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote2.id), true);
|
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote3.id), true);
|
2023-10-04 06:33:02 +00:00
|
|
|
|
});
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
|
|
|
|
test.concurrent('自身の visibility: specified なノートが含まれる', async () => {
|
|
|
|
|
const [alice] = await Promise.all([signup()]);
|
|
|
|
|
|
|
|
|
|
const aliceNote = await post(alice, { text: 'hi', visibility: 'specified' });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: alice.id, withReplies: true }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('visibleUserIds に指定されてない visibility: specified なノートが含まれない', async () => {
|
|
|
|
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
|
|
|
|
|
|
|
|
|
const bobNote = await post(bob, { text: 'hi', visibility: 'specified' });
|
|
|
|
|
|
|
|
|
|
await waitForPushToTl();
|
|
|
|
|
|
2024-03-03 11:15:35 +00:00
|
|
|
|
const res = await api('users/notes', { userId: bob.id, withReplies: true }, alice);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
|
2024-07-14 00:33:16 +00:00
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
2023-10-09 03:36:25 +00:00
|
|
|
|
});
|
2024-06-22 03:43:03 +00:00
|
|
|
|
|
|
|
|
|
/** @see https://github.com/misskey-dev/misskey/issues/14000 */
|
|
|
|
|
test.concurrent('FTT: sinceId にキャッシュより古いノートを指定しても、sinceId による絞り込みが正しく動作する', async () => {
|
|
|
|
|
const alice = await signup();
|
|
|
|
|
const noteSince = await post(alice, { text: 'Note where id will be `sinceId`.' });
|
|
|
|
|
const note1 = await post(alice, { text: '1' });
|
|
|
|
|
const note2 = await post(alice, { text: '2' });
|
|
|
|
|
await redisForTimelines.del('list:userTimeline:' + alice.id);
|
|
|
|
|
const note3 = await post(alice, { text: '3' });
|
|
|
|
|
|
|
|
|
|
const res = await api('users/notes', { userId: alice.id, sinceId: noteSince.id });
|
|
|
|
|
assert.deepStrictEqual(res.body, [note1, note2, note3]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test.concurrent('FTT: sinceId にキャッシュより古いノートを指定しても、sinceId と untilId による絞り込みが正しく動作する', async () => {
|
|
|
|
|
const alice = await signup();
|
|
|
|
|
const noteSince = await post(alice, { text: 'Note where id will be `sinceId`.' });
|
|
|
|
|
const note1 = await post(alice, { text: '1' });
|
|
|
|
|
const note2 = await post(alice, { text: '2' });
|
|
|
|
|
await redisForTimelines.del('list:userTimeline:' + alice.id);
|
|
|
|
|
const note3 = await post(alice, { text: '3' });
|
|
|
|
|
const noteUntil = await post(alice, { text: 'Note where id will be `untilId`.' });
|
|
|
|
|
await post(alice, { text: '4' });
|
|
|
|
|
|
|
|
|
|
const res = await api('users/notes', { userId: alice.id, sinceId: noteSince.id, untilId: noteUntil.id });
|
|
|
|
|
assert.deepStrictEqual(res.body, [note3, note2, note1]);
|
|
|
|
|
});
|
2023-10-04 02:24:46 +00:00
|
|
|
|
});
|
|
|
|
|
|
2023-10-03 11:26:11 +00:00
|
|
|
|
// TODO: リノートミュート済みユーザーのテスト
|
|
|
|
|
// TODO: ページネーションのテスト
|
|
|
|
|
});
|