-
Notifications
You must be signed in to change notification settings - Fork 3
feature/BA-2965-duplicated-profile-fragments-refactor #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature/BA-2965-duplicated-profile-fragments-refactor #375
Conversation
WalkthroughAdded two public GraphQL fields to BaseChatRoomObjectType: Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant GraphQL as GraphQL Resolver
participant Room as ChatRoom
participant Participants as Participants/Profiles
Client->>GraphQL: query chatRoom { id, otherParticipant, isSoleAdmin, title, image }
GraphQL->>Room: load room by id
GraphQL->>Participants: fetch participants & profiles, determine current profile/participant
alt room.isGroup == false
GraphQL->>Participants: get_other_participant(excluding current profile)
Participants-->>GraphQL: other participant profile or null
GraphQL-->>Client: otherParticipant, title (other profile name or fallback), image (other profile image or fallback), isSoleAdmin = false
else room.isGroup == true
GraphQL->>Participants: fetch participant roles/admin flags
Participants-->>GraphQL: current participant info, admins list
GraphQL-->>Client: otherParticipant = null, title = room.title, image = room.image, isSoleAdmin = (current_is_admin AND admins_count == 1)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@baseapp_chats/graphql/object_types.py`:
- Around line 240-255: In resolve_other_participant, ensure current_profile is
actually a member before returning other_participant: first check membership
(e.g., participants.filter(profile_id=current_profile.pk).exists() or similar)
and return None if the current_profile is not in self.participants; only then
compute and return other_participant
(self.participants.exclude(profile_id=current_profile.pk).first()). Keep the
existing group check and current_profile None handling.
nossila
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rf2tsl can you add tests cases to cover the behavior on those 2 new generated fields?
…feature/BA-2965-duplicated-profile-fragments-refactor
Note* This only focuses on the web app, in order to totally remove the duplicate fragments we need to make some changes for the native app as well. This will need another story REQUIRES BE: silverlogic/baseapp-backend#375 Acceptance Criteria it seems weird to have MembersListFragment, ProfileSummaryFragment and RoomTitleFragment, they all have essentially the same fields, I think we should fully remove ProfileSummaryFragment from the code base, and also look into removing RoomTitleFragment, we should move this logic to the backend and treat group and 1-1 room's name and avatar the same way on the frontend Sidebar with AP for better understanding. Approvd https://app.approvd.io/silverlogic/BA/stories/44506 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Chat rooms now expose an explicit admin flag and a primary participant field for richer profile details. * **Refactor** * Unified title/image hooks across web and native for consistent avatar and title behavior. * Profile summary now loads from a chat-focused query, simplifying data flow without changing UI. * Reduced coupling to old fragment shapes, improving reliability of chat header and profile displays. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Acceptance Criteria
it seems weird to have MembersListFragment, ProfileSummaryFragment and RoomTitleFragment, they all have essentially the same fields, I think we should fully remove ProfileSummaryFragment from the code base, and also look into removing RoomTitleFragment, we should move this logic to the backend and treat group and 1-1 room's name and avatar the same way on the frontend
Sidebar with AP for better understanding.
Approvd
https://app.approvd.io/silverlogic/BA/stories/44506
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.