spec(backend/stream): モデレーターにも一般ユーザーと同じく通常の投稿はcdn経由で配信するように (MisskeyIO#920)

This commit is contained in:
あわわわとーにゅ 2025-01-29 07:30:05 +09:00 committed by GitHub
parent d7d270b789
commit 020c4f1716
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 97 additions and 43 deletions

View file

@ -4,11 +4,11 @@
*/
import { Injectable } from '@nestjs/common';
import { bindThis } from '@/decorators.js';
import type { Packed } from '@/misc/json-schema.js';
import { MetaService } from '@/core/MetaService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { bindThis } from '@/decorators.js';
import { RoleService } from '@/core/RoleService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { isQuotePacked, isRenotePacked } from '@/misc/is-renote.js';
import Channel, { type MiChannelService } from '../channel.js';
@ -95,11 +95,14 @@ class LocalTimelineChannel extends Channel {
}
if (this.minimize && ['public', 'home'].includes(note.visibility)) {
const badgeRoles = this.iAmModerator ? await this.roleService.getUserBadgeRoles(note.userId, false) : undefined;
this.send('note', {
id: note.id, myReaction: note.myReaction,
poll: note.poll?.choices ? { choices: note.poll.choices } : undefined,
reply: note.reply?.myReaction ? { myReaction: note.reply.myReaction } : undefined,
renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined,
...(badgeRoles?.length ? { user: { badgeRoles } } : {}),
});
} else {
this.send('note', note);