-
-
- {#if data.member.fields.length === 0}
-
- Fields are extra categories you can add separate from names and pronouns.
- For example, you could use them for gender terms, honorifics, or compliments.
-
- {/if}
-
- {#each filteredFlags as flag (flag.id)}
- addFlag(flag)}
- />
- {:else}
- {#if data.flags.length === 0}
- You haven't uploaded any flags yet.
- {:else}
- There are no flags matching your search {flagSearch}.
- {/if}
- {/each}
-
-
-
-
- {#if data.flags.length === 0}
-
Why can't I see any flags?
-
- There are thousands of pride flags, and it would be impossible to bundle all of them
- by default. Many labels also have multiple different flags that are favoured by
- different people. Because of this, there are no flags available by default--instead,
- you can upload flags in your settings. Your main profile
- and your member profiles can all have different flags.
-
- {:else}
- To upload and delete flags, go to your settings.
- {/if}
-
-
- {#if data.user.list_private}
-
- Your member list is currently hidden, so this setting has no effect. If
- you want to make your member list visible again,
- edit your user profile.
-
- {/if}
-
- This only hides this member from your member list.
-
- This member will still be visible to anyone at
- pronouns.cc/@{data.user.name}/{data.member.name}.
-
-
-
- {#if PUBLIC_SHORT_BASE}
-
-
- Current short ID: {data.member.sid}
-
-
-
-
-
-
-
- This ID is used in prns.cc links. You can reroll one short ID every hour (shared
- between your main profile and all members) by pressing the button above.
-
-
-
- {/if}
-
-
-
diff --git a/frontend/src/routes/edit/member/[id]/+page.ts b/frontend/src/routes/edit/member/[id]/+page.ts
index eeb532d..dd6c34a 100644
--- a/frontend/src/routes/edit/member/[id]/+page.ts
+++ b/frontend/src/routes/edit/member/[id]/+page.ts
@@ -1,9 +1,6 @@
-import type { PrideFlag, MeUser, APIError, Member, PronounsJson } from "$lib/api/entities";
+import { ErrorCode, type APIError, type Member, type MeUser } from "$lib/api/entities";
import { apiFetchClient } from "$lib/api/fetch";
-import { error } from "@sveltejs/kit";
-
-import pronounsRaw from "$lib/pronouns.json";
-const pronouns = pronounsRaw as PronounsJson;
+import { error, redirect } from "@sveltejs/kit";
export const ssr = false;
@@ -11,15 +8,24 @@ export const load = async ({ params }) => {
try {
const user = await apiFetchClient(`/users/@me`);
const member = await apiFetchClient(`/members/${params.id}`);
- const flags = await apiFetchClient("/users/@me/flags");
- return {
- user,
- member,
- pronouns: pronouns.autocomplete,
- flags,
- };
+ if (user.id !== member.user.id) {
+ throw {
+ code: ErrorCode.NotOwnMember,
+ message: "You can only edit your own members.",
+ } as APIError;
+ }
+
+ throw redirect(303, `/@${user.name}/${member.name}/edit`);
} catch (e) {
- throw error((e as APIError).code, e as APIError);
+ if (
+ (e as APIError).code === ErrorCode.Forbidden ||
+ (e as APIError).code === ErrorCode.InvalidToken ||
+ (e as APIError).code === ErrorCode.NotOwnMember
+ ) {
+ throw error(403, e as APIError);
+ }
+
+ throw e;
}
};
diff --git a/frontend/src/routes/edit/profile/+page.svelte b/frontend/src/routes/edit/profile/+page.svelte
deleted file mode 100644
index a8beed5..0000000
--- a/frontend/src/routes/edit/profile/+page.svelte
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/frontend/src/routes/edit/profile/+page.ts b/frontend/src/routes/edit/profile/+page.ts
index d1b7381..1182cbf 100644
--- a/frontend/src/routes/edit/profile/+page.ts
+++ b/frontend/src/routes/edit/profile/+page.ts
@@ -10,8 +10,13 @@ export const load = async () => {
throw redirect(303, `/@${resp.name}/edit`);
} catch (e) {
- if ((e as APIError).code === ErrorCode.Forbidden || (e as APIError).code === ErrorCode.InvalidToken) {
- throw error(403, e as APIError)
+ if (
+ (e as APIError).code === ErrorCode.Forbidden ||
+ (e as APIError).code === ErrorCode.InvalidToken
+ ) {
+ throw error(403, e as APIError);
}
+
+ throw e;
}
};