feat(account): added user profile pictures in settings#1297
feat(account): added user profile pictures in settings#1297waleedlatif1 merged 4 commits intostagingfrom
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR introduces user profile picture functionality to the settings page, implementing a comprehensive upload system that supports both S3 and Azure Blob storage. The changes add a new profile picture upload component in the account settings modal, complete with hover effects, file validation (5MB limit, PNG/JPEG only), and proper error handling.
The implementation follows the established architecture patterns found throughout the codebase for file uploads. New environment variables (S3_PROFILE_PICTURES_BUCKET_NAME and AZURE_STORAGE_PROFILE_PICTURES_CONTAINER_NAME) and configuration objects were added to lib/uploads/setup.ts and lib/env.ts, mirroring the structure used for other file types like chat images and knowledge base files.
A custom React hook (useProfilePictureUpload) was created to encapsulate the upload logic, including file validation, preview generation using blob URLs, progress tracking, and proper cleanup of temporary resources. The hook implements a dual upload strategy that attempts presigned URL uploads first, then falls back to server-side upload if needed.
The presigned URL API (/api/files/presigned/route.ts) was extended with a new 'profile-pictures' upload type, including proper validation for image-only uploads and user authentication requirements. The user profile API (/api/users/me/profile/route.ts) was updated to accept an optional image field alongside the existing name field, with URL validation and database updates.
The changes maintain consistency with existing upload patterns while adding specific constraints appropriate for profile pictures, such as image-only validation and user authentication requirements. The implementation supports direct URL access for optimal performance when displaying profile pictures across the application.
Confidence score: 4/5
- This PR is safe to merge with good implementation quality and follows established patterns
- Score reflects well-structured code following existing conventions, though some areas could benefit from additional validation
- Pay close attention to account.tsx for potential null reference handling and the dual storage fallback logic in the upload hook
6 files reviewed, no comments
.../[workspaceId]/w/components/sidebar/components/settings-modal/components/account/account.tsx
Outdated
Show resolved
Hide resolved
.../[workspaceId]/w/components/sidebar/components/settings-modal/components/account/account.tsx
Show resolved
Hide resolved
* update infra and remove railway * feat(account): add profile pictures * Revert "update infra and remove railway" This reverts commit e3f0c49. * ack PR comments, use brandConfig logo URL as default
) * update infra and remove railway * feat(account): add profile pictures * Revert "update infra and remove railway" This reverts commit e3f0c49. * ack PR comments, use brandConfig logo URL as default
Summary
added user profile pictures in settings, supports both blob & s3
Type of Change
Testing
Tested manually.
Checklist