mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 13:27:31 -07:00
Use unique id for Undo (#8434)
This commit is contained in:
parent
a32a3bc5c9
commit
d35101c12b
1 changed files with 2 additions and 0 deletions
|
@ -3,9 +3,11 @@ import { ILocalUser, User } from '@/models/entities/user.js';
|
||||||
|
|
||||||
export default (object: any, user: { id: User['id'] }) => {
|
export default (object: any, user: { id: User['id'] }) => {
|
||||||
if (object == null) return null;
|
if (object == null) return null;
|
||||||
|
const id = typeof object.id === 'string' && object.id.startsWith(config.url) ? `${object.id}/undo` : undefined;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'Undo',
|
type: 'Undo',
|
||||||
|
...(id ? { id } : {}),
|
||||||
actor: `${config.url}/users/${user.id}`,
|
actor: `${config.url}/users/${user.id}`,
|
||||||
object,
|
object,
|
||||||
published: new Date().toISOString(),
|
published: new Date().toISOString(),
|
||||||
|
|
Loading…
Reference in a new issue