add "nobody" follower visibility

Adds a new follower/following visibility that hides followers even from
yourself.

Changelog: Added
This commit is contained in:
Johann150 2023-05-20 00:32:18 +02:00
parent ef4055840b
commit fe65cba9be
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
6 changed files with 27 additions and 2 deletions

View file

@ -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."

View file

@ -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"`);
}
}

View file

@ -255,6 +255,8 @@ export const UserRepository = db.getRepository(User).extend({
}
case 'private':
return me?.id === user.id;
case 'nobody':
return false;
}
}

View file

@ -16,6 +16,7 @@
<option value="public">{{ i18n.ts._ffVisibility.public }}</option>
<option value="followers">{{ i18n.ts._ffVisibility.followers }}</option>
<option value="private">{{ i18n.ts._ffVisibility.private }}</option>
<option vlaue="nobody">{{ i18n.ts._ffVisibility.nobody }}</option>
<template #caption>{{ i18n.ts.ffVisibilityDescription }}</template>
</FormSelect>

View file

@ -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',

View file

@ -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;