Profile themes and pronouns

This commit is contained in:
Madeline 2022-12-31 17:25:28 +11:00
parent 13453129e7
commit 7a725bab50
8 changed files with 71 additions and 5 deletions

View File

@ -12064,6 +12064,22 @@
}, },
"bio": { "bio": {
"type": "string" "type": "string"
},
"pronouns": {
"type": "string"
},
"theme_colors": {
"type": "array",
"items": [
{
"type": "integer"
},
{
"type": "integer"
}
],
"minItems": 2,
"maxItems": 2
} }
}, },
"additionalProperties": false, "additionalProperties": false,
@ -19567,6 +19583,22 @@
"null", "null",
"string" "string"
] ]
},
"pronouns": {
"type": "string"
},
"theme_colors": {
"type": "array",
"items": [
{
"type": "integer"
},
{
"type": "integer"
}
],
"minItems": 2,
"maxItems": 2
} }
}, },
"additionalProperties": false, "additionalProperties": false,

View File

@ -92,7 +92,9 @@ router.get(
const userProfile = { const userProfile = {
bio: req.user_bot ? null : user.bio, bio: req.user_bot ? null : user.bio,
accent_color: user.accent_color, accent_color: user.accent_color,
banner: user.banner banner: user.banner,
pronouns: user.pronouns,
theme_colors: user.theme_colors,
}; };
const guildMemberDto = guild_member const guildMemberDto = guild_member
@ -126,6 +128,8 @@ router.get(
premium_since: user.premium_since, // TODO premium_since: user.premium_since, // TODO
mutual_guilds: mutual_guilds, // TODO {id: "", nick: null} when ?with_mutual_guilds=true mutual_guilds: mutual_guilds, // TODO {id: "", nick: null} when ?with_mutual_guilds=true
user: userDto, user: userDto,
premium_type: user.premium_type,
profile_themes_experiment_bucket: 4, // TODO: This doesn't make it available, for some reason?
user_profile: userProfile, user_profile: userProfile,
guild_member: guild_id && guildMemberDto, guild_member: guild_id && guildMemberDto,
guild_member_profile: guild_id && guildMemberProfile guild_member_profile: guild_id && guildMemberProfile
@ -154,7 +158,9 @@ router.patch("/", route({ body: "UserProfileModifySchema" }), async (req: Reques
res.json({ res.json({
accent_color: user.accent_color, accent_color: user.accent_color,
bio: user.bio, bio: user.bio,
banner: user.banner banner: user.banner,
theme_colors: user.theme_colors,
pronouns: user.pronouns,
}); });
}); });

View File

@ -198,6 +198,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
bot: related_user.bot, bot: related_user.bot,
bio: related_user.bio, bio: related_user.bio,
premium_since: user.premium_since, premium_since: user.premium_since,
premium_type: user.premium_type,
accent_color: related_user.accent_color, accent_color: related_user.accent_color,
}; };
users.push(public_related_user); users.push(public_related_user);

View File

@ -1,5 +1,5 @@
export class UserDefaults { export class UserDefaults {
premium: boolean = false; premium: boolean = true;
premium_type: number = 2; premiumType: number = 2;
verified: boolean = true; verified: boolean = true;
} }

View File

@ -125,6 +125,12 @@ export class Member extends BaseClassWithoutId {
@Column() @Column()
bio: string; bio: string;
@Column({ nullable: true, type: "simple-array" })
theme_colors?: number[]; // TODO: Separate `User` and `UserProfile` models
@Column({ nullable: true })
pronouns?: string;
@Column({ nullable: true }) @Column({ nullable: true })
communication_disabled_until: Date; communication_disabled_until: Date;

View File

@ -34,6 +34,9 @@ export enum PublicUserEnum {
bio, bio,
bot, bot,
premium_since, premium_since,
premium_type,
theme_colors,
pronouns,
} }
export type PublicUserKeys = keyof typeof PublicUserEnum; export type PublicUserKeys = keyof typeof PublicUserEnum;
@ -88,6 +91,12 @@ export class User extends BaseClass {
@Column({ nullable: true }) @Column({ nullable: true })
banner?: string; // hash of the user banner banner?: string; // hash of the user banner
@Column({ nullable: true, type: "simple-array" })
theme_colors?: number[]; // TODO: Separate `User` and `UserProfile` models
@Column({ nullable: true })
pronouns?: string;
@Column({ nullable: true, select: false }) @Column({ nullable: true, select: false })
phone?: string; // phone number of the user phone?: string; // phone number of the user
@ -351,7 +360,7 @@ export class User extends BaseClass {
valid_tokens_since: new Date(), valid_tokens_since: new Date(),
}, },
extended_settings: "{}", extended_settings: "{}",
premium_type: Config.get().defaults.user.premium_type, premium_type: Config.get().defaults.user.premiumType,
premium: Config.get().defaults.user.premium, premium: Config.get().defaults.user.premium,
verified: Config.get().defaults.user.verified, verified: Config.get().defaults.user.verified,
settings: settings, settings: settings,

View File

@ -2,4 +2,10 @@ export interface MemberChangeProfileSchema {
banner?: string | null; banner?: string | null;
nick?: string; nick?: string;
bio?: string; bio?: string;
pronouns?: string;
/*
* @items.type integer
*/
theme_colors?: [number, number];
} }

View File

@ -2,4 +2,10 @@ export interface UserProfileModifySchema {
bio?: string; bio?: string;
accent_color?: number | null; accent_color?: number | null;
banner?: string | null; banner?: string | null;
pronouns?: string;
/*
* @items.type integer
*/
theme_colors?: [number, number]
} }