Skip to content
Permalink
Browse files

FIX: use 'about.json' endpoint instead of using ember model to get th…

…e data.
  • Loading branch information...
vinothkannans committed Nov 8, 2019
1 parent d4c9ed6 commit edec92280389681058b0c97929d9d136df3d0dea
Showing with 14 additions and 16 deletions.
  1. +14 −16 app/assets/javascripts/admin/mixins/setting-component.js.es6
@@ -4,8 +4,8 @@ import { categoryLinkHTML } from "discourse/helpers/category-link";
import { on } from "@ember/object/evented";
import Mixin from "@ember/object/mixin";
import showModal from "discourse/lib/show-modal";
import AboutRoute from "discourse/routes/about";
import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax";

const CUSTOM_TYPES = [
"bool",
@@ -151,22 +151,20 @@ export default Mixin.create({
const key = this.buffered.get("setting");

if (defaultUserPreferences.includes(key)) {
AboutRoute.create()
.model()
.then(result => {
const controller = showModal("site-setting-default-categories", {
model: {
count: result.stats.user_count,
key: key.replace(/_/g, " ")
},
admin: true
});

controller.set("onClose", () => {
this.updateExistingUsers = controller.updateExistingUsers;
this.send("save");
});
ajax("/about.json").then(result => {
const controller = showModal("site-setting-default-categories", {
model: {
count: result.about.stats.user_count,
key: key.replace(/_/g, " ")
},
admin: true
});

controller.set("onClose", () => {
this.updateExistingUsers = controller.updateExistingUsers;
this.send("save");
});
});
} else {
this.send("save");
}

3 comments on commit edec922

@discoursereviewbot

This comment has been minimized.

Copy link

discoursereviewbot replied Nov 8, 2019

Régis Hanol posted:

Why do we need to use the about.json endpoint?

@discoursebot

This comment has been minimized.

Copy link

discoursebot replied Nov 8, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/can-not-save-default-watched-category-tags/132472/23

@discoursereviewbot

This comment has been minimized.

Copy link

discoursereviewbot replied Nov 11, 2019

Vinoth Kannan posted:

[quote="ZogStriP, post:2, topic:6832, full:true"]
Why do we need to use the about.json endpoint?
[/quote]

To get the total number of users. Anyway, I'm going to change the behavior here. Instead of displaying the total number of users on the site I will display the total number of users going to be affected by the site setting change.

Please sign in to comment.
You can’t perform that action at this time.