summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-02 20:37:25 +1100
committerGitHub <noreply@github.com>2023-01-02 20:37:25 +1100
commit5ef4b80fc54db92467961ee8190f1fc93e8b4b71 (patch)
tree5165a3937f8204bf68829aaa6d829481a6693541 /src
parentUse adjusted email in /auth/login (diff)
parentProfile themes and pronouns (diff)
downloadserver-5ef4b80fc54db92467961ee8190f1fc93e8b4b71.tar.xz
Merge pull request #922 from MaddyUnderStars/maddy/bodyParserPatch
Patch body-parser to use json-bigint, like gateway
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/users/#id/profile.ts10
-rw-r--r--src/gateway/opcodes/Identify.ts1
-rw-r--r--src/util/config/types/subconfigurations/defaults/UserDefaults.ts4
-rw-r--r--src/util/entities/Member.ts6
-rw-r--r--src/util/entities/User.ts11
-rw-r--r--src/util/schemas/MemberChangeProfileSchema.ts6
-rw-r--r--src/util/schemas/UserProfileModifySchema.ts6
7 files changed, 39 insertions, 5 deletions
diff --git a/src/api/routes/users/#id/profile.ts b/src/api/routes/users/#id/profile.ts
index 083d44af..ac844427 100644
--- a/src/api/routes/users/#id/profile.ts
+++ b/src/api/routes/users/#id/profile.ts
@@ -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,
 	});
 });
 
diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts
index 69a60880..ca3ae66f 100644
--- a/src/gateway/opcodes/Identify.ts
+++ b/src/gateway/opcodes/Identify.ts
@@ -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);
diff --git a/src/util/config/types/subconfigurations/defaults/UserDefaults.ts b/src/util/config/types/subconfigurations/defaults/UserDefaults.ts
index 4481c011..f20a14b6 100644
--- a/src/util/config/types/subconfigurations/defaults/UserDefaults.ts
+++ b/src/util/config/types/subconfigurations/defaults/UserDefaults.ts
@@ -1,5 +1,5 @@
 export class UserDefaults {
-    premium: boolean = false;
-    premium_type: number = 2;
+    premium: boolean = true;
+    premiumType: number = 2;
     verified: boolean = true;
 }
\ No newline at end of file
diff --git a/src/util/entities/Member.ts b/src/util/entities/Member.ts
index bffec326..eeae181e 100644
--- a/src/util/entities/Member.ts
+++ b/src/util/entities/Member.ts
@@ -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;
diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts
index eeffab5b..e039eb17 100644
--- a/src/util/entities/User.ts
+++ b/src/util/entities/User.ts
@@ -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,
diff --git a/src/util/schemas/MemberChangeProfileSchema.ts b/src/util/schemas/MemberChangeProfileSchema.ts
index 3e85174d..73c852f3 100644
--- a/src/util/schemas/MemberChangeProfileSchema.ts
+++ b/src/util/schemas/MemberChangeProfileSchema.ts
@@ -2,4 +2,10 @@ export interface MemberChangeProfileSchema {
 	banner?: string | null;
 	nick?: string;
 	bio?: string;
+	pronouns?: string;
+
+	/*
+	* @items.type integer
+	*/
+	theme_colors?: [number, number];
 }
diff --git a/src/util/schemas/UserProfileModifySchema.ts b/src/util/schemas/UserProfileModifySchema.ts
index 33a372c9..1e53d9e4 100644
--- a/src/util/schemas/UserProfileModifySchema.ts
+++ b/src/util/schemas/UserProfileModifySchema.ts
@@ -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]
 }