-
Notifications
You must be signed in to change notification settings - Fork 0
FIX: proper handling of group memberships #3
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
base: group-dm-user-addition-pre
Are you sure you want to change the base?
Conversation
| controller.set('model', model); | ||
| controller.set('members', this.get('_members')); | ||
| controller.set("model", model); | ||
| model.findMembers(); |
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.
[Best Practice] Inconsistent Data Loading Strategy * Problem: Data loading has shifted from the route's afterModel hook to the controller's setupController, which can cause race conditions or UI inconsistencies. * Fix: Adhere to Ember's conventional pattern by resolving all necessary data in the route's model or afterModel hooks.
| @module Discourse | ||
| **/ | ||
| Discourse.Group = Discourse.Model.extend({ | ||
| limit: 50, |
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.
[Refactor] UI State in Domain Model and Controller * Problem: The Group model and AdminGroup controller are managing UI-specific pagination state, coupling them to the presentation layer. * Fix: Extract pagination state and logic into a dedicated presentation-layer component or service to improve model purity and reusability.
|
|
||
| return can_not_modify_automatic if group.automatic | ||
|
|
||
| usernames.split(",").each do |username| |
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.
[Performance] Inefficient Batch Operations * Problem: The add_members action iterates through usernames, performing individual database lookups and additions, leading to excessive queries and performance issues. * Fix: Refactor to fetch all users in a single batched query (e.g., User.where(username: usernames.split(',',))) and add them to the group more efficiently (e.g., group.users << users_to_add).
Test 8