refactor: migrate to typeorm 3.0 (#8443)
* wip * wip * wip * Update following.ts * wip * wip * wip * Update resolve-user.ts * maxQueryExecutionTime * wip * wip
This commit is contained in:
parent
41c87074e6
commit
1c67c26bd8
325 changed files with 1314 additions and 1494 deletions
|
|
@ -50,7 +50,7 @@ export async function createMessage(user: { id: User['id']; host: User['host'];
|
|||
publishGroupMessagingStream(recipientGroup.id, 'message', messageObj);
|
||||
|
||||
// メンバーのストリーム
|
||||
const joinings = await UserGroupJoinings.find({ userGroupId: recipientGroup.id });
|
||||
const joinings = await UserGroupJoinings.findBy({ userGroupId: recipientGroup.id });
|
||||
for (const joining of joinings) {
|
||||
publishMessagingIndexStream(joining.userId, 'message', messageObj);
|
||||
publishMainStream(joining.userId, 'messagingMessage', messageObj);
|
||||
|
|
@ -59,14 +59,14 @@ export async function createMessage(user: { id: User['id']; host: User['host'];
|
|||
|
||||
// 2秒経っても(今回作成した)メッセージが既読にならなかったら「未読のメッセージがありますよ」イベントを発行する
|
||||
setTimeout(async () => {
|
||||
const freshMessage = await MessagingMessages.findOne(message.id);
|
||||
const freshMessage = await MessagingMessages.findOneBy({ id: message.id });
|
||||
if (freshMessage == null) return; // メッセージが削除されている場合もある
|
||||
|
||||
if (recipientUser && Users.isLocalUser(recipientUser)) {
|
||||
if (freshMessage.isRead) return; // 既読
|
||||
|
||||
//#region ただしミュートされているなら発行しない
|
||||
const mute = await Mutings.find({
|
||||
const mute = await Mutings.findBy({
|
||||
muterId: recipientUser.id,
|
||||
});
|
||||
if (mute.map(m => m.muteeId).includes(user.id)) return;
|
||||
|
|
@ -75,7 +75,7 @@ export async function createMessage(user: { id: User['id']; host: User['host'];
|
|||
publishMainStream(recipientUser.id, 'unreadMessagingMessage', messageObj);
|
||||
pushNotification(recipientUser.id, 'unreadMessagingMessage', messageObj);
|
||||
} else if (recipientGroup) {
|
||||
const joinings = await UserGroupJoinings.find({ userGroupId: recipientGroup.id, userId: Not(user.id) });
|
||||
const joinings = await UserGroupJoinings.findBy({ userGroupId: recipientGroup.id, userId: Not(user.id) });
|
||||
for (const joining of joinings) {
|
||||
if (freshMessage.reads.includes(joining.userId)) return; // 既読
|
||||
publishMainStream(joining.userId, 'unreadMessagingMessage', messageObj);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ export async function deleteMessage(message: MessagingMessage) {
|
|||
|
||||
async function postDeleteMessage(message: MessagingMessage) {
|
||||
if (message.recipientId) {
|
||||
const user = await Users.findOneOrFail(message.userId);
|
||||
const recipient = await Users.findOneOrFail(message.recipientId);
|
||||
const user = await Users.findOneByOrFail({ id: message.userId });
|
||||
const recipient = await Users.findOneByOrFail({ id: message.recipientId });
|
||||
|
||||
if (Users.isLocalUser(user)) publishMessagingStream(message.userId, message.recipientId, 'deleted', message.id);
|
||||
if (Users.isLocalUser(recipient)) publishMessagingStream(message.recipientId, message.userId, 'deleted', message.id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue