Skip to content

Conversation

@adamsaimi
Copy link
Owner

Test 8

controller.set('model', model);
controller.set('members', this.get('_members'));
controller.set("model", model);
model.findMembers();
Copy link
Owner Author

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,
Copy link
Owner Author

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|
Copy link
Owner Author

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).

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.

3 participants