DEV: Avoid unnecessary `site-settings:main` lookups (#15006)

This commit is contained in:
Jarek Radosz 2021-11-18 17:11:59 +01:00 committed by GitHub
parent 8dc9e0f4bd
commit a102673522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 14 deletions

View File

@ -1,8 +1,4 @@
import AdminUser from "admin/models/admin-user";
// A service that can act as a bridge between the front end Discourse application
// and the admin application. Use this if you need front end code to access admin
// modules. Inject it optionally, and if it exists go to town!
import I18n from "I18n";
import { Promise } from "rsvp";
import Service from "@ember/service";
@ -12,14 +8,10 @@ import { getOwner } from "discourse-common/lib/get-owner";
import { iconHTML } from "discourse-common/lib/icon-library";
import showModal from "discourse/lib/show-modal";
// A service that can act as a bridge between the front end Discourse application
// and the admin application. Use this if you need front end code to access admin
// modules. Inject it optionally, and if it exists go to town!
export default Service.extend({
init() {
this._super(...arguments);
// TODO: Make `siteSettings` a service that can be injected
this.siteSettings = getOwner(this).lookup("site-settings:main");
},
showActionLogs(target, filters) {
const controller = getOwner(target).lookup(
"controller:adminLogs.staffActionLogs"

View File

@ -744,9 +744,7 @@ export default {
},
categoriesTopicsList() {
const setting = this.container.lookup("site-settings:main")
.desktop_category_page_style;
switch (setting) {
switch (this.siteSettings.desktop_category_page_style) {
case "categories_with_featured_topics":
return $(".latest .featured-topic");
case "categories_and_latest_topics":