From 97b5fe0b1e7ece1c402f9226f13a6e9d711055cf Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 11 Aug 2015 22:36:28 +0200 Subject: switch to async item loading, take care stuff is updated subsequently --- core/js/shareitemmodel.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'core/js/shareitemmodel.js') diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index 74e696e7200..fe7aed46509 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -65,6 +65,14 @@ return _.isObject(this.get('reshare')) && !_.isUndefined(this.get('reshare').uid_owner); }, + /** + * whether this item has reshare information + * @returns {boolean} + */ + hasShares: function() { + return _.isObject(this.get('shares')); + }, + /** * @returns {string} */ @@ -94,16 +102,16 @@ }, fetch: function() { - /** var {OC.Share.Types.ShareItemInfo} **/ - var data = OC.Share.loadItem(this.get('itemType'), this.get('itemSource')); - var attributes = this.parse(data); - this.set(attributes); - console.warn(this.attributes); + var model = this; + OC.Share.loadItem(this.get('itemType'), this.get('itemSource'), function(data) { + model.set(model.parse(data)); + }); }, parse: function(data) { if(data === false) { console.warn('no data was returned'); + trigger('fetchError'); return {}; } var attributes = { -- cgit v1.2.3