From 608ff73907a142de74aca544fbec823d90ed6dc9 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sun, 5 Sep 2021 23:35:48 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E3=83=AA=E3=83=A2=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=81=8B=E3=82=89=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E5=89=8A=E9=99=A4=E3=81=8C=E9=A3=9B=E3=82=93=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=81=9F=E3=82=89=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=20(#7768)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Delete Actor * Update src/remote/activitypub/kernel/delete/actor.ts Co-authored-by: syuilo Co-authored-by: syuilo --- src/remote/activitypub/kernel/delete/actor.ts | 26 +++++++++++++++++++ src/remote/activitypub/kernel/delete/index.ts | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/remote/activitypub/kernel/delete/actor.ts diff --git a/src/remote/activitypub/kernel/delete/actor.ts b/src/remote/activitypub/kernel/delete/actor.ts new file mode 100644 index 0000000000..502f8d5ab5 --- /dev/null +++ b/src/remote/activitypub/kernel/delete/actor.ts @@ -0,0 +1,26 @@ +import { apLogger } from '../../logger'; +import { createDeleteAccountJob } from '@/queue'; +import { IRemoteUser } from '@/models/entities/user'; +import { Users } from '@/models/index'; + +const logger = apLogger; + +export async function deleteActor(actor: IRemoteUser, uri: string): Promise { + logger.info(`Deleting the Actor: ${uri}`); + + if (actor.uri !== uri) { + return `skip: delete actor ${actor.uri} !== ${uri}`; + } + + if (actor.isDeleted) { + logger.info(`skip: already deleted`); + } + + const job = await createDeleteAccountJob(actor); + + await Users.update(actor.id, { + isDeleted: true, + }); + + return `ok: queued ${job.name} ${job.id}`; +} diff --git a/src/remote/activitypub/kernel/delete/index.ts b/src/remote/activitypub/kernel/delete/index.ts index 474f3f6d60..86a452de76 100644 --- a/src/remote/activitypub/kernel/delete/index.ts +++ b/src/remote/activitypub/kernel/delete/index.ts @@ -2,6 +2,7 @@ import deleteNote from './note'; import { IRemoteUser } from '@/models/entities/user'; import { IDelete, getApId, isTombstone, IObject, validPost, validActor } from '../../type'; import { toSingle } from '@/prelude/array'; +import { deleteActor } from './actor'; /** * 削除アクティビティを捌きます @@ -41,7 +42,7 @@ export default async (actor: IRemoteUser, activity: IDelete): Promise => if (validPost.includes(formarType)) { return await deleteNote(actor, uri); } else if (validActor.includes(formarType)) { - return `Delete Actor is not implanted`; + return await deleteActor(actor, uri); } else { return `Unknown type ${formarType}`; } From 0281bdd90c021ad882c064977b6673f3b457d204 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 Sep 2021 23:36:20 +0900 Subject: [PATCH 2/6] Update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bf00b64e2..ff0a0e6b60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ --> +## 12.x.x (unreleased) + +### Improvements +- リモートユーザーのDeleteアクティビティに対応 + +### Bugfixes + ## 12.90.1 (2021/09/05) ### Bugfixes From 0faa4470fb41ea2f7ea2770b905bf7e17b7893cc Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 9 Sep 2021 19:28:02 +0900 Subject: [PATCH 3/6] =?UTF-8?q?GitHub=20Actions=E3=81=A7Docker=20Hub?= =?UTF-8?q?=E3=81=B8=E3=81=AEpush=E3=82=92=E8=A1=8C=E3=81=86=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=20(#7782)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Create docker.yml * Update .github/workflows/docker.yml Co-authored-by: tamaina * add workflow_dispatch * Multi-platform image * Revert "Multi-platform image" This reverts commit e5bac6632909a5020b0708227ebe248b443c2c2b. Co-authored-by: tamaina --- .github/workflows/docker.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000000..1c6ad343e3 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,32 @@ +name: Publish Docker image + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: misskey/misskey + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build and Push to Docker Hub + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 935d6473edf259efa3b9c2c167a80cb960b07ad6 Mon Sep 17 00:00:00 2001 From: tamaina Date: Thu, 9 Sep 2021 20:23:31 +0900 Subject: [PATCH 4/6] =?UTF-8?q?chore:=20API=E3=83=89=E3=82=AD=E3=83=A5?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88=E3=81=AE=E4=BF=AE=E6=AD=A3=20(#7771?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * packedNotificationSchemaを更新 * read:gallery, write:gallery, read:gallery-likes, write:gallery-likesに翻訳を追加 * fix * add header, choice, invitation --- locales/ja-JP.yml | 4 +++ src/misc/api-permissions.ts | 1 + src/models/repositories/notification.ts | 46 +++++++++++++++++++++---- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index e22f50668f..b9623ef0d0 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1150,6 +1150,10 @@ _permissions: "write:user-groups": "ユーザーグループを操作する" "read:channels": "チャンネルを見る" "write:channels": "チャンネルを操作する" + "read:gallery": "ギャラリーを見る" + "write:gallery": "ギャラリーを操作する" + "read:gallery-likes": "ギャラリーのいいねを見る" + "write:gallery-likes": "ギャラリーのいいねを操作する" _auth: shareAccess: "「{name}」がアカウントにアクセスすることを許可しますか?" diff --git a/src/misc/api-permissions.ts b/src/misc/api-permissions.ts index eb20c3d289..160cdf9fd6 100644 --- a/src/misc/api-permissions.ts +++ b/src/misc/api-permissions.ts @@ -32,3 +32,4 @@ export const kinds = [ 'read:gallery-likes', 'write:gallery-likes', ]; +// IF YOU ADD KINDS(PERMISSIONS), YOU MUST ADD TRANSLATIONS (under _permissions). diff --git a/src/models/repositories/notification.ts b/src/models/repositories/notification.ts index 55af96b6d7..ed9de7ef4c 100644 --- a/src/models/repositories/notification.ts +++ b/src/models/repositories/notification.ts @@ -7,6 +7,7 @@ import { Note } from '@/models/entities/note'; import { NoteReaction } from '@/models/entities/note-reaction'; import { User } from '@/models/entities/user'; import { aggregateNoteEmojis, prefetchEmojis } from '@/misc/populate-emojis'; +import { notificationTypes } from '@/types'; export type PackedNotification = SchemaType; @@ -124,20 +125,53 @@ export const packedNotificationSchema = { optional: false as const, nullable: false as const, format: 'date-time', }, + isRead: { + type: 'boolean' as const, + optional: false as const, nullable: false as const, + }, type: { type: 'string' as const, optional: false as const, nullable: false as const, - enum: ['follow', 'followRequestAccepted', 'receiveFollowRequest', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote'], - }, - userId: { - type: 'string' as const, - optional: true as const, nullable: true as const, - format: 'id', + enum: [...notificationTypes], }, user: { type: 'object' as const, ref: 'User', optional: true as const, nullable: true as const, }, + userId: { + type: 'string' as const, + optional: true as const, nullable: true as const, + format: 'id', + }, + note: { + type: 'object' as const, + ref: 'Note', + optional: true as const, nullable: true as const, + }, + reaction: { + type: 'string' as const, + optional: true as const, nullable: true as const, + }, + choice: { + type: 'number' as const, + optional: true as const, nullable: true as const, + }, + invitation: { + type: 'object' as const, + optional: true as const, nullable: true as const, + }, + body: { + type: 'string' as const, + optional: true as const, nullable: true as const, + }, + header: { + type: 'string' as const, + optional: true as const, nullable: true as const, + }, + icon: { + type: 'string' as const, + optional: true as const, nullable: true as const, + }, } }; From c63ba5470a1d04a86908d504c7044bd4987c20fc Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 11 Sep 2021 11:32:47 +0900 Subject: [PATCH 5/6] fix: use master branch when build docker image --- .github/workflows/docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1c6ad343e3..fe6c3bfd20 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,6 +13,8 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v2 + with: + ref: master - name: Docker meta id: meta uses: docker/metadata-action@v3 From f59f424795490e6ae2fe0be65ee3debb0776e939 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 11 Sep 2021 11:37:35 +0900 Subject: [PATCH 6/6] Revert "fix: use master branch when build docker image" This reverts commit c63ba5470a1d04a86908d504c7044bd4987c20fc. --- .github/workflows/docker.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fe6c3bfd20..1c6ad343e3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,8 +13,6 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v2 - with: - ref: master - name: Docker meta id: meta uses: docker/metadata-action@v3