activitypub: process Move
activities and movedTo
field on actors
#309
4 changed files with 22 additions and 0 deletions
BIN
packages/backend/assets/notification-badges/suitcase-solid.png
Normal file
BIN
packages/backend/assets/notification-badges/suitcase-solid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -15,6 +15,7 @@
|
||||||
<i v-else-if="notification.type === 'quote'" class="fas fa-quote-left"></i>
|
<i v-else-if="notification.type === 'quote'" class="fas fa-quote-left"></i>
|
||||||
<i v-else-if="notification.type === 'pollVote'" class="fas fa-poll-h"></i>
|
<i v-else-if="notification.type === 'pollVote'" class="fas fa-poll-h"></i>
|
||||||
<i v-else-if="notification.type === 'pollEnded'" class="fas fa-poll-h"></i>
|
<i v-else-if="notification.type === 'pollEnded'" class="fas fa-poll-h"></i>
|
||||||
|
<i v-else-if="notification.type === 'move'" class="fas fa-suitcase"></i>
|
||||||
<!-- notification.reaction が null になることはまずないが、ここでoptional chaining使うと一部ブラウザで刺さるので念の為 -->
|
<!-- notification.reaction が null になることはまずないが、ここでoptional chaining使うと一部ブラウザで刺さるので念の為 -->
|
||||||
<MkEmoji
|
<MkEmoji
|
||||||
v-else-if="notification.type === 'reaction'"
|
v-else-if="notification.type === 'reaction'"
|
||||||
|
@ -86,6 +87,10 @@
|
||||||
<button class="_textButton" @click="rejectGroupInvitation()">{{ i18n.ts.reject }}</button>
|
<button class="_textButton" @click="rejectGroupInvitation()">{{ i18n.ts.reject }}</button>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="notification.type === 'move'" class="text" style="opacity: 0.6;">
|
||||||
Johann150 marked this conversation as resolved
|
|||||||
|
{{ i18n.ts.moved }}
|
||||||
|
<div v-if="full"><MkFollowButton :user="notification.moveTarget" :full="true"/></div>
|
||||||
|
</span>
|
||||||
<span v-if="notification.type === 'app'" class="text">
|
<span v-if="notification.type === 'app'" class="text">
|
||||||
<Mfm :text="notification.body" :nowrap="!full"/>
|
<Mfm :text="notification.body" :nowrap="!full"/>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -217,6 +217,20 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
|
||||||
],
|
],
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
case 'move':
|
||||||
|
return [t('_notification.moved', { name: getUserName(data.body.user) }), {
|
||||||
|
body: getUserName(data.body.moveTarget),
|
||||||
|
icon: data.body.moveTarget.avatarUrl,
|
||||||
|
badge: iconUrl('suitcase'),
|
||||||
|
data,
|
||||||
|
action: [
|
||||||
|
{
|
||||||
|
action: 'accept',
|
||||||
|
title: t('follow'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}];
|
||||||
|
|
||||||
case 'app':
|
case 'app':
|
||||||
return [data.body.header || data.body.body, {
|
return [data.body.header || data.body.body, {
|
||||||
body: data.body.header && data.body.body,
|
body: data.body.header && data.body.body,
|
||||||
|
|
|
@ -96,6 +96,9 @@ self.addEventListener('notificationclick', <K extends keyof pushNotificationData
|
||||||
case 'groupInvited':
|
case 'groupInvited':
|
||||||
await swos.api('users/groups/invitations/accept', id, { invitationId: data.body.invitation.id });
|
await swos.api('users/groups/invitations/accept', id, { invitationId: data.body.invitation.id });
|
||||||
break;
|
break;
|
||||||
|
case 'move':
|
||||||
|
await swos.api('following/create', id, { userId: data.body.moveTarget.id });
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'reject':
|
case 'reject':
|
||||||
|
|
Loading…
Reference in a new issue
Something that might be worth refactoring in this PR but is otherwise fine: The CSS class
text
is used several times with a local override ofopacity: 0.6
it might be worth factoring out a dedicated CSS class for this likedim-notification-text
or even just a class that only applies the opacity. IIRC this will help a bit with rendering performance.Good idea in general, but this has nothing to do with
Move
activities so it should be done outside of this PR.