Skip to content

Add group profile image upload and update support#125

Open
bhaktiyadav08 wants to merge 3 commits into
CodePlaygroundHub:mainfrom
bhaktiyadav08:feature/group-image-support
Open

Add group profile image upload and update support#125
bhaktiyadav08 wants to merge 3 commits into
CodePlaygroundHub:mainfrom
bhaktiyadav08:feature/group-image-support

Conversation

@bhaktiyadav08

@bhaktiyadav08 bhaktiyadav08 commented Jul 19, 2026

Copy link
Copy Markdown

Summary

Implemented full group profile image support.

Backend

  • Added Cloudinary upload for group images
  • Added API to update group profile image
  • Added image validation

Frontend

  • Upload image while creating a group
  • Update group image from Group Info
  • Display image in sidebar
  • Display image in chat header
  • Display image in group info
  • Added loading spinner during upload
  • Added fallback image

Testing

  • Created group with image
  • Updated existing group image
  • Verified sidebar, chat header, and group info updates
  • Verified image validation

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Create groups with optional avatar upload and preview.
    • Update group avatars from group settings with validation, upload feedback, and immediate refresh.
  • Improvements

    • Group avatars now persist and display across chat headers and the sidebar, with clear fallbacks when missing.
    • Group header/edit UI was refreshed, and admin status detection was improved.
    • Group updates now reliably reflect refreshed membership details.
  • Chores

    • Expanded repo ignore rules for common Python artifacts and build outputs.

@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

@bhaktiyadav08 is attempting to deploy a commit to the Akash Santra 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@bhaktiyadav08, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 34d662ae-baa0-4907-b0ec-4fd64780187f

📥 Commits

Reviewing files that changed from the base of the PR and between 8c15276 and 9a2a8d5.

📒 Files selected for processing (3)
  • backend/src/controllers/group.controller.js
  • frontend/src/components/ChangeGroupInfoModal.jsx
  • frontend/src/components/CreateGroupModal.jsx
📝 Walkthrough

Walkthrough

Group avatars can be selected during creation, updated by admins, uploaded to Cloudinary, persisted as URLs, synchronized across group state, and displayed in the chat header, sidebar, and group information page.

Changes

Group avatar management

Layer / File(s) Summary
Cloudinary avatar persistence
.gitignore, backend/src/controllers/group.controller.js
Group creation and updates upload avatars to Cloudinary or clear them, then return populated group data.
Group creation and edit controls
frontend/src/components/CreateGroupModal.jsx, frontend/src/components/ChangeGroupInfoModal.jsx
Creation and edit modals preview selected images, include avatar data in requests, and refresh groups after edits.
Admin avatar update workflow
frontend/src/components/GroupMembersModal.jsx
Admins can validate and upload group images while updating local group state, selected chat state, and the groups list.
Avatar display and group-page integration
frontend/src/components/ChatHeader.jsx, frontend/src/components/Sidebar.jsx, frontend/src/pages/GroupInfoPage.jsx
Group avatars and fallbacks render across group views, with member-role-based admin detection and avatar editing controls.

Estimated code review effort: 4 (Complex) | ~40 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Admin
  participant GroupMembersModal
  participant groupController
  participant Cloudinary
  participant GroupDatabase
  Admin->>GroupMembersModal: select group avatar
  GroupMembersModal->>groupController: PATCH avatar data
  groupController->>Cloudinary: upload image
  Cloudinary-->>groupController: return secure_url
  groupController->>GroupDatabase: save avatar URL
  GroupDatabase-->>groupController: return updated group
  groupController-->>GroupMembersModal: return group data
  GroupMembersModal->>GroupMembersModal: update selected group and refresh groups
Loading

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding group profile image upload and update support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
frontend/src/components/CreateGroupModal.jsx (1)

15-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Inconsistent avatar validation across upload entry points. Both handlers convert the selected file to a data URL and send it without the MIME/size checks that GroupMembersModal.jsx (L88-99) applies, so oversized or non-image files reach the backend unchecked. Extract the shared validation (file.type.startsWith("image/") + 5 MB cap) and apply it in both.

  • frontend/src/components/CreateGroupModal.jsx#L15-L25: add type/size validation in handleImageSelect before readAsDataURL.
  • frontend/src/components/ChangeGroupInfoModal.jsx#L14-L25: add the same validation in handleImageChange before readAsDataURL.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/components/CreateGroupModal.jsx` around lines 15 - 25, Extract
or reuse the shared avatar validation used by GroupMembersModal, requiring an
image MIME type and a maximum size of 5 MB. Apply it in handleImageSelect in
frontend/src/components/CreateGroupModal.jsx (lines 15-25) and handleImageChange
in frontend/src/components/ChangeGroupInfoModal.jsx (lines 14-25) before each
FileReader.readAsDataURL call, rejecting invalid files without updating the
avatar.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/src/controllers/group.controller.js`:
- Around line 55-63: Update createGroup to validate the avatar’s MIME/type
before calling cloudinary.uploader.upload, rejecting unsupported content
server-side rather than relying on the JSON size limit. Pass folder: "groups" in
the upload options, matching updateGroup, while preserving the existing
secure_url assignment and group creation flow.

In `@frontend/src/components/CreateGroupModal.jsx`:
- Line 60: Remove the leftover console.log(res.data) debug statement from the
CreateGroupModal response handling while preserving the surrounding logic.

In `@frontend/src/components/GroupMembersModal.jsx`:
- Around line 183-184: Update the isCreatorMember comparison in
GroupMembersModal to normalize group.createdBy to its identifier when it is a
populated object, matching the normalization already used by isCreator. Preserve
support for an unpopulated string id so the creator’s remove button remains
hidden in both response shapes.

---

Nitpick comments:
In `@frontend/src/components/CreateGroupModal.jsx`:
- Around line 15-25: Extract or reuse the shared avatar validation used by
GroupMembersModal, requiring an image MIME type and a maximum size of 5 MB.
Apply it in handleImageSelect in frontend/src/components/CreateGroupModal.jsx
(lines 15-25) and handleImageChange in
frontend/src/components/ChangeGroupInfoModal.jsx (lines 14-25) before each
FileReader.readAsDataURL call, rejecting invalid files without updating the
avatar.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c000b8c4-daba-4587-b448-66114736d6ca

📥 Commits

Reviewing files that changed from the base of the PR and between 64c82d1 and e19fd88.

📒 Files selected for processing (8)
  • .gitignore
  • backend/src/controllers/group.controller.js
  • frontend/src/components/ChangeGroupInfoModal.jsx
  • frontend/src/components/ChatHeader.jsx
  • frontend/src/components/CreateGroupModal.jsx
  • frontend/src/components/GroupMembersModal.jsx
  • frontend/src/components/Sidebar.jsx
  • frontend/src/pages/GroupInfoPage.jsx

Comment thread backend/src/controllers/group.controller.js
Comment thread frontend/src/components/CreateGroupModal.jsx Outdated
Comment thread frontend/src/components/GroupMembersModal.jsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant