mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 22:54:39 +08:00
87725206cd
When adding a new group, if Delete was clicked before saving the group, the modal would come up, but the Yes confirmation would do nothing. This fixes that by taking an approach similar to the Badges and checks to see if the Group is new, and if it is, just returns to the index instead of invoking the confirm modal. This also fixes the redirect after saving a new Group.
28 lines
606 B
JavaScript
28 lines
606 B
JavaScript
import Group from 'discourse/models/group';
|
|
|
|
export default Discourse.Route.extend({
|
|
|
|
model: function(params) {
|
|
var groups = this.modelFor('adminGroupsType');
|
|
if (params.name === 'new') {
|
|
return Group.create({
|
|
automatic: false,
|
|
visible: true
|
|
});
|
|
}
|
|
|
|
var group = groups.findProperty('name', params.name);
|
|
|
|
if (!group) { return this.transitionTo('adminGroups.index'); }
|
|
|
|
return group;
|
|
},
|
|
|
|
setupController: function(controller, model) {
|
|
controller.set("model", model);
|
|
controller.set("model.usernames", null);
|
|
model.findMembers();
|
|
}
|
|
|
|
});
|