parent
0586dd98cb
commit
b1b335d55a
|
@ -32,6 +32,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private chatService: ChatService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
await this.chatService.checkChatAvailability(me.id, 'read');
|
||||
|
||||
await this.chatService.readAllChatMessages(me.id);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import { QueryService } from '@/core/QueryService.js';
|
|||
import { DI } from '@/di-symbols.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { ChatEntityService } from '@/core/entities/ChatEntityService.js';
|
||||
import { ChatService } from '@/core/ChatService.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
|
||||
export const meta = {
|
||||
|
@ -60,14 +61,21 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
@Inject(DI.chatMessagesRepository)
|
||||
private chatMessagesRepository: ChatMessagesRepository,
|
||||
|
||||
private chatService: ChatService,
|
||||
private chatEntityService: ChatEntityService,
|
||||
private queryService: QueryService,
|
||||
private roleService: RoleService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const isModerator = await this.roleService.isModerator(me);
|
||||
|
||||
if (!isModerator) {
|
||||
await this.chatService.checkChatAvailability(me.id, 'read');
|
||||
}
|
||||
|
||||
const file = await this.driveFilesRepository.findOneBy({
|
||||
id: ps.fileId,
|
||||
userId: await this.roleService.isModerator(me) ? undefined : me.id,
|
||||
userId: isModerator ? undefined : me.id,
|
||||
});
|
||||
|
||||
if (file == null) {
|
||||
|
|
|
@ -128,9 +128,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<hr>
|
||||
|
||||
<MkButton @click="readAllChatMessages">Read all chat messages</MkButton>
|
||||
<template v-if="$i.policies.chatAvailability !== 'unavailable'">
|
||||
<MkButton @click="readAllChatMessages">Read all chat messages</MkButton>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
</template>
|
||||
|
||||
<FormSlot>
|
||||
<MkButton danger @click="migrate"><i class="ti ti-refresh"></i> {{ i18n.ts.migrateOldSettings }}</MkButton>
|
||||
|
|
Loading…
Reference in New Issue