1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-25 11:43:07 +01:00

Profile themes and pronouns

This commit is contained in:
Madeline 2022-12-31 17:25:28 +11:00
parent 09b0eeb2dd
commit 0fe03771ce
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
8 changed files with 71 additions and 5 deletions

View File

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

View File

@ -92,7 +92,9 @@ router.get(
const userProfile = {
bio: req.user_bot ? null : user.bio,
accent_color: user.accent_color,
banner: user.banner
banner: user.banner,
pronouns: user.pronouns,
theme_colors: user.theme_colors,
};
const guildMemberDto = guild_member
@ -126,6 +128,8 @@ router.get(
premium_since: user.premium_since, // TODO
mutual_guilds: mutual_guilds, // TODO {id: "", nick: null} when ?with_mutual_guilds=true
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,
guild_member: guild_id && guildMemberDto,
guild_member_profile: guild_id && guildMemberProfile
@ -154,7 +158,9 @@ router.patch("/", route({ body: "UserProfileModifySchema" }), async (req: Reques
res.json({
accent_color: user.accent_color,
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,
bio: related_user.bio,
premium_since: user.premium_since,
premium_type: user.premium_type,
accent_color: related_user.accent_color,
};
users.push(public_related_user);

View File

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

View File

@ -125,6 +125,12 @@ export class Member extends BaseClassWithoutId {
@Column()
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 })
communication_disabled_until: Date;

View File

@ -34,6 +34,9 @@ export enum PublicUserEnum {
bio,
bot,
premium_since,
premium_type,
theme_colors,
pronouns,
}
export type PublicUserKeys = keyof typeof PublicUserEnum;
@ -88,6 +91,12 @@ export class User extends BaseClass {
@Column({ nullable: true })
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 })
phone?: string; // phone number of the user
@ -351,7 +360,7 @@ export class User extends BaseClass {
valid_tokens_since: new Date(),
},
extended_settings: "{}",
premium_type: Config.get().defaults.user.premium_type,
premium_type: Config.get().defaults.user.premiumType,
premium: Config.get().defaults.user.premium,
verified: Config.get().defaults.user.verified,
settings: settings,

View File

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

View File

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