From 48f0e2b982700d56590b6b70e108c2b7bc1e58f1 Mon Sep 17 00:00:00 2001 From: Justin DiRose Date: Thu, 14 Nov 2019 12:39:55 -0600 Subject: [PATCH] FIX: Return all groups instead of truncated list (#42) --- .../discourse/controllers/admin-plugins-explorer.js.es6 | 2 +- .../discourse/routes/admin-plugins-explorer.js.es6 | 2 +- plugin.rb | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 index 5ae67fa..dc36064 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 @@ -70,7 +70,7 @@ export default Ember.Controller.extend({ @computed("groups") groupOptions(groups) { - return groups.arrangedContent.map(g => { + return groups.map(g => { return { id: g.id.toString(), name: g.name }; }); }, diff --git a/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 index 5141ee0..fc8abd6 100644 --- a/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 @@ -4,7 +4,7 @@ export default Discourse.Route.extend({ controllerName: "admin-plugins-explorer", model() { - const groupPromise = this.store.findAll("group"); + const groupPromise = ajax("/admin/plugins/explorer/groups.json"); const schemaPromise = ajax("/admin/plugins/explorer/schema.json", { cache: true }); diff --git a/plugin.rb b/plugin.rb index 64a1fbc..f9e916e 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1032,6 +1032,10 @@ SQL render_serialized query, DataExplorer::QuerySerializer, root: 'query' end + def groups + render_serialized(Group.all, BasicGroupSerializer) + end + def group_reports_index return raise Discourse::NotFound unless guardian.user_is_a_member_of_group?(group) @@ -1239,6 +1243,7 @@ SQL root to: "query#index" get 'schema' => "query#schema" get 'queries' => "query#index" + get 'groups' => "query#groups" post 'queries' => "query#create" get 'queries/:id' => "query#show" put 'queries/:id' => "query#update"