mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Move TopicTrackingState to injected object
This commit is contained in:
@@ -1,16 +1,29 @@
|
||||
import Store from "discourse/models/store";
|
||||
import RestAdapter from 'discourse/adapters/rest';
|
||||
import KeyValueStore from 'discourse/lib/key-value-store';
|
||||
import TopicTrackingState from 'discourse/models/topic-tracking-state';
|
||||
import Resolver from 'discourse/ember/resolver';
|
||||
|
||||
let _restAdapter;
|
||||
export default function() {
|
||||
const resolver = Resolver.create();
|
||||
return Store.create({
|
||||
container: {
|
||||
lookup(type) {
|
||||
if (type === "adapter:rest") {
|
||||
_restAdapter = _restAdapter || RestAdapter.create({ container: this });
|
||||
return (_restAdapter);
|
||||
this._restAdapter = this._restAdapter || RestAdapter.create({ container: this });
|
||||
return (this._restAdapter);
|
||||
}
|
||||
if (type === "key-value-store:main") {
|
||||
this._kvs = this._kvs || new KeyValueStore();
|
||||
return (this._kvs);
|
||||
}
|
||||
if (type === "topic-tracking-state:main") {
|
||||
this._tracker = this._tracker || TopicTrackingState.current();
|
||||
return (this._tracker);
|
||||
}
|
||||
if (type === "site-settings:main") {
|
||||
this._settings = this._settings || Discourse.SiteSettings.current();
|
||||
return (this._settings);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user