1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-11-24 23:26:17 +09:00

Use unique id for Undo (#8434)

This commit is contained in:
MeiMei 2022-03-22 00:39:00 +09:00 committed by GitHub
parent 9320c1699a
commit ba9563b983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,9 +3,11 @@ import { ILocalUser, User } from '@/models/entities/user.js';
export default (object: any, user: { id: User['id'] }) => {
if (object == null) return null;
const id = typeof object.id === 'string' && object.id.startsWith(config.url) ? `${object.id}/undo` : undefined;
return {
type: 'Undo',
...(id ? { id } : {}),
actor: `${config.url}/users/${user.id}`,
object,
published: new Date().toISOString(),