activitypub: process Move activities and movedTo field on actors #309

Manually merged
Johann150 merged 10 commits from account-moving into main 2023-03-23 20:48:19 +00:00
5 changed files with 38 additions and 14 deletions
Showing only changes of commit 9174d633d4 - Show all commits

View file

@ -1290,6 +1290,7 @@ _notification:
yourFollowRequestAccepted: "Your follow request was accepted"
youWereInvitedToGroup: "{userName} invited you to a group"
pollEnded: "Poll results have become available"
moved: "{name} has moved to a different account"
emptyPushNotificationMessage: "Push notifications have been updated"
_types:
follow: "New followers"
@ -1303,6 +1304,7 @@ _notification:
receiveFollowRequest: "Received follow requests"
followRequestAccepted: "Accepted follow requests"
groupInvited: "Group invitations"
move: "Others moving accounts"
app: "Notifications from linked apps"
_actions:
followBack: "followed you back"

View file

@ -52,19 +52,20 @@ export class Notification {
public notifier: User | null;
/**
*
* follow -
* mention - 稿
* reply - (Watchしている)稿
* renote - (Watchしている)稿Renoteされた
* quote - (Watchしている)稿Renoteされた
* reaction - (Watchしている)稿
* pollVote - (Watchしている)稿
* pollEnded -
* receiveFollowRequest -
* followRequestAccepted -
* groupInvited -
* app -
* Type of notification.
* follow - notifier followed notifiee
* mention - notifiee was mentioned
* reply - notifiee (author or watching) was replied to
* renote - notifiee (author or watching) was renoted
* quote - notifiee (author or watching) was quoted
* reaction - notifiee (author or watching) had a reaction added to the note
* pollVote - new vote in a poll notifiee authored or watched
* pollEnded - notifiee's poll ended
* receiveFollowRequest - notifiee received a new follow request
* followRequestAccepted - notifier accepted notifees follow request
* groupInvited - notifiee was invited into a group
* move - notifier moved
* app - custom application notification
*/
@Index()
@Column('enum', {
@ -129,6 +130,19 @@ export class Notification {
})
public choice: number | null;
@Column({
...id(),
nullable: true,
comment: 'The ID of the moved to account.',
})
public moveTargetId: User['id'] | null;
@ManyToOne(() => User, {
onDelete: 'CASCADE',
})
@JoinColumn()
public moveTarget: User | null;
/**
* body
*/

View file

@ -44,6 +44,9 @@ export const NotificationRepository = db.getRepository(Notification).extend({
...(notification.type === 'groupInvited' ? {
invitation: UserGroupInvitations.pack(notification.userGroupInvitationId!),
} : {}),
...(notification.type === 'move' ? {
moveTarget: Users.pack(notification.moveTarget ?? notification.moveTargetId),
} : {}),
...(notification.type === 'app' ? {
body: notification.customBody,
header: notification.customHeader || token?.name,

View file

@ -1,4 +1,4 @@
export const notificationTypes = ['follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app'] as const;
export const notificationTypes = ['follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'move', 'app'] as const;
export const noteNotificationTypes = ['mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded'] as const;

View file

@ -223,6 +223,11 @@ export type Notification = {
invitation: UserGroup;
user: User;
userId: User['id'];
} | {
type: 'move',
user: User;
userId: User['id'];
moveTarget: User;
} | {
type: 'app';
header?: string | null;