diff --git a/core/src/plugins/access.inbox/class.inboxAccessDriver.php b/core/src/plugins/access.inbox/class.inboxAccessDriver.php index 78284e194a..35ef770ce4 100644 --- a/core/src/plugins/access.inbox/class.inboxAccessDriver.php +++ b/core/src/plugins/access.inbox/class.inboxAccessDriver.php @@ -66,7 +66,11 @@ public function switchAction($action, $httpVars, $fileVars) { $repositoryId = $n->getRepositoryId(); $n->getRepository()->driverInstance = null; - ConfService::loadDriverForRepository($n->getRepository()); + try { + ConfService::loadDriverForRepository($n->getRepository()); + } catch (\Exception $e) { + continue; + } $repository = $n->getRepository(); @@ -210,7 +214,10 @@ public static function getNodes(){ if ($repo->hasContentFilter()) { $cFilter = $repo->getContentFilter(); $filter = ($cFilter instanceof ContentFilter) ? array_keys($cFilter->filters)[0] : $cFilter; - $label = basename($filter); + + if (!is_array($filter)) { + $label = basename($filter); + } } if (empty($label)) { diff --git a/core/src/plugins/access.inbox/res/build/ShareNotificationUI.js b/core/src/plugins/access.inbox/res/build/ShareNotificationUI.js deleted file mode 100644 index 47628e33e0..0000000000 --- a/core/src/plugins/access.inbox/res/build/ShareNotificationUI.js +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright 2007-2016 Charles du Jeu - Abstrium SAS - * This file is part of Pydio. - * - * Pydio is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Pydio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Pydio. If not, see . - * - * The latest code can be found at . - */ -"use strict"; - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -(function (global) { - - var STATUS_PENDING = 1; - var STATUS_ACCEPTED = 2; - var STATUS_DECLINED = 4; - var STATUS_LOCAL = 0; - var STATUS_ANSWERED = [STATUS_LOCAL, STATUS_ACCEPTED, STATUS_DECLINED]; - - var CLASS_NAMES = { - "accept": "icon-plus-sign ajxp_icon_span", - "decline": "icon-remove-sign ajxp_icon_span", - "view": "icon-signin ajxp_icon_span" - }; - - // Messages - var ContextConsumerMixin = { - contextTypes: { - messages: React.PropTypes.object, - getMessage: React.PropTypes.func, - isReadonly: React.PropTypes.func - } - }; - - /***************************** - /* Main Panel - /* - /* Entry Point for the UI - /*****************************/ - var MainPanel = React.createClass({ - displayName: "MainPanel", - - propTypes: { - closeAjxpDialog: React.PropTypes.func.isRequired, - pydio: React.PropTypes.instanceOf(Pydio).isRequired, - selection: React.PropTypes.instanceOf(PydioDataModel).isRequired, - readonly: React.PropTypes.bool - }, - - childContextTypes: { - messages: React.PropTypes.object, - getMessage: React.PropTypes.func - }, - - getChildContext: function getChildContext() { - var messages = this.props.pydio.MessageHash; - return { - messages: messages, - getMessage: function getMessage(messageId) { - var namespace = arguments.length <= 1 || arguments[1] === undefined ? 'share_center' : arguments[1]; - - try { - return messages[namespace + (namespace ? "." : "") + messageId] || messageId; - } catch (e) { - return messageId; - } - } - }; - }, - - refreshDialogPosition: function refreshDialogPosition() { - global.pydio.UI.modal.refreshDialogPosition(); - }, - - sharesUpdated: function sharesUpdated() { - if (this.isMounted()) { - this.setState({ - shares: this.state.shares - }, (function () { - this.refreshDialogPosition(); - }).bind(this)); - } - }, - - getInitialState: function getInitialState() { - return { - shares: new ReactModel.ShareNotificationList(this.props.pydio) - }; - }, - - componentDidMount: function componentDidMount() { - ReactDispatcher.ShareNotificationDispatcher.getClient().observe('status_changed', this.sharesUpdated); - }, - - clicked: function clicked() { - this.props.closeAjxpDialog(); - }, - - getMessage: function getMessage(key) { - var namespace = arguments.length <= 1 || arguments[1] === undefined ? 'share_center' : arguments[1]; - - return this.props.pydio.MessageHash[namespace + (namespace ? '.' : '') + key]; - }, - - render: function render() { - var shares = this.state.shares, - pendingShares = shares && shares.getSharesByStatus(STATUS_PENDING) || [], - answeredShares = shares && shares.getSharesByStatus(STATUS_ANSWERED) || []; - - return React.createElement( - "div", - { className: "left-panel" }, - React.createElement( - "div", - { className: "section-title" }, - "Pending shares" - ), - React.createElement(Shares, _extends({}, this.props, { shares: pendingShares })), - React.createElement( - "div", - { className: "section-title" }, - "History" - ), - React.createElement(Shares, _extends({}, this.props, { shares: answeredShares })) - ); - } - }); - - /***************************** - /* Shares Collection - /*****************************/ - var Shares = React.createClass({ - displayName: "Shares", - - propTypes: { - shares: React.PropTypes.instanceOf(ReactModel.ShareNotificationList) - }, - - render: function render() { - var shares = this.props.shares.map((function (u) { - return React.createElement(Share, _extends({}, this.props, { share: u })); - }).bind(this)); - - return React.createElement( - "div", - { style: { padding: '0 16px 10px' } }, - shares - ); - } - }); - - /***************************** - /* Share - /*****************************/ - var Share = React.createClass({ - displayName: "Share", - - propTypes: { - share: React.PropTypes.instanceOf(ReactModel.ShareNotification) - }, - - getInitialState: function getInitialState() { - return { - share: this.props.share - }; - }, - - render: function render() { - var share = this.state.share, - owner = share.getOwner(), - label = share.getLabel(), - crDate = share.getFormattedDate(); - - return React.createElement( - "div", - { style: { marginBottom: '5px' } }, - React.createElement( - "div", - { className: "pull-left", style: { width: '90%' } }, - React.createElement( - "div", - { className: "workspace-label" }, - label - ), - React.createElement( - "div", - { className: "workspace-link" }, - owner, - " > ", - crDate - ) - ), - React.createElement( - "div", - { className: "pull-left", style: { width: '10%' } }, - React.createElement(Links, _extends({}, this.props, { share: share })) - ), - React.createElement("div", { style: { clear: 'both' } }) - ); - } - }); - - /********************************* - /* Links Collection for a Share - /*********************************/ - var Links = React.createClass({ - displayName: "Links", - - propTypes: { - share: React.PropTypes.instanceOf(ReactModel.ShareNotification) - }, - - render: function render() { - var share = this.props.share, - actions = share && share.getActions().map((function (action) { - return React.createElement(Link, _extends({}, this.props, { share: share, action: action })); - }).bind(this)); - - return React.createElement( - "div", - null, - actions - ); - } - }); - - /********************************* - /* Link for a Share - /*********************************/ - var Link = React.createClass({ - displayName: "Link", - - propTypes: { - share: React.PropTypes.instanceOf(ReactModel.ShareNotification), - action: React.PropTypes.object - }, - - triggerModelClick: function triggerModelClick() { - var options = this.props.action.options, - actionType = options.get_action; - - if (actionType == 'switch_repository') { - this.props.pydio.triggerRepositoryChange(options.repository_id); - } else { - this.props.share.loadAction(options); - } - }, - - render: function render() { - var share = this.props.share, - action = this.props.action, - className = CLASS_NAMES[action.id] || ""; - - return React.createElement("a", { className: className, onClick: this.triggerModelClick, title: action.message }); - } - }); - - var EventNamespace = global.ShareNotificationUI || {}; - EventNamespace.MainPanel = MainPanel; - global.ShareNotificationUI = EventNamespace; -})(window); diff --git a/core/src/plugins/access.inbox/res/build/dispatcher/ShareNotificationDispatcher.js b/core/src/plugins/access.inbox/res/build/dispatcher/ShareNotificationDispatcher.js deleted file mode 100644 index a4946f6e0c..0000000000 --- a/core/src/plugins/access.inbox/res/build/dispatcher/ShareNotificationDispatcher.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -(function (global) { - - /********************************************* - /* ShareNotification Object - /* - /* Handling the display and actions for the - /* notification coming with a local or remote - /* share - /*********************************************/ - - var ShareNotificationDispatcher = (function (_Observable) { - _inherits(ShareNotificationDispatcher, _Observable); - - // Init - - function ShareNotificationDispatcher(options) { - _classCallCheck(this, ShareNotificationDispatcher); - - _get(Object.getPrototypeOf(ShareNotificationDispatcher.prototype), 'constructor', this).call(this); - this.setStatus('idle'); - } - - // Globals - - _createClass(ShareNotificationDispatcher, [{ - key: 'getStatus', - value: function getStatus() { - return this._status; - } - - // GENERIC: STATUS / LOAD / SAVE - }, { - key: 'setStatus', - value: function setStatus(status) { - this._status = status; - - this.notify('status_changed', { - status: status - }); - } - }], [{ - key: 'getClient', - value: function getClient() { - if (ShareNotificationDispatcher._client) return ShareNotificationDispatcher._client; - var client = new ShareNotificationDispatcher(); - ShareNotificationDispatcher._client = client; - return client; - } - }]); - - return ShareNotificationDispatcher; - })(Observable); - - var ReactDispatcher = global.ReactDispatcher || {}; - ReactDispatcher['ShareNotificationDispatcher'] = ShareNotificationDispatcher; - global.ReactDispatcher = ReactDispatcher; - global.ReactShareNotificationDispatcher = ShareNotificationDispatcher; // Set for dependencies management -})(window); diff --git a/core/src/plugins/access.inbox/res/build/model/ShareNotification.js b/core/src/plugins/access.inbox/res/build/model/ShareNotification.js deleted file mode 100644 index c5b06e991c..0000000000 --- a/core/src/plugins/access.inbox/res/build/model/ShareNotification.js +++ /dev/null @@ -1,142 +0,0 @@ -'use strict'; - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x4, _x5, _x6) { var _again = true; _function: while (_again) { var object = _x4, property = _x5, receiver = _x6; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x4 = parent; _x5 = property; _x6 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -(function (global) { - - /********************************************* - /* ShareNotification Object - /* - /* Handling the display and actions for the - /* notification coming with a local or remote - /* share - /*********************************************/ - - var ShareNotification = (function (_Observable) { - _inherits(ShareNotification, _Observable); - - // Init - - function ShareNotification(share, options) { - _classCallCheck(this, ShareNotification); - - _get(Object.getPrototypeOf(ShareNotification.prototype), 'constructor', this).call(this); - this._data = {}; - - this.setShareStatus(share.status); - this.setOwner(share.owner); - this.setLabel(share.label); - this.setCreationDate(share.cr_date); - this.setActions(share.actions); - - this.options = options || {}; - } - - // Globals - - // Getters / Setters - - _createClass(ShareNotification, [{ - key: 'setShareStatus', - value: function setShareStatus(status) { - this._data['status'] = status; - } - }, { - key: 'setOwner', - value: function setOwner(owner) { - this._data['owner'] = owner; - } - }, { - key: 'setLabel', - value: function setLabel(label) { - this._data['label'] = label; - } - }, { - key: 'setCreationDate', - value: function setCreationDate(crDate) { - this._data['cr_date'] = crDate; - } - }, { - key: 'setActions', - value: function setActions(actions) { - this._data['actions'] = actions; - } - }, { - key: 'getShareStatus', - value: function getShareStatus() { - return this._data['status']; - } - }, { - key: 'getOwner', - value: function getOwner() { - return this._data['owner']; - } - }, { - key: 'getLabel', - value: function getLabel() { - return this._data['label']; - } - }, { - key: 'getCreationDate', - value: function getCreationDate() { - return this._data['cr_date']; - } - }, { - key: 'getActions', - value: function getActions() { - return this._data['actions']; - } - }, { - key: 'getFormattedDate', - value: function getFormattedDate() { - var crDate = new Date(); - - crDate.setTime(this.getCreationDate() * 1000); - - return formatDate(crDate); - } - - // Actions - }, { - key: 'loadAction', - value: function loadAction(options) { - - var statusOnSuccess = options.statusOnSuccess; - - delete options['statusOnSuccess']; - - ShareNotification.loadAction(options, (function (transport) { - if (statusOnSuccess) { - // Transition the status of the share - this.setShareStatus(statusOnSuccess); - ReactDispatcher.ShareNotificationDispatcher.getClient().setStatus('idle'); - } - }).bind(this)); - } - - // Static (eq Client) - }], [{ - key: 'loadAction', - value: function loadAction(options) { - var completeCallback = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - var errorCallback = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - var settings = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; - - PydioApi.getClient().request(options, completeCallback, errorCallback, settings); - } - }]); - - return ShareNotification; - })(Observable); - - var ReactModel = global.ReactModel || {}; - ReactModel['ShareNotification'] = ShareNotification; - global.ReactModel = ReactModel; - global.ReactModelShareNotification = ShareNotification; // Set for dependencies management -})(window); diff --git a/core/src/plugins/access.inbox/res/build/model/ShareNotificationList.js b/core/src/plugins/access.inbox/res/build/model/ShareNotificationList.js deleted file mode 100644 index 43862e95d0..0000000000 --- a/core/src/plugins/access.inbox/res/build/model/ShareNotificationList.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -var _get = function get(_x4, _x5, _x6) { var _again = true; _function: while (_again) { var object = _x4, property = _x5, receiver = _x6; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x4 = parent; _x5 = property; _x6 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -(function (global) { - - /************************************************** - /* ShareNotificationList Object - /* - /* Handling the display of Notification Collection - /**************************************************/ - - var ShareNotificationList = (function (_Observable) { - _inherits(ShareNotificationList, _Observable); - - // Init - - function ShareNotificationList(pydio, options) { - _classCallCheck(this, ShareNotificationList); - - _get(Object.getPrototypeOf(ShareNotificationList.prototype), "constructor", this).call(this); - this._data = { shares: [] }; - this._pydio = pydio; - this.options = options || {}; - - this.load(); - this._pydio.observe("registry_part_loaded", (function () { - this.load(); - }).bind(this)); - } - - // Globals - - // Getters / Setters - - _createClass(ShareNotificationList, [{ - key: "getShares", - value: function getShares() { - if (!this._data["shares"]) return []; - return this._data["shares"]; - } - }, { - key: "getSharesByStatus", - value: function getSharesByStatus(status) { - var currentShares = this.getShares(), - shares = [], - share; - - for (var i in currentShares) { - share = currentShares[i]; - if (typeof share.getShareStatus === 'function' && (typeof status == 'number' && share.getShareStatus() == status || typeof status == 'object' && status.indexOf(share.getShareStatus()) > -1)) { - shares.push(currentShares[i]); - } - } - - return shares; - } - - // Actions - }, { - key: "load", - value: function load() { - if (ReactDispatcher.ShareNotificationDispatcher.getClient().getStatus() == 'loading') return; - ReactDispatcher.ShareNotificationDispatcher.getClient().setStatus('loading'); - - ShareNotificationList.loadShares(this.options, (function (transport) { - if (transport.responseJSON && transport.responseJSON.shares) { - this._data.shares = []; - - var shares = transport.responseJSON.shares; - - for (var i = 0; i < shares.length; i++) { - var share = new ReactModel.ShareNotification(shares[i]); - this._data.shares.push(share); - } - - ReactDispatcher.ShareNotificationDispatcher.getClient().setStatus('idle'); - } - }).bind(this)); - } - - // Static (eq Client) - }], [{ - key: "loadShares", - value: function loadShares(defaultOptions) { - var completeCallback = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - var errorCallback = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - var settings = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3]; - - var options = Object.assign(defaultOptions, { - get_action: 'load_shares' - }); - - PydioApi.getClient().request(options, completeCallback, errorCallback, settings); - } - }]); - - return ShareNotificationList; - })(Observable); - - var ReactModel = global.ReactModel || {}; - ReactModel['ShareNotificationList'] = ShareNotificationList; - global.ReactModel = ReactModel; - global.ReactModelShareNotificationList = ShareNotificationList; // Set for dependencies management -})(window); diff --git a/core/src/plugins/access.inbox/res/react/ShareNotificationUI.js b/core/src/plugins/access.inbox/res/react/ShareNotificationUI.js index 64d0ba1cb3..06fd0b1f61 100644 --- a/core/src/plugins/access.inbox/res/react/ShareNotificationUI.js +++ b/core/src/plugins/access.inbox/res/react/ShareNotificationUI.js @@ -97,6 +97,10 @@ ReactDispatcher.ShareNotificationDispatcher.getClient().observe('status_changed', this.sharesUpdated); }, + componentWillUnmount: function() { + ReactDispatcher.ShareNotificationDispatcher.getClient().stopObserving('status_changed', this.sharesUpdated); + }, + clicked: function() { this.props.closeAjxpDialog(); }, @@ -152,14 +156,8 @@ share: React.PropTypes.instanceOf(ReactModel.ShareNotification) }, - getInitialState: function(){ - return { - share: this.props.share - }; - }, - render: function() { - var share = this.state.share, + var share = this.props.share, owner = share.getOwner(), label = share.getLabel(), crDate = share.getFormattedDate(); diff --git a/core/src/plugins/access.inbox/res/react/dispatcher/ShareNotificationDispatcher.js b/core/src/plugins/access.inbox/res/react/dispatcher/ShareNotificationDispatcher.js index 40978bfc60..46b4dc454b 100644 --- a/core/src/plugins/access.inbox/res/react/dispatcher/ShareNotificationDispatcher.js +++ b/core/src/plugins/access.inbox/res/react/dispatcher/ShareNotificationDispatcher.js @@ -8,18 +8,40 @@ /* share /*********************************************/ class ShareNotificationDispatcher extends Observable { - // Init constructor(options){ super(); + + this._active = true; + + this.setStatus('idle'); + } + + start() { + if (this._active) { + console.warn('Dispatcher already active'); + } + + this._active = true; this.setStatus('idle'); } + stop() { + this._active = false; + } + + isActive() { + return this._active; + } + getStatus() { return this._status; } + // GENERIC: STATUS / LOAD / SAVE setStatus(status) { + if (!this.isActive()) return; + this._status = status; this.notify('status_changed', { @@ -27,7 +49,21 @@ }); } - static getClient(){ + observe(eventName, observer) { + super.observe(eventName, observer); + + this.start(); + } + + stopObserving(eventName, observer) { + super.stopObserving(eventName, observer); + + if (! this.hasObservers()) { + this.stop(); + } + } + + static getClient() { if(ShareNotificationDispatcher._client) return ShareNotificationDispatcher._client; var client = new ShareNotificationDispatcher(); ShareNotificationDispatcher._client = client; diff --git a/core/src/plugins/access.inbox/res/react/model/ShareNotification.js b/core/src/plugins/access.inbox/res/react/model/ShareNotification.js index 8465ab0ac7..4a3f2812f9 100644 --- a/core/src/plugins/access.inbox/res/react/model/ShareNotification.js +++ b/core/src/plugins/access.inbox/res/react/model/ShareNotification.js @@ -74,7 +74,6 @@ // Actions loadAction(options) { - var statusOnSuccess = options.statusOnSuccess; delete options['statusOnSuccess']; diff --git a/core/src/plugins/access.inbox/res/react/model/ShareNotificationList.js b/core/src/plugins/access.inbox/res/react/model/ShareNotificationList.js index adeaf69070..f3ea8fa37f 100644 --- a/core/src/plugins/access.inbox/res/react/model/ShareNotificationList.js +++ b/core/src/plugins/access.inbox/res/react/model/ShareNotificationList.js @@ -14,8 +14,11 @@ this._pydio = pydio; this.options = options || {}; - this.load(); - this._pydio.observe("registry_part_loaded", function() {this.load()}.bind(this)); + //this.load(); + + this._pydio.observe("repository_list_refreshed", function() { + this.load(); + }.bind(this)); } // Getters / Setters @@ -43,26 +46,25 @@ } // Actions - load(){ - if(ReactDispatcher.ShareNotificationDispatcher.getClient().getStatus() == 'loading') return; - ReactDispatcher.ShareNotificationDispatcher.getClient().setStatus('loading'); + load() { + var dispatcher = ReactDispatcher.ShareNotificationDispatcher.getClient(); + if(!dispatcher.isActive()) return; ShareNotificationList.loadShares( this.options, function(transport) { - if(transport.responseJSON && transport.responseJSON.shares){ + if (transport.responseJSON){ this._data.shares = []; var shares = transport.responseJSON.shares; - for (var i = 0; i < shares.length; i++) { var share = new ReactModel.ShareNotification(shares[i]); this._data.shares.push(share); } - - ReactDispatcher.ShareNotificationDispatcher.getClient().setStatus('idle'); } + + dispatcher.setStatus('loaded'); }.bind(this)); } diff --git a/core/src/plugins/gui.ajax/res/js/es6/lang/Observable.es6 b/core/src/plugins/gui.ajax/res/js/es6/lang/Observable.es6 index fde4200317..6865b4c8c8 100644 --- a/core/src/plugins/gui.ajax/res/js/es6/lang/Observable.es6 +++ b/core/src/plugins/gui.ajax/res/js/es6/lang/Observable.es6 @@ -52,4 +52,8 @@ class Observable { return collected_return_values; } -} \ No newline at end of file + hasObservers() { + return this._observers.length; + } + +}