fix(backend): users/notes で 自身の visibility: followers なノートが含まれない問題を修正
This commit is contained in:
parent
5601ed0914
commit
457b4cf608
2 changed files with 14 additions and 1 deletions
|
@ -114,7 +114,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
noteIds = noteIds.slice(0, ps.limit);
|
noteIds = noteIds.slice(0, ps.limit);
|
||||||
|
|
||||||
if (noteIds.length > 0) {
|
if (noteIds.length > 0) {
|
||||||
const isFollowing = me ? Object.hasOwn(await this.cacheService.userFollowingsCache.fetch(me.id), ps.userId) : false;
|
const isFollowing = me ? me.id === ps.userId || Object.hasOwn(await this.cacheService.userFollowingsCache.fetch(me.id), ps.userId) : false;
|
||||||
|
|
||||||
const query = this.notesRepository.createQueryBuilder('note')
|
const query = this.notesRepository.createQueryBuilder('note')
|
||||||
.where('note.id IN (:...noteIds)', { noteIds: noteIds })
|
.where('note.id IN (:...noteIds)', { noteIds: noteIds })
|
||||||
|
|
|
@ -820,6 +820,19 @@ describe('Timelines', () => {
|
||||||
assert.strictEqual(res.body.find((note: any) => note.id === bobNote.id).text, 'hi');
|
assert.strictEqual(res.body.find((note: any) => note.id === bobNote.id).text, 'hi');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.concurrent('自身の visibility: followers なノートが含まれる', async () => {
|
||||||
|
const [alice] = await Promise.all([signup()]);
|
||||||
|
|
||||||
|
const aliceNote = await post(alice, { text: 'hi', visibility: 'followers' });
|
||||||
|
|
||||||
|
await waitForPushToTl();
|
||||||
|
|
||||||
|
const res = await api('/users/notes', { userId: alice.id }, alice);
|
||||||
|
|
||||||
|
assert.strictEqual(res.body.some((note: any) => note.id === aliceNote.id), true);
|
||||||
|
assert.strictEqual(res.body.find((note: any) => note.id === aliceNote.id).text, 'hi');
|
||||||
|
});
|
||||||
|
|
||||||
test.concurrent('チャンネル投稿が含まれない', async () => {
|
test.concurrent('チャンネル投稿が含まれない', async () => {
|
||||||
const [alice, bob] = await Promise.all([signup(), signup()]);
|
const [alice, bob] = await Promise.all([signup(), signup()]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue