diff --git a/locales/en-US.yml b/locales/en-US.yml index fa0d9d28e..fe1dc137e 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -843,6 +843,7 @@ _ffVisibility: public: "Public" followers: "Visible to followers only" private: "Private" + nobody: "Nobody (not even you)" _signup: almostThere: "Almost there" emailAddressInfo: "Please enter your email address. It will not be made public." diff --git a/packages/backend/migration/1684536337602-ffVisibilityNobody.js b/packages/backend/migration/1684536337602-ffVisibilityNobody.js new file mode 100644 index 000000000..8998e7d24 --- /dev/null +++ b/packages/backend/migration/1684536337602-ffVisibilityNobody.js @@ -0,0 +1,21 @@ +export class ffVisibilityNobody1684536337602 { + name = 'ffVisibilityNobody1684536337602'; + + async up(queryRunner) { + await queryRunner.query(`ALTER TYPE "public"."user_profile_ffvisibility_enum" RENAME TO "user_profile_ffvisibility_enum_old"`); + await queryRunner.query(`CREATE TYPE "public"."user_profile_ffvisibility_enum" AS ENUM('public', 'followers', 'private', 'nobody')`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "ffVisibility" DROP DEFAULT`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "ffVisibility" TYPE "public"."user_profile_ffvisibility_enum" USING "ffVisibility"::"text"::"public"."user_profile_ffvisibility_enum"`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "ffVisibility" SET DEFAULT 'public'`); + await queryRunner.query(`DROP TYPE "public"."user_profile_ffvisibility_enum_old"`); + } + + async down(queryRunner) { + await queryRunner.query(`CREATE TYPE "public"."user_profile_ffvisibility_enum_old" AS ENUM('public', 'followers', 'private')`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "ffVisibility" DROP DEFAULT`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "ffVisibility" TYPE "public"."user_profile_ffvisibility_enum_old" USING "ffVisibility"::"text"::"public"."user_profile_ffvisibility_enum_old"`); + await queryRunner.query(`ALTER TABLE "user_profile" ALTER COLUMN "ffVisibility" SET DEFAULT 'public'`); + await queryRunner.query(`DROP TYPE "public"."user_profile_ffvisibility_enum"`); + await queryRunner.query(`ALTER TYPE "public"."user_profile_ffvisibility_enum_old" RENAME TO "user_profile_ffvisibility_enum"`); + } +} diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index 4387ed922..aea591229 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -255,6 +255,8 @@ export const UserRepository = db.getRepository(User).extend({ } case 'private': return me?.id === user.id; + case 'nobody': + return false; } } diff --git a/packages/client/src/pages/settings/privacy.vue b/packages/client/src/pages/settings/privacy.vue index f8b02efb6..54ee1cf8e 100644 --- a/packages/client/src/pages/settings/privacy.vue +++ b/packages/client/src/pages/settings/privacy.vue @@ -16,6 +16,7 @@ + diff --git a/packages/foundkey-js/src/consts.ts b/packages/foundkey-js/src/consts.ts index a7ea18d25..ed9fd8e53 100644 --- a/packages/foundkey-js/src/consts.ts +++ b/packages/foundkey-js/src/consts.ts @@ -4,7 +4,7 @@ export const noteNotificationTypes = ['mention', 'reply', 'renote', 'quote', 're export const mutedNoteReasons = ['word', 'manual', 'spam', 'other'] as const; -export const ffVisibility = ['public', 'followers', 'private'] as const; +export const ffVisibility = ['public', 'followers', 'private', 'nobody'] as const; export const permissions = [ 'read:account', diff --git a/packages/foundkey-js/src/entities.ts b/packages/foundkey-js/src/entities.ts index 5cec05c99..a83a8c123 100644 --- a/packages/foundkey-js/src/entities.ts +++ b/packages/foundkey-js/src/entities.ts @@ -38,7 +38,7 @@ export type UserDetailed = UserLite & { birthday: string | null; createdAt: DateString; description: string | null; - ffVisibility: 'public' | 'followers' | 'private'; + ffVisibility: 'public' | 'followers' | 'private' | 'nobody'; fields: {name: string; value: string}[]; followersCount: number; followingCount: number;