docs: Add guide for managing user profile photos (#3280)#643
docs: Add guide for managing user profile photos (#3280)#643abdulawalarif wants to merge 3 commits into
Conversation
|
Thanks for this, it's a thorough and accurate guide. A couple of small wording and consistency notes inline. |
|
|
||
| ```dart | ||
| final profile = await client.userProfile.setUserImage(byteData); | ||
| print(profile.imageUrl); // Uri? — public URL of the new image |
There was a problem hiding this comment.
Nit: these docs don't use em dashes. There are 9 in this file (lines 54, 94, 112, 266, 268, and 298-301). Could you swap them for periods, commas, or colons? For example on this line, // Uri? — public URL of the new image becomes // Uri?, the public URL of the new image.
|
|
||
| ## Display the profile photo | ||
|
|
||
| `UserProfileModel.imageUrl` is a public `Uri?`. When it is `null`, show a placeholder. |
There was a problem hiding this comment.
Small readability thing: a few sentences start with a code-formatted word, which reads as a symbol rather than the start of a sentence (this line, plus 162, 208, and 294). Opening with a normal word flows better, for example:
The
UserProfileModel.imageUrlfield is a publicUri?. When it isnull, show a placeholder.
| @@ -0,0 +1,301 @@ | |||
| --- | |||
There was a problem hiding this comment.
For consistency with the other pages in this folder, which use a numbered filename prefix, could you rename this to something like 07-profile-photos.md? It keeps the sidebar order predictable.
|
|
||
| ### Restrict who can edit | ||
|
|
||
| There is no built-in `userCanEditUserImage` flag in v3 auth (legacy auth had this). Override the endpoint to restrict uploads: |
There was a problem hiding this comment.
For consistency with the other auth pages, which call this serverpod_auth_idp (or "the authentication module") and the old one "legacy serverpod_auth", could we drop the "v3"/"v2" labels here, on line 81, and on line 301? With the framework on 4.0, "v3 auth" can read as confusing.
Rename to 07-profile-photos.md, remove em dashes, reword sentences that start with code, and use serverpod_auth_idp/serverpod_auth naming. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@developerjamiu Thanks for the review! I've addressed all the feedback:
Also merged latest |
Summary
Addresses serverpod/serverpod#3280.
Adds a procedural guide for uploading, updating, and displaying user profile photos with the v3 auth module. The existing Working with users page covered the edit endpoint API but not the full client flow requested in the issue.
New page:
docs/06-concepts/11-authentication/profile-photos.mdUserProfileEndpoint, generated client methods, optional access controlsetUserImage, error handlingUserProfileModel.imageUrl,CircleAvatarUserProfileConfigand server-side processingAuthServices.instance.userProfilesUpdated:
docs/06-concepts/11-authentication/03-working-with-users.mdTest plan
npm startand openhttp://localhost:3000/concepts/authentication/profile-photos