From c80a31ebe04bb41a7a7d6dd975a7fac2b8ed3339 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Wed, 29 Jun 2016 21:12:15 +0530 Subject: [PATCH] $.getJSON already returns a promise like object ... so no need to create a deferred object separately and then resolve it manually. This is since jquery 1.5 See: https://api.jquery.com/jquery.getjson/ --- js/documents.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/js/documents.js b/js/documents.js index 0be3c767..66dc6722 100644 --- a/js/documents.js +++ b/js/documents.js @@ -80,7 +80,6 @@ $.widget('oc.documentGrid', { _load : function (fileId){ var that = this; - var def = new $.Deferred(); var url = 'apps/richdocuments/ajax/documents/list'; var dataObj = {}; if (fileId){ @@ -88,7 +87,7 @@ $.widget('oc.documentGrid', { dataObj = { fileId: fileId }; } - $.getJSON(OC.generateUrl(url, dataObj)) + return $.getJSON(OC.generateUrl(url, dataObj)) .done(function (result) { if (!result || result.status === 'error') { documentsMain.loadError = true; @@ -108,12 +107,10 @@ $.widget('oc.documentGrid', { that.options.sessions = result.sessions; that.options.members = result.members; } - def.resolve(); }) .fail(function(data){ console.log(t('richdocuments','Failed to load documents.')); }); - return def; }, _render : function (data){