From 8ef3fa38d6b249e8b5eb3ff65aaae0ecfd68a9c3 Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Sat, 6 Mar 2021 20:16:49 +0300 Subject: [PATCH] Revert "Revert "DEV: Migrate from {{user-selector}} to {{email-group-user-chooser}} (#94)" (#102)" (#103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to https://github.com/discourse/discourse-data-explorer/pull/102. This is essentially a revert of that PR, the only difference is that the `.discourse-compatibility` file now pins the plugin to https://github.com/discourse/discourse-data-explorer/commit/60ffd4bc4d357b365cdb8a6764cec621f2edcf81 for sites ≤ `2.7.0.beta3`. --- .discourse-compatibility | 1 + assets/javascripts/discourse/models/query.js.es6 | 4 ++++ .../templates/admin/components/q-params/user_id.hbs | 8 +++++++- .../templates/admin/components/q-params/user_list.hbs | 5 ++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.discourse-compatibility b/.discourse-compatibility index 27b3b44..2466bfc 100644 --- a/.discourse-compatibility +++ b/.discourse-compatibility @@ -1 +1,2 @@ +2.7.0.beta3: 60ffd4bc4d357b365cdb8a6764cec621f2edcf81 2.6.0.beta2: 16873e708a3c924549e77f3fea011069358d1511 diff --git a/assets/javascripts/discourse/models/query.js.es6 b/assets/javascripts/discourse/models/query.js.es6 index 000345f..781a83e 100644 --- a/assets/javascripts/discourse/models/query.js.es6 +++ b/assets/javascripts/discourse/models/query.js.es6 @@ -47,6 +47,10 @@ const Query = RestModel.extend({ newParams[name] = pinfo["default"]; } else if (pinfo["type"] === "boolean") { newParams[name] = "false"; + } else if (pinfo["type"] === "user_id") { + newParams[name] = null; + } else if (pinfo["type"] === "user_list") { + newParams[name] = null; } else { newParams[name] = ""; } diff --git a/assets/javascripts/discourse/templates/admin/components/q-params/user_id.hbs b/assets/javascripts/discourse/templates/admin/components/q-params/user_id.hbs index d6bcde8..66bf83a 100644 --- a/assets/javascripts/discourse/templates/admin/components/q-params/user_id.hbs +++ b/assets/javascripts/discourse/templates/admin/components/q-params/user_id.hbs @@ -1,2 +1,8 @@ -{{user-selector usernames=value single="true"}} +{{email-group-user-chooser + value=value + options=(hash + maximum=1 + ) + onChange=(action (mut value)) +}} {{info.identifier}} diff --git a/assets/javascripts/discourse/templates/admin/components/q-params/user_list.hbs b/assets/javascripts/discourse/templates/admin/components/q-params/user_list.hbs index b12da94..3697b60 100644 --- a/assets/javascripts/discourse/templates/admin/components/q-params/user_list.hbs +++ b/assets/javascripts/discourse/templates/admin/components/q-params/user_list.hbs @@ -1,2 +1,5 @@ -{{user-selector usernames=value}} +{{email-group-user-chooser + value=value + onChange=(action (mut value)) +}} {{info.identifier}}