Merge pull request #3656 from tgxworld/ember-computed-property

FIX: Wrong value set when using ember-computed-decorators.
This commit is contained in:
Régis Hanol 2015-08-14 18:23:10 +02:00
commit 5a09482b0f
3 changed files with 10 additions and 22 deletions

View File

@ -28,12 +28,11 @@ export default Ember.Component.extend(BufferedContent, ScrollTop, {
@computed('buffered.value')
enabled: {
get() {
const bufferedValue = this.get('buffered.value');
get(bufferedValue) {
if (Ember.isEmpty(bufferedValue)) { return false; }
return bufferedValue === 'true';
},
set(key, value) {
set(value) {
this.set('buffered.value', value ? 'true' : 'false');
}
},

View File

@ -11,10 +11,8 @@ export default Ember.Component.extend({
@computed
notificationsDisabled: {
set(key, value) {
if (arguments.length > 1) {
localStorage.setItem('notifications-disabled', value);
}
set(value) {
localStorage.setItem('notifications-disabled', value);
return localStorage.getItem('notifications-disabled');
},
get() {

View File

@ -68,13 +68,10 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
@computed('model.postStream.summary')
show_deleted: {
set(key, value) {
set(value) {
const postStream = this.get('model.postStream');
if (!postStream) { return; }
if (arguments.length > 1) {
postStream.set('show_deleted', value);
}
postStream.set('show_deleted', value);
return postStream.get('show_deleted') ? true : undefined;
},
get() {
@ -84,13 +81,10 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
@computed('model.postStream.summary')
filter: {
set(key, value) {
set(value) {
const postStream = this.get('model.postStream');
if (!postStream) { return; }
if (arguments.length > 1) {
postStream.set('summary', value === "summary");
}
postStream.set('summary', value === "summary");
return postStream.get('summary') ? "summary" : undefined;
},
get() {
@ -100,13 +94,10 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
@computed('model.postStream.streamFilters.username_filters')
username_filters: {
set(key, value) {
set(value) {
const postStream = this.get('model.postStream');
if (!postStream) { return; }
if (arguments.length > 1) {
postStream.set('streamFilters.username_filters', value);
}
postStream.set('streamFilters.username_filters', value);
return postStream.get('streamFilters.username_filters');
},
get() {