mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-11-27 22:38:34 +09:00
refactor
This commit is contained in:
parent
512b48e5a0
commit
7431019016
@ -340,10 +340,6 @@ export const packedMeDetailedOnlySchema = {
|
||||
type: 'boolean',
|
||||
nullable: false, optional: false,
|
||||
},
|
||||
hasUnreadMessagingMessage: {
|
||||
type: 'boolean',
|
||||
nullable: false, optional: false,
|
||||
},
|
||||
hasUnreadNotification: {
|
||||
type: 'boolean',
|
||||
nullable: false, optional: false,
|
||||
|
@ -81,6 +81,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
@Inject(DI.userListsRepository)
|
||||
private userListsRepository: UserListsRepository,
|
||||
|
||||
@Inject(DI.userGroupJoiningsRepository)
|
||||
private userGroupJoiningsRepository: UserGroupJoiningsRepository,
|
||||
|
||||
private antennaEntityService: AntennaEntityService,
|
||||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Brackets } from 'typeorm';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import type { UsersRepository, UserGroupsRepository, MessagingMessagesRepository, UserGroupJoiningsRepository } from '@/models/index.js';
|
||||
import type { UserGroupsRepository, MessagingMessagesRepository, UserGroupJoiningsRepository } from '@/models/index.js';
|
||||
import { QueryService } from '@/core/QueryService.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { MessagingMessageEntityService } from '@/core/entities/MessagingMessageEntityService.js';
|
||||
import { MessagingService } from '@/core/MessagingService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { GetterService } from '@/server/api/GetterService.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['messaging'],
|
||||
@ -121,11 +121,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
// Mark all as read
|
||||
if (ps.markAsRead) {
|
||||
this.messagingService.readUserMessagingMessage(me.id, recipient.id, messages.filter(m => m.recipientId === me.id).map(x => x.id));
|
||||
await this.messagingService.readUserMessagingMessage(me.id, recipient.id, messages.filter(m => m.recipientId === me.id).map(x => x.id));
|
||||
|
||||
// リモートユーザーとのメッセージだったら既読配信
|
||||
if (this.userEntityService.isLocalUser(me) && this.userEntityService.isRemoteUser(recipient)) {
|
||||
this.messagingService.deliverReadActivity(me, recipient, messages);
|
||||
await this.messagingService.deliverReadActivity(me, recipient, messages);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import ms from 'ms';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import type { BlockingsRepository, UserGroupJoiningsRepository, DriveFilesRepository, UserGroupsRepository } from '@/models/index.js';
|
||||
import type { User } from '@/models/entities/User.js';
|
||||
@ -12,15 +12,15 @@ import { ApiError } from '../../../error.js';
|
||||
export const meta = {
|
||||
tags: ['messaging'],
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
kind: 'write:messaging',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 120,
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
kind: 'write:messaging',
|
||||
|
||||
res: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
|
@ -70,9 +70,9 @@ globalThis.addEventListener('push', ev => {
|
||||
&& ('userId' in data.body
|
||||
? data.body.userId === n.data.body.userId
|
||||
: data.body.groupId === n.data.body.groupId)
|
||||
) {
|
||||
n.close();
|
||||
}
|
||||
) {
|
||||
n.close();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user