feat: implement new patch#32
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR introduces a complete profile avatar management system integrating Cloudinary backend storage with frontend image cropping using Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant Web as Web (Frontend)
participant Dialog as Avatar Crop Dialog
participant Canvas as Canvas Utils
participant API as API Endpoint
participant Service as Avatar Service
participant Cloudinary as Cloudinary
participant DB as Database
User->>Web: Click Change Avatar
Web->>Web: Show file input (JPEG/PNG/WebP, 8MB max)
User->>Web: Select image file
Web->>Dialog: Open crop dialog with image
Dialog->>Dialog: Display image with zoom slider
User->>Dialog: Adjust crop area & zoom
Dialog->>Dialog: Track crop coordinates
User->>Dialog: Click "Use this photo"
Dialog->>Canvas: Convert cropped area to JPEG base64
Canvas->>Canvas: Load image, draw to canvas (512×512)
Canvas->>Canvas: Convert to JPEG (quality 0.9)
Canvas->>Dialog: Return imageBase64 + mimeType
Dialog->>API: POST /user/setAvatar {imageBase64, mimeType}
API->>Service: setUserAvatar(input, userId)
Service->>Service: Validate base64 & convert to Buffer
Service->>Cloudinary: Upload via upload_stream
Cloudinary->>Service: Return secureUrl & publicId
Service->>DB: Update user.image = secureUrl
Service->>Cloudinary: Delete prior image (if different publicId)
Service->>API: Return {image: secureUrl}
API->>Web: Success response + toast
Web->>Web: Refresh session & router data
Web->>User: Display updated avatar
Dialog->>Dialog: Close & reset state
sequenceDiagram
participant User as User
participant Web as Web (Frontend)
participant API as API Endpoint
participant Service as Avatar Service
participant Cloudinary as Cloudinary
participant DB as Database
User->>Web: Click Remove Avatar
Web->>API: POST /user/removeAvatar
API->>Service: removeUserAvatar(userId)
Service->>DB: Lookup user by ID
DB->>Service: User data with current image URL
Service->>Service: Extract publicId from Cloudinary URL
Service->>Cloudinary: Delete image by publicId (invalidate cache)
Cloudinary->>Service: Deletion complete (or not_found treated as success)
Service->>DB: Update user.image = null
Service->>API: Return {image: null}
API->>Web: Success response + toast
Web->>Web: Refresh session & router data
Web->>User: Display default initials
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Review rate limit: 0/1 reviews remaining, refill in 47 minutes and 46 seconds.Comment |
Summary by CodeRabbit
New Features
Documentation