mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-11 06:31:51 +08:00
impr(server): trim consecutive newlines when updating user profile (theiereman) (#5538)
This commit is contained in:
parent
2da6e555cc
commit
2714af1eeb
4 changed files with 4 additions and 3 deletions
|
|
@ -847,7 +847,7 @@ export async function updateProfile(
|
|||
|
||||
await UserDAL.updateProfile(uid, profileDetailsUpdates, user.inventory);
|
||||
|
||||
return new MonkeyResponse("Profile updated");
|
||||
return new MonkeyResponse("Profile updated", profileDetailsUpdates);
|
||||
}
|
||||
|
||||
export async function getInbox(
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ export function sanitizeString(str: string | undefined): string | undefined {
|
|||
return str
|
||||
.replace(/[\u0300-\u036F]/g, "")
|
||||
.trim()
|
||||
.replace(/\n{3,}/g, "\n\n")
|
||||
.replace(/\s{3,}/g, " ");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ export default class Users {
|
|||
async updateProfile(
|
||||
profileUpdates: Partial<SharedTypes.UserProfileDetails>,
|
||||
selectedBadgeId?: number
|
||||
): Ape.EndpointResponse<null> {
|
||||
): Ape.EndpointResponse<SharedTypes.UserProfileDetails> {
|
||||
return await this.httpClient.patch(`${BASE_PATH}/profile`, {
|
||||
payload: {
|
||||
...profileUpdates,
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ async function updateProfile(): Promise<void> {
|
|||
return;
|
||||
}
|
||||
|
||||
snapshot.details = updates;
|
||||
snapshot.details = response.data ?? updates;
|
||||
snapshot.inventory?.badges.forEach((badge) => {
|
||||
if (badge.id === currentSelectedBadgeId) {
|
||||
badge.selected = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue