This commit is contained in:
tamaina 2025-07-16 21:53:19 +09:00
parent f50364b100
commit 537a49a448
1 changed files with 49 additions and 15 deletions

View File

@ -1233,30 +1233,23 @@ describe('Timelines', () => {
* bob = () * bob = ()
* carol = () * carol = ()
* dave = () * dave = ()
* elle = ()
*/ */
let alice: SignupResponse, bob: SignupResponse, carol: SignupResponse, dave: SignupResponse, elle: SignupResponse; let alice: SignupResponse, bob: SignupResponse, carol: SignupResponse, dave: SignupResponse;
let aliceNote: Note, bobNote: Note, carolNote: Note, daveNote: Note, elleNote: Note; let aliceNote: Note, bobNote: Note, carolNote: Note, daveNote: Note;
beforeAll(async () => { beforeAll(async () => {
[alice, bob, carol, dave, elle] = await Promise.all([signup(), signup(), signup(), signup(), signup({ host: genHost() })]); [alice, bob, carol, dave] = await Promise.all([signup(), signup(), signup(), signup()]);
await api('following/create', { userId: dave.id }, alice);
aliceNote = await post(alice, { text: 'hi' }); aliceNote = await post(alice, { text: 'hi' });
bobNote = await post(bob, { text: 'yo' }); bobNote = await post(bob, { text: 'yo' });
carolNote = await post(carol, { text: 'kon\'nichiwa' }); carolNote = await post(carol, { text: 'kon\'nichiwa' });
daveNote = await post(dave, { text: 'hello' }); daveNote = await post(dave, { text: 'hello' });
elleNote = await post(elle, { text: 'hi there' });
await api('following/create', { userId: dave.id }, alice);
await sendEnvUpdateRequest({ key: 'FORCE_FOLLOW_REMOTE_USER_FOR_TESTING', value: 'true' });
await api('following/create', { userId: elle.id }, alice);
await waitForPushToTl(); await waitForPushToTl();
await api('admin/suspend-user', { userId: carol.id }, root); await api('admin/suspend-user', { userId: carol.id }, root);
await api('admin/suspend-user', { userId: dave.id }, root); await api('admin/suspend-user', { userId: dave.id }, root);
await api('admin/suspend-user', { userId: elle.id }, root);
await setTimeout(250); await setTimeout(250);
}); });
@ -1267,13 +1260,11 @@ describe('Timelines', () => {
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true); assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false); assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
assert.strictEqual(res.body.some(note => note.id === daveNote.id), false); assert.strictEqual(res.body.some(note => note.id === daveNote.id), false);
assert.strictEqual(res.body.some(note => note.id === elleNote.id), false);
}); });
test('凍結解除後に凍結されていたユーザーのノートは見えるようになる', async () => { test('凍結解除後に凍結されていたユーザーのノートは見えるようになる', async () => {
await api('admin/unsuspend-user', { userId: carol.id }, root); await api('admin/unsuspend-user', { userId: carol.id }, root);
await api('admin/unsuspend-user', { userId: dave.id }, root); await api('admin/unsuspend-user', { userId: dave.id }, root);
await api('admin/unsuspend-user', { userId: elle.id }, root);
await setTimeout(250); await setTimeout(250);
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice); const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
@ -1282,6 +1273,50 @@ describe('Timelines', () => {
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true); 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.some(note => note.id === carolNote.id), true);
assert.strictEqual(res.body.some(note => note.id === daveNote.id), true); assert.strictEqual(res.body.some(note => note.id === daveNote.id), true);
});
});
describe('凍結 (リモート)', () => {
/*
* carol = ()
* elle = ()
*/
let alice: SignupResponse, carol: SignupResponse, elle: SignupResponse;
let aliceNote: Note, carolNote: Note, elleNote: Note;
beforeAll(async () => {
[alice, carol, elle] = await Promise.all([signup(), signup({ host: genHost() }), signup({ host: genHost() })]);
await sendEnvUpdateRequest({ key: 'FORCE_FOLLOW_REMOTE_USER_FOR_TESTING', value: 'true' });
await api('following/create', { userId: elle.id }, alice);
aliceNote = await post(alice, { text: 'hi' });
carolNote = await post(carol, { text: 'kon\'nichiwa' });
elleNote = await post(elle, { text: 'hi there' });
await waitForPushToTl();
await api('admin/suspend-user', { userId: carol.id }, root);
await api('admin/suspend-user', { userId: elle.id }, root);
await setTimeout(250);
});
test('凍結後に凍結されたユーザーのノートは見えなくなる', async () => {
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
assert.strictEqual(res.body.some(note => note.id === elleNote.id), false);
});
test('凍結解除後に凍結されていたユーザーのノートは見えるようになる', async () => {
await api('admin/unsuspend-user', { userId: carol.id }, root);
await api('admin/unsuspend-user', { userId: elle.id }, root);
await setTimeout(250);
const res = await api('notes/hybrid-timeline', { limit: 100 }, alice);
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
assert.strictEqual(res.body.some(note => note.id === elleNote.id), true); assert.strictEqual(res.body.some(note => note.id === elleNote.id), true);
}); });
}); });
@ -1531,7 +1566,6 @@ describe('Timelines', () => {
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false); assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
}); });
describe('凍結', () => { describe('凍結', () => {
let alice: SignupResponse, bob: SignupResponse, carol: SignupResponse; let alice: SignupResponse, bob: SignupResponse, carol: SignupResponse;
let aliceNote: Note, bobNote: Note, carolNote: Note; let aliceNote: Note, bobNote: Note, carolNote: Note;
@ -1541,9 +1575,9 @@ describe('Timelines', () => {
[alice, bob, carol] = await Promise.all([signup(), signup(), signup()]); [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body); 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: bob.id }, alice);
await api('users/lists/push', { listId: list.id, userId: carol.id }, alice); await api('users/lists/push', { listId: list.id, userId: carol.id }, alice);
aliceNote = await post(alice, { text: 'hi' }); aliceNote = await post(alice, { text: 'hi' });
bobNote = await post(bob, { text: 'yo' }); bobNote = await post(bob, { text: 'yo' });
carolNote = await post(carol, { text: 'kon\'nichiwa' }); carolNote = await post(carol, { text: 'kon\'nichiwa' });