wip
This commit is contained in:
parent
ce5ff70cb3
commit
314fb4bfd9
5 changed files with 9 additions and 38 deletions
|
@ -212,21 +212,6 @@ export class NotificationEntityService implements OnModuleInit {
|
|||
note: noteIfNeed,
|
||||
users,
|
||||
});
|
||||
} else if (notification.type === 'follow:grouped') {
|
||||
const users = await Promise.all(notification.userIds.map(userId => {
|
||||
const user = hint?.packedUsers != null
|
||||
? hint.packedUsers.get(userId)
|
||||
: this.userEntityService.pack(userId!, { id: meId }, {
|
||||
detail: false,
|
||||
});
|
||||
return user;
|
||||
}));
|
||||
return await awaitAll({
|
||||
id: notification.id,
|
||||
createdAt: new Date(notification.createdAt).toISOString(),
|
||||
type: notification.type,
|
||||
users,
|
||||
});
|
||||
}
|
||||
|
||||
return await awaitAll({
|
||||
|
@ -276,7 +261,6 @@ export class NotificationEntityService implements OnModuleInit {
|
|||
if ('notifierId' in notification) userIds.push(notification.notifierId);
|
||||
if (notification.type === 'reaction:grouped') userIds.push(...notification.reactions.map(x => x.userId));
|
||||
if (notification.type === 'renote:grouped') userIds.push(...notification.userIds);
|
||||
if (notification.type === 'follow:grouped') userIds.push(...notification.userIds);
|
||||
}
|
||||
const users = userIds.length > 0 ? await this.usersRepository.find({
|
||||
where: { id: In(userIds) },
|
||||
|
|
|
@ -119,9 +119,4 @@ export type MiGroupedNotification = MiNotification | {
|
|||
createdAt: string;
|
||||
noteId: MiNote['id'];
|
||||
userIds: string[];
|
||||
} | {
|
||||
type: 'follow:grouped';
|
||||
id: string;
|
||||
createdAt: string;
|
||||
userIds: string[];
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ export const packedNotificationSchema = {
|
|||
type: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped', 'follow:grouped'],
|
||||
enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped'],
|
||||
},
|
||||
user: {
|
||||
type: 'object',
|
||||
|
|
|
@ -157,20 +157,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
prevGroupedNotification.id = notification.id;
|
||||
continue;
|
||||
}
|
||||
if (prev.type === 'follow' && notification.type === 'follow') {
|
||||
if (prevGroupedNotification.type !== 'follow:grouped') {
|
||||
groupedNotifications.push({
|
||||
type: 'follow:grouped',
|
||||
id: '',
|
||||
createdAt: notification.createdAt,
|
||||
userIds: [],
|
||||
});
|
||||
prevGroupedNotification = groupedNotifications.at(-1)!;
|
||||
}
|
||||
(prevGroupedNotification as FilterUnionByProperty<MiGroupedNotification, 'type', 'follow:grouped'>).userIds.push(notification.notifierId!);
|
||||
prevGroupedNotification.id = notification.id;
|
||||
continue;
|
||||
}
|
||||
|
||||
groupedNotifications.push(notification);
|
||||
}
|
||||
|
|
|
@ -115,6 +115,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="notification.type === 'renote:grouped'">
|
||||
<div v-for="user of notification.users" :class="$style.reactionsItem">
|
||||
<MkAvatar :class="$style.reactionsItemAvatar" :user="user" link preview/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -321,8 +326,9 @@ useTooltip(reactionRef, (showing) => {
|
|||
.reactionsItem {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
margin-top: 8px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue