{"version":3,"file":"files_sharing.js","sources":["webpack:///webpack/bootstrap","webpack:///./apps/files_sharing/js/app.js","webpack:///./apps/files_sharing/js/sharedfilelist.js","webpack:///./apps/files_sharing/src/files_sharing.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/js/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./apps/files_sharing/src/files_sharing.js\");\n","/*\n * Copyright (c) 2014 Vincent Petry \n *\n * This file is licensed under the Affero General Public License version 3\n * or later.\n *\n * See the COPYING-README file.\n *\n */\nif (!OCA.Sharing) {\n /**\n * @namespace OCA.Sharing\n */\n OCA.Sharing = {};\n}\n/**\n * @namespace\n */\n\n\nOCA.Sharing.App = {\n _inFileList: null,\n _outFileList: null,\n _overviewFileList: null,\n _pendingFileList: null,\n initSharingIn: function initSharingIn($el) {\n if (this._inFileList) {\n return this._inFileList;\n }\n\n this._inFileList = new OCA.Sharing.FileList($el, {\n id: 'shares.self',\n sharedWithUser: true,\n fileActions: this._createFileActions(),\n config: OCA.Files.App.getFilesConfig(),\n // The file list is created when a \"show\" event is handled, so\n // it should be marked as \"shown\" like it would have been done\n // if handling the event with the file list already created.\n shown: true\n });\n\n this._extendFileList(this._inFileList);\n\n this._inFileList.appName = t('files_sharing', 'Shared with you');\n\n this._inFileList.$el.find('#emptycontent').html('
' + '

' + t('files_sharing', 'Nothing shared with you yet') + '

' + '

' + t('files_sharing', 'Files and folders others share with you will show up here') + '

');\n\n return this._inFileList;\n },\n initSharingOut: function initSharingOut($el) {\n if (this._outFileList) {\n return this._outFileList;\n }\n\n this._outFileList = new OCA.Sharing.FileList($el, {\n id: 'shares.others',\n sharedWithUser: false,\n fileActions: this._createFileActions(),\n config: OCA.Files.App.getFilesConfig(),\n // The file list is created when a \"show\" event is handled, so\n // it should be marked as \"shown\" like it would have been done\n // if handling the event with the file list already created.\n shown: true\n });\n\n this._extendFileList(this._outFileList);\n\n this._outFileList.appName = t('files_sharing', 'Shared with others');\n\n this._outFileList.$el.find('#emptycontent').html('
' + '

' + t('files_sharing', 'Nothing shared yet') + '

' + '

' + t('files_sharing', 'Files and folders you share will show up here') + '

');\n\n return this._outFileList;\n },\n initSharingLinks: function initSharingLinks($el) {\n if (this._linkFileList) {\n return this._linkFileList;\n }\n\n this._linkFileList = new OCA.Sharing.FileList($el, {\n id: 'shares.link',\n linksOnly: true,\n fileActions: this._createFileActions(),\n config: OCA.Files.App.getFilesConfig(),\n // The file list is created when a \"show\" event is handled, so\n // it should be marked as \"shown\" like it would have been done\n // if handling the event with the file list already created.\n shown: true\n });\n\n this._extendFileList(this._linkFileList);\n\n this._linkFileList.appName = t('files_sharing', 'Shared by link');\n\n this._linkFileList.$el.find('#emptycontent').html('
' + '

' + t('files_sharing', 'No shared links') + '

' + '

' + t('files_sharing', 'Files and folders you share by link will show up here') + '

');\n\n return this._linkFileList;\n },\n initSharingDeleted: function initSharingDeleted($el) {\n if (this._deletedFileList) {\n return this._deletedFileList;\n }\n\n this._deletedFileList = new OCA.Sharing.FileList($el, {\n id: 'shares.deleted',\n defaultFileActionsDisabled: true,\n showDeleted: true,\n sharedWithUser: true,\n fileActions: this._restoreShareAction(),\n config: OCA.Files.App.getFilesConfig(),\n // The file list is created when a \"show\" event is handled, so\n // it should be marked as \"shown\" like it would have been done\n // if handling the event with the file list already created.\n shown: true\n });\n\n this._extendFileList(this._deletedFileList);\n\n this._deletedFileList.appName = t('files_sharing', 'Deleted shares');\n\n this._deletedFileList.$el.find('#emptycontent').html('
' + '

' + t('files_sharing', 'No deleted shares') + '

' + '

' + t('files_sharing', 'Shares you deleted will show up here') + '

');\n\n return this._deletedFileList;\n },\n initSharingPening: function initSharingPening($el) {\n if (this._pendingFileList) {\n return this._pendingFileList;\n }\n\n this._pendingFileList = new OCA.Sharing.FileList($el, {\n id: 'shares.pending',\n showPending: true,\n sharedWithUser: true,\n fileActions: this._acceptShareAction(),\n config: OCA.Files.App.getFilesConfig(),\n // The file list is created when a \"show\" event is handled, so\n // it should be marked as \"shown\" like it would have been done\n // if handling the event with the file list already created.\n shown: true\n });\n\n this._extendFileList(this._pendingFileList);\n\n this._pendingFileList.appName = t('files_sharing', 'Pending shares');\n\n this._pendingFileList.$el.find('#emptycontent').html('
' + '

' + t('files_sharing', 'No pending shares') + '

' + '

' + t('files_sharing', 'Shares you have received but not confirmed will show up here') + '

');\n\n return this._pendingFileList;\n },\n initShareingOverview: function initShareingOverview($el) {\n if (this._overviewFileList) {\n return this._overviewFileList;\n }\n\n this._overviewFileList = new OCA.Sharing.FileList($el, {\n id: 'shares.overview',\n config: OCA.Files.App.getFilesConfig(),\n isOverview: true,\n // The file list is created when a \"show\" event is handled, so\n // it should be marked as \"shown\" like it would have been done\n // if handling the event with the file list already created.\n shown: true\n });\n\n this._extendFileList(this._overviewFileList);\n\n this._overviewFileList.appName = t('files_sharing', 'Shares');\n\n this._overviewFileList.$el.find('#emptycontent').html('
' + '

' + t('files_sharing', 'No shares') + '

' + '

' + t('files_sharing', 'Shares will show up here') + '

');\n\n return this._overviewFileList;\n },\n removeSharingIn: function removeSharingIn() {\n if (this._inFileList) {\n this._inFileList.$fileList.empty();\n }\n },\n removeSharingOut: function removeSharingOut() {\n if (this._outFileList) {\n this._outFileList.$fileList.empty();\n }\n },\n removeSharingLinks: function removeSharingLinks() {\n if (this._linkFileList) {\n this._linkFileList.$fileList.empty();\n }\n },\n removeSharingDeleted: function removeSharingDeleted() {\n if (this._deletedFileList) {\n this._deletedFileList.$fileList.empty();\n }\n },\n removeSharingPending: function removeSharingPending() {\n if (this._pendingFileList) {\n this._pendingFileList.$fileList.empty();\n }\n },\n removeSharingOverview: function removeSharingOverview() {\n if (this._overviewFileList) {\n this._overviewFileList.$fileList.empty();\n }\n },\n\n /**\n * Destroy the app\n */\n destroy: function destroy() {\n OCA.Files.fileActions.off('setDefault.app-sharing', this._onActionsUpdated);\n OCA.Files.fileActions.off('registerAction.app-sharing', this._onActionsUpdated);\n this.removeSharingIn();\n this.removeSharingOut();\n this.removeSharingLinks();\n this._inFileList = null;\n this._outFileList = null;\n this._linkFileList = null;\n this._overviewFileList = null;\n delete this._globalActionsInitialized;\n },\n _createFileActions: function _createFileActions() {\n // inherit file actions from the files app\n var fileActions = new OCA.Files.FileActions(); // note: not merging the legacy actions because legacy apps are not\n // compatible with the sharing overview and need to be adapted first\n\n fileActions.registerDefaultActions();\n fileActions.merge(OCA.Files.fileActions);\n\n if (!this._globalActionsInitialized) {\n // in case actions are registered later\n this._onActionsUpdated = _.bind(this._onActionsUpdated, this);\n OCA.Files.fileActions.on('setDefault.app-sharing', this._onActionsUpdated);\n OCA.Files.fileActions.on('registerAction.app-sharing', this._onActionsUpdated);\n this._globalActionsInitialized = true;\n } // when the user clicks on a folder, redirect to the corresponding\n // folder in the files app instead of opening it directly\n\n\n fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {\n OCA.Files.App.setActiveView('files', {\n silent: true\n });\n OCA.Files.App.fileList.changeDirectory(OC.joinPaths(context.$file.attr('data-path'), filename), true, true);\n });\n fileActions.setDefault('dir', 'Open');\n return fileActions;\n },\n _restoreShareAction: function _restoreShareAction() {\n var fileActions = new OCA.Files.FileActions();\n fileActions.registerAction({\n name: 'Restore',\n displayName: t('files_sharing', 'Restore'),\n altText: t('files_sharing', 'Restore share'),\n mime: 'all',\n permissions: OC.PERMISSION_ALL,\n iconClass: 'icon-history',\n type: OCA.Files.FileActions.TYPE_INLINE,\n actionHandler: function actionHandler(fileName, context) {\n var shareId = context.$file.data('shareId');\n $.post(OC.linkToOCS('apps/files_sharing/api/v1/deletedshares', 2) + shareId).success(function (result) {\n context.fileList.remove(context.fileInfoModel.attributes.name);\n }).fail(function () {\n OC.Notification.showTemporary(t('files_sharing', 'Something happened. Unable to restore the share.'));\n });\n }\n });\n return fileActions;\n },\n _acceptShareAction: function _acceptShareAction() {\n var fileActions = new OCA.Files.FileActions();\n fileActions.registerAction({\n name: 'Accept share',\n displayName: t('files_sharing', 'Accept share'),\n mime: 'all',\n permissions: OC.PERMISSION_ALL,\n iconClass: 'icon-checkmark',\n type: OCA.Files.FileActions.TYPE_INLINE,\n actionHandler: function actionHandler(fileName, context) {\n var shareId = context.$file.data('shareId');\n $.post(OC.linkToOCS('apps/files_sharing/api/v1/shares/pending', 2) + shareId).success(function (result) {\n context.fileList.remove(context.fileInfoModel.attributes.name);\n }).fail(function () {\n OC.Notification.showTemporary(t('files_sharing', 'Something happened. Unable to accept the share.'));\n });\n }\n });\n fileActions.registerAction({\n name: 'Reject share',\n displayName: t('files_sharing', 'Reject share'),\n mime: 'all',\n permissions: OC.PERMISSION_ALL,\n iconClass: 'icon-close',\n type: OCA.Files.FileActions.TYPE_INLINE,\n actionHandler: function actionHandler(fileName, context) {\n var shareId = context.$file.data('shareId');\n $.ajax({\n url: OC.linkToOCS('apps/files_sharing/api/v1/shares', 2) + shareId,\n type: 'DELETE'\n }).success(function (result) {\n context.fileList.remove(context.fileInfoModel.attributes.name);\n }).fail(function () {\n OC.Notification.showTemporary(t('files_sharing', 'Something happened. Unable to reject the share.'));\n });\n }\n });\n return fileActions;\n },\n _onActionsUpdated: function _onActionsUpdated(ev) {\n _.each([this._inFileList, this._outFileList, this._linkFileList], function (list) {\n if (!list) {\n return;\n }\n\n if (ev.action) {\n list.fileActions.registerAction(ev.action);\n } else if (ev.defaultAction) {\n list.fileActions.setDefault(ev.defaultAction.mime, ev.defaultAction.name);\n }\n });\n },\n _extendFileList: function _extendFileList(fileList) {\n // remove size column from summary\n fileList.fileSummary.$el.find('.filesize').remove();\n }\n};\n$(document).ready(function () {\n $('#app-content-sharingin').on('show', function (e) {\n OCA.Sharing.App.initSharingIn($(e.target));\n });\n $('#app-content-sharingin').on('hide', function () {\n OCA.Sharing.App.removeSharingIn();\n });\n $('#app-content-sharingout').on('show', function (e) {\n OCA.Sharing.App.initSharingOut($(e.target));\n });\n $('#app-content-sharingout').on('hide', function () {\n OCA.Sharing.App.removeSharingOut();\n });\n $('#app-content-sharinglinks').on('show', function (e) {\n OCA.Sharing.App.initSharingLinks($(e.target));\n });\n $('#app-content-sharinglinks').on('hide', function () {\n OCA.Sharing.App.removeSharingLinks();\n });\n $('#app-content-deletedshares').on('show', function (e) {\n OCA.Sharing.App.initSharingDeleted($(e.target));\n });\n $('#app-content-deletedshares').on('hide', function () {\n OCA.Sharing.App.removeSharingDeleted();\n });\n $('#app-content-pendingshares').on('show', function (e) {\n OCA.Sharing.App.initSharingPening($(e.target));\n });\n $('#app-content-pendingshares').on('hide', function () {\n OCA.Sharing.App.removeSharingPending();\n });\n $('#app-content-shareoverview').on('show', function (e) {\n OCA.Sharing.App.initShareingOverview($(e.target));\n });\n $('#app-content-shareoverview').on('hide', function () {\n OCA.Sharing.App.removeSharingOverview();\n });\n});","/* eslint-disable */\n\n/*\n * Copyright (c) 2014 Vincent Petry \n *\n * This file is licensed under the Affero General Public License version 3\n * or later.\n *\n * See the COPYING-README file.\n *\n */\n(function () {\n /**\n * @class OCA.Sharing.FileList\n * @augments OCA.Files.FileList\n *\n * @classdesc Sharing file list.\n * Contains both \"shared with others\" and \"shared with you\" modes.\n *\n * @param $el container element with existing markup for the #controls\n * and a table\n * @param [options] map of options, see other parameters\n * @param {boolean} [options.sharedWithUser] true to return files shared with\n * the current user, false to return files that the user shared with others.\n * Defaults to false.\n * @param {boolean} [options.linksOnly] true to return only link shares\n */\n var FileList = function FileList($el, options) {\n this.initialize($el, options);\n };\n\n FileList.prototype = _.extend({}, OCA.Files.FileList.prototype,\n /** @lends OCA.Sharing.FileList.prototype */\n {\n appName: 'Shares',\n\n /**\n * Whether the list shows the files shared with the user (true) or\n * the files that the user shared with others (false).\n */\n _sharedWithUser: false,\n _linksOnly: false,\n _showDeleted: false,\n _showPending: false,\n _clientSideSort: true,\n _allowSelection: false,\n _isOverview: false,\n\n /**\n * @private\n */\n initialize: function initialize($el, options) {\n OCA.Files.FileList.prototype.initialize.apply(this, arguments);\n\n if (this.initialized) {\n return;\n } // TODO: consolidate both options\n\n\n if (options && options.sharedWithUser) {\n this._sharedWithUser = true;\n }\n\n if (options && options.linksOnly) {\n this._linksOnly = true;\n }\n\n if (options && options.showDeleted) {\n this._showDeleted = true;\n }\n\n if (options && options.showPending) {\n this._showPending = true;\n }\n\n if (options && options.isOverview) {\n this._isOverview = true;\n }\n },\n _renderRow: function _renderRow() {\n // HACK: needed to call the overridden _renderRow\n // this is because at the time this class is created\n // the overriding hasn't been done yet...\n return OCA.Files.FileList.prototype._renderRow.apply(this, arguments);\n },\n _createRow: function _createRow(fileData) {\n // TODO: hook earlier and render the whole row here\n var $tr = OCA.Files.FileList.prototype._createRow.apply(this, arguments);\n\n $tr.find('.filesize').remove();\n $tr.find('td.date').before($tr.children('td:first'));\n $tr.find('td.filename input:checkbox').remove();\n $tr.attr('data-share-id', _.pluck(fileData.shares, 'id').join(','));\n\n if (this._sharedWithUser) {\n $tr.attr('data-share-owner', fileData.shareOwner);\n $tr.attr('data-mounttype', 'shared-root');\n var permission = parseInt($tr.attr('data-permissions')) | OC.PERMISSION_DELETE;\n $tr.attr('data-permissions', permission);\n }\n\n if (this._showDeleted || this._showPending) {\n var permission = fileData.permissions;\n $tr.attr('data-share-permissions', permission);\n } // add row with expiration date for link only shares - influenced by _createRow of filelist\n\n\n if (this._linksOnly) {\n var expirationTimestamp = 0;\n\n if (fileData.shares && fileData.shares[0].expiration !== null) {\n expirationTimestamp = moment(fileData.shares[0].expiration).valueOf();\n }\n\n $tr.attr('data-expiration', expirationTimestamp); // date column (1000 milliseconds to seconds, 60 seconds, 60 minutes, 24 hours)\n // difference in days multiplied by 5 - brightest shade for expiry dates in more than 32 days (160/5)\n\n var modifiedColor = Math.round((expirationTimestamp - new Date().getTime()) / 1000 / 60 / 60 / 24 * 5); // ensure that the brightest color is still readable\n\n if (modifiedColor >= 160) {\n modifiedColor = 160;\n }\n\n var formatted;\n var text;\n\n if (expirationTimestamp > 0) {\n formatted = OC.Util.formatDate(expirationTimestamp);\n text = OC.Util.relativeModifiedDate(expirationTimestamp);\n } else {\n formatted = t('files_sharing', 'No expiration date set');\n text = '';\n modifiedColor = 160;\n }\n\n td = $('').attr({\n 'class': 'date'\n });\n td.append($('').attr({\n 'class': 'modified',\n 'title': formatted,\n 'style': 'color:rgb(' + modifiedColor + ',' + modifiedColor + ',' + modifiedColor + ')'\n }).text(text).tooltip({\n placement: 'top'\n }));\n $tr.append(td);\n }\n\n return $tr;\n },\n\n /**\n * Set whether the list should contain outgoing shares\n * or incoming shares.\n *\n * @param state true for incoming shares, false otherwise\n */\n setSharedWithUser: function setSharedWithUser(state) {\n this._sharedWithUser = !!state;\n },\n updateEmptyContent: function updateEmptyContent() {\n var dir = this.getCurrentDirectory();\n\n if (dir === '/') {\n // root has special permissions\n this.$el.find('#emptycontent').toggleClass('hidden', !this.isEmpty);\n this.$el.find('#filestable thead th').toggleClass('hidden', this.isEmpty); // hide expiration date header for non link only shares\n\n if (!this._linksOnly) {\n this.$el.find('th.column-expiration').addClass('hidden');\n }\n } else {\n OCA.Files.FileList.prototype.updateEmptyContent.apply(this, arguments);\n }\n },\n getDirectoryPermissions: function getDirectoryPermissions() {\n return OC.PERMISSION_READ | OC.PERMISSION_DELETE;\n },\n updateStorageStatistics: function updateStorageStatistics() {// no op because it doesn't have\n // storage info like free space / used space\n },\n updateRow: function updateRow($tr, fileInfo, options) {\n // no-op, suppress re-rendering\n return $tr;\n },\n reload: function reload() {\n this.showMask();\n\n if (this._reloadCall) {\n this._reloadCall.abort();\n } // there is only root\n\n\n this._setCurrentDir('/', false);\n\n var promises = [];\n var deletedShares = {\n url: OC.linkToOCS('apps/files_sharing/api/v1', 2) + 'deletedshares',\n\n /* jshint camelcase: false */\n data: {\n format: 'json',\n include_tags: true\n },\n type: 'GET',\n beforeSend: function beforeSend(xhr) {\n xhr.setRequestHeader('OCS-APIREQUEST', 'true');\n }\n };\n var pendingShares = {\n url: OC.linkToOCS('apps/files_sharing/api/v1/shares', 2) + 'pending',\n\n /* jshint camelcase: false */\n data: {\n format: 'json'\n },\n type: 'GET',\n beforeSend: function beforeSend(xhr) {\n xhr.setRequestHeader('OCS-APIREQUEST', 'true');\n }\n };\n var shares = {\n url: OC.linkToOCS('apps/files_sharing/api/v1') + 'shares',\n\n /* jshint camelcase: false */\n data: {\n format: 'json',\n shared_with_me: this._sharedWithUser !== false,\n include_tags: true\n },\n type: 'GET',\n beforeSend: function beforeSend(xhr) {\n xhr.setRequestHeader('OCS-APIREQUEST', 'true');\n }\n };\n var remoteShares = {\n url: OC.linkToOCS('apps/files_sharing/api/v1') + 'remote_shares',\n\n /* jshint camelcase: false */\n data: {\n format: 'json',\n include_tags: true\n },\n type: 'GET',\n beforeSend: function beforeSend(xhr) {\n xhr.setRequestHeader('OCS-APIREQUEST', 'true');\n }\n }; // Add the proper ajax requests to the list and run them\n // and make sure we have 2 promises\n\n if (this._showDeleted) {\n promises.push($.ajax(deletedShares));\n } else if (this._showPending) {\n promises.push($.ajax(pendingShares));\n } else {\n promises.push($.ajax(shares));\n\n if (this._sharedWithUser !== false || this._isOverview) {\n promises.push($.ajax(remoteShares));\n }\n\n if (this._isOverview) {\n shares.data.shared_with_me = !shares.data.shared_with_me;\n promises.push($.ajax(shares));\n }\n }\n\n this._reloadCall = $.when.apply($, promises);\n var callBack = this.reloadCallback.bind(this);\n return this._reloadCall.then(callBack, callBack);\n },\n reloadCallback: function reloadCallback(shares, remoteShares, additionalShares) {\n delete this._reloadCall;\n this.hideMask();\n this.$el.find('#headerSharedWith').text(t('files_sharing', this._sharedWithUser ? 'Shared by' : 'Shared with'));\n var files = []; // make sure to use the same format\n\n if (shares[0] && shares[0].ocs) {\n shares = shares[0];\n }\n\n if (remoteShares && remoteShares[0] && remoteShares[0].ocs) {\n remoteShares = remoteShares[0];\n }\n\n if (additionalShares && additionalShares[0] && additionalShares[0].ocs) {\n additionalShares = additionalShares[0];\n }\n\n if (shares.ocs && shares.ocs.data) {\n files = files.concat(this._makeFilesFromShares(shares.ocs.data, this._sharedWithUser));\n }\n\n if (remoteShares && remoteShares.ocs && remoteShares.ocs.data) {\n files = files.concat(this._makeFilesFromRemoteShares(remoteShares.ocs.data));\n }\n\n if (additionalShares && additionalShares.ocs && additionalShares.ocs.data) {\n files = files.concat(this._makeFilesFromShares(additionalShares.ocs.data, !this._sharedWithUser));\n }\n\n this.setFiles(files);\n return true;\n },\n _makeFilesFromRemoteShares: function _makeFilesFromRemoteShares(data) {\n var files = data;\n files = _.chain(files) // convert share data to file data\n .map(function (share) {\n var file = {\n shareOwner: share.owner + '@' + share.remote.replace(/.*?:\\/\\//g, ''),\n name: OC.basename(share.mountpoint),\n mtime: share.mtime * 1000,\n mimetype: share.mimetype,\n type: share.type,\n id: share.file_id,\n path: OC.dirname(share.mountpoint),\n permissions: share.permissions,\n tags: share.tags || []\n };\n file.shares = [{\n id: share.id,\n type: OC.Share.SHARE_TYPE_REMOTE\n }];\n return file;\n }).value();\n return files;\n },\n\n /**\n * Converts the OCS API share response data to a file info\n * list\n * @param {Array} data OCS API share array\n * @param {bool} sharedWithUser\n * @returns {Array.} array of shared file info\n */\n _makeFilesFromShares: function _makeFilesFromShares(data, sharedWithUser) {\n /* jshint camelcase: false */\n var files = data;\n\n if (this._linksOnly) {\n files = _.filter(data, function (share) {\n return share.share_type === OC.Share.SHARE_TYPE_LINK;\n });\n } // OCS API uses non-camelcased names\n\n\n files = _.chain(files) // convert share data to file data\n .map(function (share) {\n // TODO: use OC.Files.FileInfo\n var file = {\n id: share.file_source,\n icon: OC.MimeType.getIconUrl(share.mimetype),\n mimetype: share.mimetype,\n tags: share.tags || []\n };\n\n if (share.item_type === 'folder') {\n file.type = 'dir';\n file.mimetype = 'httpd/unix-directory';\n } else {\n file.type = 'file';\n }\n\n file.share = {\n id: share.id,\n type: share.share_type,\n target: share.share_with,\n stime: share.stime * 1000,\n expiration: share.expiration\n };\n\n if (sharedWithUser) {\n file.shareOwner = share.displayname_owner;\n file.shareOwnerId = share.uid_owner;\n file.name = OC.basename(share.file_target);\n file.path = OC.dirname(share.file_target);\n file.permissions = share.permissions;\n\n if (file.path) {\n file.extraData = share.file_target;\n }\n } else {\n if (share.share_type !== OC.Share.SHARE_TYPE_LINK) {\n file.share.targetDisplayName = share.share_with_displayname;\n file.share.targetShareWithId = share.share_with;\n }\n\n file.name = OC.basename(share.path);\n file.path = OC.dirname(share.path);\n file.permissions = OC.PERMISSION_ALL;\n\n if (file.path) {\n file.extraData = share.path;\n }\n }\n\n return file;\n }) // Group all files and have a \"shares\" array with\n // the share info for each file.\n //\n // This uses a hash memo to cumulate share information\n // inside the same file object (by file id).\n .reduce(function (memo, file) {\n var data = memo[file.id];\n var recipient = file.share.targetDisplayName;\n var recipientId = file.share.targetShareWithId;\n\n if (!data) {\n data = memo[file.id] = file;\n data.shares = [file.share]; // using a hash to make them unique,\n // this is only a list to be displayed\n\n data.recipients = {};\n data.recipientData = {}; // share types\n\n data.shareTypes = {}; // counter is cheaper than calling _.keys().length\n\n data.recipientsCount = 0;\n data.mtime = file.share.stime;\n } else {\n // always take the most recent stime\n if (file.share.stime > data.mtime) {\n data.mtime = file.share.stime;\n }\n\n data.shares.push(file.share);\n }\n\n if (recipient) {\n // limit counterparts for output\n if (data.recipientsCount < 4) {\n // only store the first ones, they will be the only ones\n // displayed\n data.recipients[recipient] = true;\n data.recipientData[data.recipientsCount] = {\n 'shareWith': recipientId,\n 'shareWithDisplayName': recipient\n };\n }\n\n data.recipientsCount++;\n }\n\n data.shareTypes[file.share.type] = true;\n delete file.share;\n return memo;\n }, {}) // Retrieve only the values of the returned hash\n .values() // Clean up\n .each(function (data) {\n // convert the recipients map to a flat\n // array of sorted names\n data.mountType = 'shared';\n delete data.recipientsCount;\n\n if (sharedWithUser) {\n // only for outgoing shares\n delete data.shareTypes;\n } else {\n data.shareTypes = _.keys(data.shareTypes);\n }\n }) // Finish the chain by getting the result\n .value(); // Sort by expected sort comparator\n\n return files.sort(this._sortComparator);\n }\n });\n /**\n * Share info attributes.\n *\n * @typedef {Object} OCA.Sharing.ShareInfo\n *\n * @property {int} id share ID\n * @property {int} type share type\n * @property {String} target share target, either user name or group name\n * @property {int} stime share timestamp in milliseconds\n * @property {String} [targetDisplayName] display name of the recipient\n * (only when shared with others)\n * @property {String} [targetShareWithId] id of the recipient\n *\n */\n\n /**\n * Recipient attributes\n *\n * @typedef {Object} OCA.Sharing.RecipientInfo\n * @property {String} shareWith the id of the recipient\n * @property {String} shareWithDisplayName the display name of the recipient\n */\n\n /**\n * Shared file info attributes.\n *\n * @typedef {OCA.Files.FileInfo} OCA.Sharing.SharedFileInfo\n *\n * @property {Array.} shares array of shares for\n * this file\n * @property {int} mtime most recent share time (if multiple shares)\n * @property {String} shareOwner name of the share owner\n * @property {Array.} recipients name of the first 4 recipients\n * (this is mostly for display purposes)\n * @property {Object.} recipientData (as object for easier\n * passing to HTML data attributes with jQuery)\n */\n\n OCA.Sharing.FileList = FileList;\n})();","import '../js/app';\nimport '../js/sharedfilelist'; // eslint-disable-next-line camelcase\n\n__webpack_nonce__ = btoa(OC.requestToken); // eslint-disable-next-line camelcase\n\n__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/');"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACvWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACzfA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}