From a441cc6067c487c563bf673be261a179d96e0533 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 9 Jul 2023 20:12:16 -0700 Subject: [PATCH] Revert "[mastodon-client] send actual default post privacy instead of fallback value" This reverts commit 81145570fcb458a9239f88fe9a273d6c2f1810d3. --- .../api/endpoints/i/registry/get-unsecure.ts | 2 +- .../server/api/mastodon/endpoints/account.ts | 2 +- packages/megalodon/src/misskey.ts | 17 ----------------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts b/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts index a9bcf69351..f98c6c929f 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/get-unsecure.ts @@ -33,7 +33,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async (ps, user) => { - if (ps.key !== "reactions" && ps.key !== "defaultNoteVisibility") return; + if (ps.key !== "reactions") return; const query = RegistryItems.createQueryBuilder("item") .where("item.domain IS NULL") .andWhere("item.userId = :userId", { userId: user.id }) diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index 5d0abdedd6..3fb1c9cbe4 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -48,7 +48,7 @@ export function apiAccountMastodon(router: Router): void { acct.source = { note: acct.note, fields: acct.fields, - privacy: await client.getDefaultPostPrivacy(), + privacy: "public", sensitive: false, language: "", }; diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts index b4a9c6adb9..de62b98509 100644 --- a/packages/megalodon/src/misskey.ts +++ b/packages/megalodon/src/misskey.ts @@ -1539,23 +1539,6 @@ export default class Misskey implements MegalodonInterface { .then(res => res.data[0] ?? '⭐'); } - private async getDefaultPostPrivacy(): Promise { - // NOTE: get-unsecure is calckey's extension. - // Misskey doesn't have this endpoint and regular `/i/registry/get` won't work - // unless you have a 'nativeToken', which is reserved for the frontend webapp. - - return this.client - .post('/api/i/registry/get-unsecure', { - key: 'defaultNoteVisibility', - scope: ['client', 'base'], - }) - .then(res => { - if (!res.data || (res.data != 'public' && res.data != 'home' && res.data != 'followers' && res.data != 'specified')) - return 'public'; - return this.converter.visibility(res.data); - }); - } - public async unfavouriteStatus(id: string): Promise> { // NOTE: Misskey allows only one reaction per status, so we don't need to care what that emoji was. return this.deleteEmojiReaction(id, '');