-
Notifications
You must be signed in to change notification settings - Fork 13
780 add ability to updateset group image from group description page #784
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
780 add ability to updateset group image from group description page #784
Conversation
Implemented the ability to pick and update a group's image in both the provider and edit group screen. The UI now allows users to select a new image, and the provider handles uploading and updating the group image data.
Moves group image update to occur before group info update in EditGroupScreen. Also injects ImagePickerService into GroupsNotifier for improved testability and consistency.
Removed internal image picking logic from GroupsNotifier and now require the image path to be provided directly when updating a group image. This simplifies the updateGroupImage method and moves image selection responsibility outside the provider.
WalkthroughAdds group image selection and upload: extends GroupsNotifier with an ImagePickerService dependency and updateGroupImage method, and updates the edit-group UI to pick, preview, and save a new group avatar. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.dart📄 CodeRabbit inference engine (.cursor/rules/flutter.mdc)
Files:
lib/**/*.dart📄 CodeRabbit inference engine (.cursor/rules/flutter.mdc)
Files:
🧠 Learnings (8)📓 Common learnings📚 Learning: 2025-10-24T17:31:14.191ZApplied to files:
📚 Learning: 2025-09-14T21:22:00.962ZApplied to files:
📚 Learning: 2025-10-15T02:08:41.843ZApplied to files:
📚 Learning: 2025-09-07T13:10:16.542ZApplied to files:
📚 Learning: 2025-08-23T11:02:28.308ZApplied to files:
📚 Learning: 2025-09-07T02:15:31.931ZApplied to files:
📚 Learning: 2025-10-28T07:11:05.836ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
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
🧹 Nitpick comments (1)
lib/config/providers/group_provider.dart (1)
45-49: Drop unused imagePickerService parameter.The new
imagePickerServiceconstructor parameter is never stored or referenced, so it just adds noise. Either wire it into the notifier or remove the parameter (and related import) to keep the constructor clean.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/config/providers/group_provider.dart(4 hunks)lib/ui/chat/chat_info/edit_group_screen.dart(7 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.dart
📄 CodeRabbit inference engine (.cursor/rules/flutter.mdc)
**/*.dart: Always declare the type of each variable and function (parameters and return value)
Avoid using dynamic and Object without justification
Create necessary types instead of overusing primitives or dynamic
One export per file
Use PascalCase for classes
Use camelCase for variables, functions, and methods
Avoid magic numbers and define constants
Start each function name with a verb
Use verbs for boolean variables (e.g., isLoading, hasError, canDelete)
Write short functions with a single purpose (under ~20 instructions)
Name functions with a verb plus context; for booleans use isX/hasX/canX; for void use executeX/saveX
Avoid deep nesting via early returns and extraction to utility functions
Use higher-order functions (map, where/filter, reduce) to avoid nesting
Use arrow functions for simple functions (under ~3 statements); use named functions otherwise
Use default parameter values instead of null checks
Reduce function parameters using RO-RO: pass/return parameter objects with declared types
Maintain a single level of abstraction within functions
Encapsulate data in composite types; avoid overusing primitives
Prefer validating data within classes rather than in functions
Prefer immutability; use final for runtime constants and const for compile-time constants
Use const constructors and const literals where possible
Follow SOLID principles
Prefer composition over inheritance
Declare interfaces (abstract classes) to define contracts
Write small classes with a single purpose (under ~200 instructions, <10 public methods, <10 properties)
Use exceptions for unexpected errors
Only catch exceptions to fix expected problems or add context; otherwise use a global handler
Files:
lib/ui/chat/chat_info/edit_group_screen.dartlib/config/providers/group_provider.dart
lib/**/*.dart
📄 CodeRabbit inference engine (.cursor/rules/flutter.mdc)
lib/**/*.dart: Use flutter_rust_bridge to access core app functionality
Use Riverpod for state management; prefer StreamProviders for Rust API streams; use keepAlive if needed
Use freezed to model/manage UI states
Controllers should expose methods as inputs and update UI state that drives the UI
Use AutoRoute for navigation and use extras to pass data between pages
Use Dart extensions to manage reusable code
Use ThemeData to manage themes
Use AppLocalizations for translations
Use constants to manage constant values
Avoid deeply nested widget trees; aim for a flatter widget structure for performance and readability
Break down large widgets into smaller, focused, reusable components
Keep the widget tree shallow to simplify state management and data flow
Utilize const constructors and const widgets wherever possible to reduce rebuilds
Files:
lib/ui/chat/chat_info/edit_group_screen.dartlib/config/providers/group_provider.dart
🧠 Learnings (14)
📓 Common learnings
Learnt from: Quwaysim
Repo: parres-hq/whitenoise_flutter PR: 634
File: lib/config/providers/group_provider.dart:1130-1132
Timestamp: 2025-09-14T21:22:00.962Z
Learning: In the whitenoise_flutter codebase, the _updateGroupInfo method in GroupsNotifier performs optimistic updates that directly modify Group objects in the provider state (groups list and groupsMap). For non-DM groups, the display name comes from group.name, so updating the Group object directly is sufficient to reflect name changes in the UI without needing to refresh the separate display name cache.
Learnt from: josefinalliende
Repo: parres-hq/whitenoise_flutter PR: 728
File: lib/config/providers/chat_input_provider.dart:94-112
Timestamp: 2025-10-24T17:31:14.191Z
Learning: In the whitenoise_flutter project's chat input provider, duplicate image selections should be allowed (not deduplicated) when a user picks images, as users may intentionally want to send the same image multiple times.
📚 Learning: 2025-10-24T17:31:14.191Z
Learnt from: josefinalliende
Repo: parres-hq/whitenoise_flutter PR: 728
File: lib/config/providers/chat_input_provider.dart:94-112
Timestamp: 2025-10-24T17:31:14.191Z
Learning: In the whitenoise_flutter project's chat input provider, duplicate image selections should be allowed (not deduplicated) when a user picks images, as users may intentionally want to send the same image multiple times.
Applied to files:
lib/ui/chat/chat_info/edit_group_screen.dart
📚 Learning: 2025-09-14T21:22:00.962Z
Learnt from: Quwaysim
Repo: parres-hq/whitenoise_flutter PR: 634
File: lib/config/providers/group_provider.dart:1130-1132
Timestamp: 2025-09-14T21:22:00.962Z
Learning: In the whitenoise_flutter codebase, the _updateGroupInfo method in GroupsNotifier performs optimistic updates that directly modify Group objects in the provider state (groups list and groupsMap). For non-DM groups, the display name comes from group.name, so updating the Group object directly is sufficient to reflect name changes in the UI without needing to refresh the separate display name cache.
Applied to files:
lib/ui/chat/chat_info/edit_group_screen.dartlib/config/providers/group_provider.dart
📚 Learning: 2025-09-07T13:10:16.542Z
Learnt from: josefinalliende
Repo: parres-hq/whitenoise_flutter PR: 597
File: lib/config/providers/group_provider.dart:311-314
Timestamp: 2025-09-07T13:10:16.542Z
Learning: In the whitenoise_flutter codebase, the User class used in group_provider.dart (and similar contexts) is presentational only, not the actual user class from the Rust API. There are plans to remove this User class and replace it with UserProfileData, similar to the planned consolidation with ContactModel.
Applied to files:
lib/ui/chat/chat_info/edit_group_screen.dartlib/config/providers/group_provider.dart
📚 Learning: 2025-08-23T11:02:28.308Z
Learnt from: Quwaysim
Repo: parres-hq/whitenoise_flutter PR: 527
File: lib/ui/core/ui/wn_avatar.dart:1-6
Timestamp: 2025-08-23T11:02:28.308Z
Learning: In the whitenoise_flutter codebase, flutter_screenutil is re-exported through lib/ui/core/themes/src/app_theme.dart, so files that import app_theme.dart do not need to directly import flutter_screenutil to use .w, .h, .sp extensions.
Applied to files:
lib/ui/chat/chat_info/edit_group_screen.dart
📚 Learning: 2025-09-07T02:15:31.931Z
Learnt from: josefinalliende
Repo: parres-hq/whitenoise_flutter PR: 594
File: lib/src/rust/api/utils.dart:12-16
Timestamp: 2025-09-07T02:15:31.931Z
Learning: The lingering PublicKey references in lib/config/providers/auth_provider.dart, lib/config/providers/group_provider.dart, and rust_builder/cargokit/build_tool/lib/src/options.dart identified during the utils.dart API cleanup were fixed in PR #597 in the whitenoise_flutter codebase.
Applied to files:
lib/ui/chat/chat_info/edit_group_screen.dartlib/config/providers/group_provider.dart
📚 Learning: 2025-10-28T07:11:05.836Z
Learnt from: Quwaysim
Repo: parres-hq/whitenoise_flutter PR: 759
File: lib/ui/settings/profile/edit_profile_screen.dart:126-145
Timestamp: 2025-10-28T07:11:05.836Z
Learning: In lib/ui/settings/profile/edit_profile_screen.dart, the edit icon on the profile avatar is intentionally positioned with `left: 1.sw * 0.5` rather than being centered. This positioning is by design and should not be flagged as a centering issue.
Applied to files:
lib/ui/chat/chat_info/edit_group_screen.dart
📚 Learning: 2025-10-12T22:44:49.606Z
Learnt from: CR
Repo: parres-hq/whitenoise_flutter PR: 0
File: .cursor/rules/flutter.mdc:0-0
Timestamp: 2025-10-12T22:44:49.606Z
Learning: Applies to lib/**/*.dart : Use freezed to model/manage UI states
Applied to files:
lib/config/providers/group_provider.dart
📚 Learning: 2025-09-01T14:56:50.988Z
Learnt from: josefinalliende
Repo: parres-hq/whitenoise_flutter PR: 568
File: lib/ui/core/ui/wn_image.dart:1-2
Timestamp: 2025-09-01T14:56:50.988Z
Learning: The whitenoise_flutter project does not target web platforms and any future web version would be in a separate repository, so dart:io imports and file system operations are acceptable in this codebase.
Applied to files:
lib/config/providers/group_provider.dart
📚 Learning: 2025-10-12T22:44:49.606Z
Learnt from: CR
Repo: parres-hq/whitenoise_flutter PR: 0
File: .cursor/rules/flutter.mdc:0-0
Timestamp: 2025-10-12T22:44:49.606Z
Learning: Applies to lib/**/*.dart : Use Dart extensions to manage reusable code
Applied to files:
lib/config/providers/group_provider.dart
📚 Learning: 2025-10-12T22:44:49.606Z
Learnt from: CR
Repo: parres-hq/whitenoise_flutter PR: 0
File: .cursor/rules/flutter.mdc:0-0
Timestamp: 2025-10-12T22:44:49.606Z
Learning: Applies to lib/**/*.dart : Use Riverpod for state management; prefer StreamProviders for Rust API streams; use keepAlive if needed
Applied to files:
lib/config/providers/group_provider.dart
📚 Learning: 2025-10-12T22:44:49.606Z
Learnt from: CR
Repo: parres-hq/whitenoise_flutter PR: 0
File: .cursor/rules/flutter.mdc:0-0
Timestamp: 2025-10-12T22:44:49.606Z
Learning: Applies to **/*.dart : Follow SOLID principles
Applied to files:
lib/config/providers/group_provider.dart
📚 Learning: 2025-10-13T06:31:48.305Z
Learnt from: Quwaysim
Repo: parres-hq/whitenoise_flutter PR: 719
File: lib/domain/services/avatar_color_service.dart:88-139
Timestamp: 2025-10-13T06:31:48.305Z
Learning: In the whitenoise_flutter project (lib/domain/services/avatar_color_service.dart), avatar colors should be locally randomized (Signal-style) where different devices see different colors for the same user. Colors are persistent per device but NOT deterministic across devices. This is an intentional design choice per issue #299 discussion with vladimir-krstic.
Applied to files:
lib/config/providers/group_provider.dart
📚 Learning: 2025-09-01T14:56:47.293Z
Learnt from: josefinalliende
Repo: parres-hq/whitenoise_flutter PR: 568
File: lib/ui/core/ui/wn_image.dart:1-2
Timestamp: 2025-09-01T14:56:47.293Z
Learning: The whitenoise_flutter project does not target web platforms - any web version would be in a separate repository. Therefore, dart:io usage and web compatibility concerns can be ignored in this codebase.
Applied to files:
lib/config/providers/group_provider.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Flutter CI
Added a check for the widget's mounted status before calling setState after picking a profile image to prevent potential errors if the widget is disposed.
Quwaysim
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.
LGTM
Description
Add ability to update group image from edit group screen
Summary
This PR implements the ability for group admins to update group images directly from the edit group information screen, bringing feature parity with the group creation flow. The implementation includes proper image caching, error handling, and ensures group metadata syncs across all members.
Changes Made
GroupsNotifier (
lib/config/providers/group_provider.dart)updateGroupImage()handles image selection, upload, and group metadata updatesEditGroupScreen (
lib/ui/chat/chat_info/edit_group_screen.dart)Type of Change
Checklist
just precommitto ensure that formatting and linting are correctjust check-flutter-coverageto ensure that flutter coverage rules are passingCHANGELOG.mdfile with your changes (if they affect the user experience)Summary by CodeRabbit