aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/fileactions.js16
-rw-r--r--apps/files/js/filelist.js15
2 files changed, 18 insertions, 13 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index e06d2912274..cbfd047e98f 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -91,15 +91,11 @@
if (!this.actions[mime]) {
this.actions[mime] = {};
}
- if (!this.actions[mime][name]) {
- this.actions[mime][name] = {};
- }
- if (!displayName) {
- displayName = t('files', name);
- }
- this.actions[mime][name]['action'] = action;
- this.actions[mime][name]['permissions'] = permissions;
- this.actions[mime][name]['displayName'] = displayName;
+ this.actions[mime][name] = {
+ action: action,
+ permissions: permissions,
+ displayName: displayName || t('files', name)
+ };
this.icons[name] = icon;
this._notifyUpdateListeners();
},
@@ -314,7 +310,7 @@
});
this.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
- var dir = context.fileList.getCurrentDirectory();
+ var dir = context.$file.attr('data-path') || context.fileList.getCurrentDirectory();
if (dir !== '/') {
dir = dir + '/';
}
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 400e3e28f00..3e311655c91 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -919,7 +919,9 @@
.addClass(direction === 'desc' ? this.SORT_INDICATOR_DESC_CLASS : this.SORT_INDICATOR_ASC_CLASS);
},
/**
- * @brief Reloads the file list using ajax call
+ * Reloads the file list using ajax call
+ *
+ * @return ajax call object
*/
reload: function() {
this._selectedFiles = {};
@@ -945,6 +947,13 @@
this.hideMask();
if (!result || result.status === 'error') {
+ // if the error is not related to folder we're trying to load, reload the page to handle logout etc
+ if (result.data.error === 'authentication_error' ||
+ result.data.error === 'token_expired' ||
+ result.data.error === 'application_not_enabled'
+ ) {
+ OC.redirect(OC.generateUrl('apps/files'));
+ }
OC.Notification.show(result.data.message);
return false;
}
@@ -968,7 +977,7 @@
}
this.setFiles(result.data.files);
- return true
+ return true;
},
updateStorageStatistics: function(force) {
@@ -1566,7 +1575,7 @@
numMatch=base.match(/\((\d+)\)/);
var num=2;
if (numMatch && numMatch.length>0) {
- num=parseInt(numMatch[numMatch.length-1])+1;
+ num=parseInt(numMatch[numMatch.length-1], 10)+1;
base=base.split('(');
base.pop();
base=$.trim(base.join('('));