diff --git a/Foxnouns.Backend/Controllers/MembersController.cs b/Foxnouns.Backend/Controllers/MembersController.cs index ba9cf28..968b571 100644 --- a/Foxnouns.Backend/Controllers/MembersController.cs +++ b/Foxnouns.Backend/Controllers/MembersController.cs @@ -303,8 +303,8 @@ public class MembersController( .SetProperty(u => u.LastActive, clock.GetCurrentInstant()) ); - // Re-fetch member to fetch the new sid - var updatedMember = await db.ResolveMemberAsync(CurrentUser!.Id, memberRef); - return Ok(memberRenderer.RenderMember(updatedMember, CurrentToken)); + // Fetch the new sid then pass that to RenderMember + var newSid = await db.Members.Where(m => m.Id == member.Id).Select(m => m.Sid).FirstAsync(); + return Ok(memberRenderer.RenderMember(member, CurrentToken, newSid)); } } diff --git a/Foxnouns.Backend/Controllers/UsersController.cs b/Foxnouns.Backend/Controllers/UsersController.cs index 33c38d6..2693bef 100644 --- a/Foxnouns.Backend/Controllers/UsersController.cs +++ b/Foxnouns.Backend/Controllers/UsersController.cs @@ -346,13 +346,20 @@ public class UsersController( .SetProperty(u => u.LastActive, clock.GetCurrentInstant()) ); + // Get the user's new sid + var newSid = await db + .Users.Where(u => u.Id == CurrentUser.Id) + .Select(u => u.Sid) + .FirstAsync(); + var user = await db.ResolveUserAsync(CurrentUser.Id); return Ok( await userRenderer.RenderUserAsync( - user, + CurrentUser, CurrentUser, CurrentToken, - renderMembers: false + renderMembers: false, + overrideSid: newSid ) ); } diff --git a/Foxnouns.Backend/Services/MemberRendererService.cs b/Foxnouns.Backend/Services/MemberRendererService.cs index 7d7cac0..717f06c 100644 --- a/Foxnouns.Backend/Services/MemberRendererService.cs +++ b/Foxnouns.Backend/Services/MemberRendererService.cs @@ -24,13 +24,17 @@ public class MemberRendererService(DatabaseContext db, Config config) return members.Select(m => RenderPartialMember(m, renderUnlisted)); } - public MemberResponse RenderMember(Member member, Token? token = null) + public MemberResponse RenderMember( + Member member, + Token? token = null, + string? overrideSid = null + ) { var renderUnlisted = token?.UserId == member.UserId && token.HasScope("user.read_hidden"); return new MemberResponse( member.Id, - member.Sid, + overrideSid ?? member.Sid, member.Name, member.DisplayName ?? member.Name, member.Bio, diff --git a/Foxnouns.Backend/Services/UserRendererService.cs b/Foxnouns.Backend/Services/UserRendererService.cs index ceeba94..2911dd3 100644 --- a/Foxnouns.Backend/Services/UserRendererService.cs +++ b/Foxnouns.Backend/Services/UserRendererService.cs @@ -20,6 +20,7 @@ public class UserRendererService( Token? token = null, bool renderMembers = true, bool renderAuthMethods = false, + string? overrideSid = null, CancellationToken ct = default ) { @@ -59,7 +60,7 @@ public class UserRendererService( return new UserResponse( user.Id, - user.Sid, + overrideSid ?? user.Sid, user.Username, user.DisplayName, user.Bio, diff --git a/Foxnouns.Frontend/src/lib/components/Avatar.svelte b/Foxnouns.Frontend/src/lib/components/Avatar.svelte index 31f8355..99dd8f3 100644 --- a/Foxnouns.Frontend/src/lib/components/Avatar.svelte +++ b/Foxnouns.Frontend/src/lib/components/Avatar.svelte @@ -1,22 +1,23 @@ diff --git a/Foxnouns.Frontend/src/lib/components/Paginator.svelte b/Foxnouns.Frontend/src/lib/components/Paginator.svelte new file mode 100644 index 0000000..07cbd8d --- /dev/null +++ b/Foxnouns.Frontend/src/lib/components/Paginator.svelte @@ -0,0 +1,35 @@ + + +{#if pageCount > 1} +
+ {$t("edit-profile.bio-length-hint", { + length: value.length, + maxLength, + })} +
+ +{#if value !== ""} +{sid}
+
+
- {member.name}
+ {member.display_name}
{#if pronouns}
diff --git a/Foxnouns.Frontend/src/lib/i18n/locales/en.json b/Foxnouns.Frontend/src/lib/i18n/locales/en.json
index 5c026f9..7f1e377 100644
--- a/Foxnouns.Frontend/src/lib/i18n/locales/en.json
+++ b/Foxnouns.Frontend/src/lib/i18n/locales/en.json
@@ -6,13 +6,14 @@
},
"avatar-tooltip": "Avatar for {{name}}",
"profile": {
- "edit-member-profile-notice": "You are currently viewing the public profile of {memberName}.",
+ "edit-member-profile-notice": "You are currently viewing the public profile of {{memberName}}.",
"edit-user-profile-notice": "You are currently viewing your public profile.",
"edit-profile-link": "Edit profile",
"names-header": "Names",
"pronouns-header": "Pronouns",
"default-members-header": "Members",
- "create-member-button": "Create member"
+ "create-member-button": "Create member",
+ "back-to-user": "Back to {{name}}"
},
"title": {
"log-in": "Log in",
@@ -59,7 +60,10 @@
"validation-disallowed-value-2": "Allowed values are",
"validation-reason": "Reason",
"validation-generic": "The value you entered is not allowed here. Reason",
- "extra-info-header": "Extra error information"
+ "extra-info-header": "Extra error information",
+ "noscript-title": "This page requires JavaScript",
+ "noscript-info": "This page requires JavaScript to function correctly. Some buttons may not work, or the page may not work at all.",
+ "noscript-short": "Requires JavaScript"
},
"settings": {
"general-information-tab": "General information",
@@ -86,7 +90,9 @@
"log-out-hint": "Use this button to log out on this device only.",
"log-out-button": "Log out",
"avatar": "Avatar",
- "username-update-success": "Successfully changed your username!"
+ "username-update-success": "Successfully changed your username!",
+ "create-member-title": "Create a new member",
+ "create-member-name-label": "Member name"
},
"yes": "Yes",
"no": "No",
@@ -112,7 +118,19 @@
"profile-options-header": "Profile options",
"bio-tab": "Bio",
"saved-changes": "Successfully saved changes!",
- "bio-length-hint": "Using {{length}}/{{maxLength}} characters"
+ "bio-length-hint": "Using {{length}}/{{maxLength}} characters",
+ "preview": "Preview",
+ "fields-tab": "Fields",
+ "flags-links-tab": "Flags & links",
+ "back-to-settings-tab": "Back to settings",
+ "member-header": "Editing member {{name}}",
+ "username": "Username",
+ "change-username-info": "As changing your username will also change all of your members' links, you can only change it in your account settings.",
+ "change-username-link": "Go to settings",
+ "member-name": "Name",
+ "change-member-name": "Change name",
+ "display-name": "Display name"
},
- "save-changes": "Save changes"
+ "save-changes": "Save changes",
+ "change": "Change"
}
diff --git a/Foxnouns.Frontend/src/routes/@[username]/+page.server.ts b/Foxnouns.Frontend/src/routes/@[username]/+page.server.ts
index 6c582bc..99e7359 100644
--- a/Foxnouns.Frontend/src/routes/@[username]/+page.server.ts
+++ b/Foxnouns.Frontend/src/routes/@[username]/+page.server.ts
@@ -1,6 +1,8 @@
import { apiRequest } from "$api";
import type { PartialMember, UserWithMembers } from "$api/models";
+const MEMBERS_PER_PAGE = 20;
+
export const load = async ({ params, fetch, cookies, url }) => {
const user = await apiRequest
- {$t("edit-profile.bio-length-hint", { - length: bio.length, - maxLength: data.meta.limits.bio_length, - })} -
- -{#if bio !== ""} -