Story 2448 - Webpage Integration Edit User Profile Avatar#2523
Story 2448 - Webpage Integration Edit User Profile Avatar#2523jlchilders11 wants to merge 4 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
herzog0
left a comment
There was a problem hiding this comment.
Looking pretty good!!
I just have a couple of notes/findings we could take a look at.
One general note: the backend is already returning the correct error message. Would be nice if we could use it to display in the form instead of a generic message. Btw, backend says the user shouldn't exceed 1MB, while FE says 5MB.
| permission_classes = [IsAuthenticated] | ||
|
|
||
| def perform_update(self, serializer): | ||
| instance = serializer.save() |
There was a problem hiding this comment.
Actually, I think we should maybe re-evaluate this new section entirely and take a deeper look into the pre-existing save() function in the model I just mentioned, as it includes some other important stuff like preventing automatic avatar overrides when refresh_users_github_photos runs, for example.
There was a problem hiding this comment.
Could you clarify what you mean? I'm not entirely clear what the logic in the form save is doing, other than the thumbnail cleanup myself.
| permission_classes = [IsAuthenticated] | ||
|
|
||
| def perform_update(self, serializer): | ||
| instance = serializer.save() |
There was a problem hiding this comment.
| if self.request.POST.get("delete_profile_image", "").lower() == "true": | ||
| instance.profile_image.delete() |
There was a problem hiding this comment.
There was a problem hiding this comment.
This is true, but I'm not sure if this is a problem?
| if request.GET.get("edit", "").lower() == "true" and isinstance( | ||
| request.user, AnonymousUser | ||
| ): |





Issue: #2448
Summary & Context
Performs the necessary hook up for allowing for the saving of a new avatar image for the user, or deleting that same image.
Changes
Please list any potential risks or areas that need extra attention during review/testing
The states in the form are somewhat fragile, as they rely on invisible checkboxes and srcs on images.
Javascriptless functionality will be implemented in a future ticket.
Self-review Checklist
Frontend