diff options
| author | zyoshoka <107108195+zyoshoka@users.noreply.github.com> | 2024-07-25 16:37:46 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-25 16:37:46 +0900 |
| commit | befa8e4a7f91ee6f13ea6179a8a45dc84764b1f7 (patch) | |
| tree | 132dc7cc67f02fcda0088418b4d3e492c10e5605 /packages/backend/test/e2e/timelines.ts | |
| parent | fix(backend): avoid notifying to remote users on local (#13774) (diff) | |
| download | misskey-befa8e4a7f91ee6f13ea6179a8a45dc84764b1f7.tar.gz misskey-befa8e4a7f91ee6f13ea6179a8a45dc84764b1f7.tar.bz2 misskey-befa8e4a7f91ee6f13ea6179a8a45dc84764b1f7.zip | |
fix(backend): avoid caching remote user's HTL when receiving Note (#13772)
* fix(backend): avoid caching remote user's HTL when receiving Note
* test(backend): add test for FFT
* Update CHANGELOG.md
---------
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/backend/test/e2e/timelines.ts')
| -rw-r--r-- | packages/backend/test/e2e/timelines.ts | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/packages/backend/test/e2e/timelines.ts b/packages/backend/test/e2e/timelines.ts index 540b866b28..ab65781f70 100644 --- a/packages/backend/test/e2e/timelines.ts +++ b/packages/backend/test/e2e/timelines.ts @@ -9,8 +9,8 @@ import * as assert from 'assert'; import { setTimeout } from 'node:timers/promises'; import { Redis } from 'ioredis'; -import { loadConfig } from '@/config.js'; import { api, post, randomString, sendEnvUpdateRequest, signup, uploadUrl } from '../utils.js'; +import { loadConfig } from '@/config.js'; function genHost() { return randomString() + '.example.com'; @@ -492,6 +492,44 @@ describe('Timelines', () => { assert.strictEqual(res.body.some(note => note.id === bobNote.id), false); }); + + 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); + }); }); describe('Local TL', () => { |