Hack to allow posts to have access to `siteSettings`

This commit is contained in:
Robin Ward 2015-08-20 11:06:23 -04:00
parent c002845b1a
commit 11d1619e2c
2 changed files with 9 additions and 4 deletions

View File

@ -11,6 +11,12 @@ const Post = RestModel.extend({
this.set('replyHistory', []);
},
@computed()
siteSettings() {
// TODO: Remove this once one instantiate all `Discourse.Post` models via the store.
return Discourse.SiteSettings;
},
shareUrl: function() {
const user = Discourse.User.current();
const userSuffix = user ? '?u=' + user.get('username_lower') : '';

View File

@ -1,6 +1,4 @@
/*eslint no-bitwise:0 */
import CloakedView from 'discourse/views/cloaked';
const CloakedCollectionView = Ember.CollectionView.extend({
cloakView: Ember.computed.alias('itemViewClass'),
topVisible: null,
@ -10,7 +8,7 @@ const CloakedCollectionView = Ember.CollectionView.extend({
loadingHTML: 'Loading...',
scrollDebounce: 10,
init: function() {
init() {
const cloakView = this.get('cloakView'),
idProperty = this.get('idProperty'),
uncloakDefault = !!this.get('uncloakDefault');
@ -19,6 +17,7 @@ const CloakedCollectionView = Ember.CollectionView.extend({
const slackRatio = parseFloat(this.get('slackRatio'));
if (!slackRatio) { this.set('slackRatio', 1.0); }
const CloakedView = this.container.lookupFactory('view:cloaked');
this.set('itemViewClass', CloakedView.extend({
classNames: [cloakView + '-cloak'],
cloaks: cloakView,
@ -26,7 +25,7 @@ const CloakedCollectionView = Ember.CollectionView.extend({
cloaksController: this.get('itemController'),
defaultHeight: this.get('defaultHeight'),
init: function() {
init() {
this._super();
if (idProperty) {