commit efdc6f12301c352cceb34ccc452933ce35c921c5
parent 84d8c17d6e8b246f6064c32612580aae6041a491
Author: Aurimas Vinckevicius <aurimas.dev@gmail.com>
Date: Fri, 14 Nov 2014 04:44:23 -0600
Add loadAllData to Zotero.dataObject
Useful when trying to duplicate items, which requires access to all data
Diffstat:
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js
@@ -447,6 +447,14 @@ Zotero.DataObject.prototype._loadDataType = function (dataType, reload) {
return this["load" + dataType[0].toUpperCase() + dataType.substr(1)](reload);
}
+Zotero.DataObject.prototype.loadAllData = function (reload) {
+ let loadPromises = new Array(this._dataTypes.length);
+ for (let i=0; i<this._dataTypes.length; i++) {
+ loadPromises[i] = this._loadDataType(this._dataTypes[i], reload);
+ }
+
+ return Zotero.Promise.all(loadPromises);
+}
/**
* Save old version of data that's being changed, to pass to the notifier
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
@@ -101,7 +101,7 @@ Zotero.Item.prototype._dataTypes = Zotero.Item._super.prototype._dataTypes.conca
'note',
'creators',
'childItems',
- 'relatedItems', // TODO: remove
+// 'relatedItems', // TODO: remove
'tags',
'collections',
'relations'