Skip to content

Commit

Permalink
Merge pull request #805 from NatalieWilson19/add-reason-to-delete-acc…
Browse files Browse the repository at this point in the history
…ount-#748

Add reason to delete account #748
  • Loading branch information
lil5 authored Dec 9, 2024
2 parents f0f7dd7 + 42897cf commit 1bd6ae9
Show file tree
Hide file tree
Showing 12 changed files with 563 additions and 49 deletions.
38 changes: 33 additions & 5 deletions frontend/Caddyfile-dev
Original file line number Diff line number Diff line change
@@ -1,17 +1,45 @@
(astro_url) {
# /event/:uid/ -> /event/?event=
@oldevent path_regexp eventp ^/(\w{2}/)?events/([\w-]{36})/?$
redir @oldevent /{re.eventp.1}events/details/?event={re.eventp.2} 302

# /loops/:uid/members -> /loops/members?chain=
@oldmembers path_regexp membersp ^/(\w{2}/)?loops/([\w-]{36})/members/?$
redir @oldmembers /{re.membersp.1}loops/members/?chain={re.membersp.2} 302

# /loops/:uid/users/signup -> /loops/users/signup/?chain=
@oldusersignup path_regexp userssignupp ^/(\w{2}/)?loops/([\w-]{36})/users/signup/?$
redir @oldusersignup /{re.userssignupp.1}loops/users/signup/?chain={re.userssignupp.2} 302

# /loops/:uid/users/login -> /loops/users/login/?chain=
@olduserslogin path_regexp usersloginp ^/(\w{2}/)?loops/([\w-]{36})/users/login/?$
redir @olduserslogin /{re.usersloginp.1}loops/users/login/?chain={re.usersloginp.2} 302

# /users/login/validate?apiKey= -> /users/login/validate/?apiKey=
# https://acc.clothingloop.org/users/login/validate?apiKey=74932015&u=aG9zdEBleGFtcGxlLmNvbQ%3D%3D
@oldusersvalidp path_regexp usersvalidp ^/(\w{2}/)?users/login/validate$
redir @oldusersvalidp /{re.usersvalidp.1}users/login/validate/?{query} 302

# /users/me/edit -> /users/edit/?user=me
@olduserseditme path_regexp userseditme ^/(\w{2}/)?users/me/edit$
redir @olduserseditme /{re.userseditme.1}users/edit/?user=me 302
}

:80 {
handle_path /api/* {
handle_path /api/* {
reverse_proxy server:8084
}

redir /mailpit /mailpit/
redir /mailpit /mailpit/
handle_path /mailpit/* {
rewrite * /mailpit{path}
reverse_proxy mailpit:8025
}
handle_path /toolkit {
redir https://drive.google.com/drive/folders/1iMJzIcBxgApKx89hcaHhhuP5YAs_Yb27
}
handle {
reverse_proxy frontend:3000
}
handle {
import astro_url
reverse_proxy frontend:3000
}
}
3 changes: 3 additions & 0 deletions frontend/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import reactI18next from "astro-react-i18next";
export default defineConfig({
output: "static",
site: import.meta.env.PUBLIC_BASE_URL,
devToolbar: {
enabled: false,
},
integrations: [
reactI18next({
defaultLocale: "en",
Expand Down
16 changes: 16 additions & 0 deletions frontend/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,28 @@
"cancel": "Cancel",
"deleteAccount": "Are you sure you want to permanently delete your account?",
"deleteAccountWithLoops": "As you are the only host of the following Loops, you need to delete these first or add a co-host!",
"moved": "I moved",
"planToJoinNewLoop": "At my new address, I plan to join a new Loop",
"planToStartNewLoop": "At my new address, I plan to start a new Loop",
"dontPlanToParticipate": "I don't plan to participate in a new Loop anymore",
"notEnoughItemsILiked": "I didn't find enough items I liked",
"qualityDidntMatch": "The quality of the clothes didn't match my standards",
"sizesDidntMatch": "The sizes of the clothes didn't match my size",
"stylesDidntMatch": "The styles of the clothes didn't match my style",
"addressTooFar": "The next address is too far away",
"tooTimeConsuming": "The loop took up too much time",
"doneSwapping": "I'm done swapping",
"didntFitIn": "I didn't connect to the Clothing Loop community",
"didntMeanToRegister": "I didn't mean to register with this Loop",
"areYouSureRemoveEvent": "Are you sure you want to permanently delete this event?",
"areYouSureLogout": "Are you sure you want to logout?",
"deleteUserBtn": "Delete Account",
"selectReasonForLeaving": "Please select a reason for leaving",
"leaveFeedback": "Please let us know why you've decided to leave the Clothing Loop and if there's anything we could do to improve.",
"edit": "Edit",
"editAddress": "Edit address",
"editUserDetails": "Edit user details",
"dontWantToShare": "I don't want to share ",
"approveParticipant": "Approve “{{ name }}'s” request to join the loop?",
"denyParticipant": "Deny “{{ name }}'s” request to join the loop?",
"route": "Route",
Expand Down
39 changes: 39 additions & 0 deletions frontend/src/api/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,42 @@ export const CatI18nKeys: Record<Categories | string, string> = {
"4": "toys",
"5": "books",
};
export enum ReasonsForLeaving {
moved = "1",
notEnoughItemsILiked = "2",
addressTooFar = "3",
tooTimeConsuming = "4",
doneSwapping = "5",
didntFitIn = "6",
other = "7",
planToJoinNewLoop = "8",
planToStartNewLoop = "9",
dontPlanToParticipate = "10",
/** sub of notEnoughItemsILiked */
qualityDidntMatch = "11",
/** sub of notEnoughItemsILiked */
sizesDidntMatch = "12",
/** sub of notEnoughItemsILiked */
stylesDidntMatch = "13",
dontWantToShare = "14",
}

export const ReasonsForLeavingI18nKeys: Record<
ReasonsForLeaving | string,
string
> = {
"1": "moved",
"2": "notEnoughItemsILiked",
"3": "addressTooFar",
"4": "tooTimeConsuming",
"5": "doneSwapping",
"6": "didntFitIn",
"7": "other",
"8": "planToJoinNewLoop",
"9": "planToStartNewLoop",
"10": "dontPlanToParticipate",
"11": "qualityDidntMatch",
"12": "sizesDidntMatch",
"13": "stylesDidntMatch",
"14": "dontWantToShare",
};
16 changes: 15 additions & 1 deletion frontend/src/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,24 @@ export function userAddAsChainAdmin(chainUID: string, userUID: string) {
});
}

export function userPurge(userUID: string) {
export function userPurge(
userUID: string,
reasonsForLeaving: string[],
otherExplanation?: string,
) {
const baseOE = otherExplanation ? btoa(otherExplanation) : undefined;
console.log(
"Purging user",
userUID,
reasonsForLeaving.join(","),
otherExplanation,
baseOE,
);
return axios.delete<never>("v2/user/purge", {
params: {
user_uid: userUID,
rfl: reasonsForLeaving,
oe: baseOE,
},
});
}
Expand Down
Loading

0 comments on commit 1bd6ae9

Please sign in to comment.