add mandatory CW for instances
This commit is contained in:
parent
595c004a74
commit
5e0115335a
26 changed files with 282 additions and 8 deletions
|
|
@ -34,6 +34,7 @@ import { QueryService } from '@/core/QueryService.js';
|
|||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
import { isPureRenote, isQuote, isRenote } from '@/misc/is-renote.js';
|
||||
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||
import { JsonLdService } from './JsonLdService.js';
|
||||
import { ApMfmService } from './ApMfmService.js';
|
||||
import { CONTEXT } from './misc/contexts.js';
|
||||
|
|
@ -75,9 +76,10 @@ export class ApRendererService {
|
|||
private apMfmService: ApMfmService,
|
||||
private mfmService: MfmService,
|
||||
private idService: IdService,
|
||||
private readonly queryService: QueryService,
|
||||
private utilityService: UtilityService,
|
||||
private readonly queryService: QueryService,
|
||||
private readonly cacheService: CacheService,
|
||||
private readonly federatedInstanceService: FederatedInstanceService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -398,6 +400,8 @@ export class ApRendererService {
|
|||
return ids.map(id => items.find(item => item.id === id)).filter(x => x != null);
|
||||
};
|
||||
|
||||
const instance = author.instance ?? (author.host ? await this.federatedInstanceService.fetch(author.host) : null);
|
||||
|
||||
let inReplyTo;
|
||||
let inReplyToNote: MiNote | null;
|
||||
|
||||
|
|
@ -503,6 +507,9 @@ export class ApRendererService {
|
|||
if (author.mandatoryCW) {
|
||||
summary = appendContentWarning(summary, author.mandatoryCW);
|
||||
}
|
||||
if (instance?.mandatoryCW) {
|
||||
summary = appendContentWarning(summary, instance.mandatoryCW);
|
||||
}
|
||||
|
||||
const { content } = this.apMfmService.getNoteHtml(note, apAppend);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ export class InstanceEntityService {
|
|||
rejectQuotes: instance.rejectQuotes,
|
||||
moderationNote: iAmModerator ? instance.moderationNote : null,
|
||||
isBubbled: this.utilityService.isBubbledHost(instance.host),
|
||||
mandatoryCW: instance.mandatoryCW,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -578,6 +578,7 @@ export class UserEntityService implements OnModuleInit {
|
|||
faviconUrl: instance.faviconUrl,
|
||||
themeColor: instance.themeColor,
|
||||
isSilenced: instance.isSilenced,
|
||||
mandatoryCW: instance.mandatoryCW,
|
||||
} : undefined) : undefined,
|
||||
followersCount: followersCount ?? 0,
|
||||
followingCount: followingCount ?? 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue