Commit 288acb55 authored by Morris Jobke's avatar Morris Jobke
Browse files

Merge pull request #12305 from owncloud/sharelist-nodelete

Remove delete button in shared with others list
parents 6a08fca3 63fa8ec6
......@@ -103,7 +103,11 @@
},
getDirectoryPermissions: function() {
return OC.PERMISSION_READ | OC.PERMISSION_DELETE;
var perms = OC.PERMISSION_READ;
if (this._sharedWithUser) {
perms |= OC.PERMISSION_DELETE;
}
return perms;
},
updateStorageStatistics: function() {
......@@ -203,7 +207,11 @@
}
file.name = OC.basename(share.path);
file.path = OC.dirname(share.path);
file.permissions = OC.PERMISSION_ALL;
if (this._sharedWithUser) {
file.permissions = OC.PERMISSION_ALL;
} else {
file.permissions = OC.PERMISSION_ALL - OC.PERMISSION_DELETE;
}
if (file.path) {
file.extraData = share.path;
}
......
......@@ -91,7 +91,7 @@ describe('OCA.Sharing.FileList tests', function() {
file_source: 49,
file_target: '/local path/local name.txt',
path: 'files/something shared.txt',
permissions: 31,
permissions: OC.PERMISSION_ALL,
stime: 11111,
share_type: OC.Share.SHARE_TYPE_USER,
share_with: 'user1',
......@@ -127,7 +127,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
expect(parseInt($tr.attr('data-permissions'), 10))
.toEqual(OC.PERMISSION_ALL); // read and delete
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).toEqual('User Two');
......@@ -169,7 +170,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
expect(parseInt($tr.attr('data-permissions'), 10))
.toEqual(OC.PERMISSION_ALL); // read and delete
expect($tr.attr('data-mime')).toEqual('httpd/unix-directory');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).toEqual('User Two');
......@@ -244,7 +246,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
expect(parseInt($tr.attr('data-permissions'), 10))
.toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).not.toBeDefined();
......@@ -285,7 +288,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
expect(parseInt($tr.attr('data-permissions'), 10))
.toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('httpd/unix-directory');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).not.toBeDefined();
......@@ -336,7 +340,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
expect(parseInt($tr.attr('data-permissions'), 10))
.toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-owner')).not.toBeDefined();
......@@ -404,7 +409,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
expect(parseInt($tr.attr('data-permissions'), 10))
.toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
// always use the most recent stime
expect($tr.attr('data-mtime')).toEqual('22222000');
......@@ -430,6 +436,7 @@ describe('OCA.Sharing.FileList tests', function() {
fileList.reload();
/* jshint camelcase: false */
ocsResponse = {
ocs: {
meta: {
......@@ -496,7 +503,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
expect(parseInt($tr.attr('data-permissions'), 10))
.toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-recipients')).not.toBeDefined();
......@@ -537,7 +545,8 @@ describe('OCA.Sharing.FileList tests', function() {
expect($tr.attr('data-file')).toEqual('local name.txt');
expect($tr.attr('data-path')).toEqual('/local path');
expect($tr.attr('data-size')).not.toBeDefined();
expect($tr.attr('data-permissions')).toEqual('31'); // read and delete
expect(parseInt($tr.attr('data-permissions'), 10))
.toEqual(OC.PERMISSION_ALL - OC.PERMISSION_DELETE); // read
expect($tr.attr('data-mime')).toEqual('text/plain');
expect($tr.attr('data-mtime')).toEqual('11111000');
expect($tr.attr('data-share-recipients')).not.toBeDefined();
......@@ -633,7 +642,8 @@ describe('OCA.Sharing.FileList tests', function() {
}]);
$tr = fileList.$el.find('tr:first');
expect(parseInt($tr.attr('data-share-permissions'), 10)).toEqual(OC.PERMISSION_ALL - OC.PERMISSION_SHARE - OC.PERMISSION_DELETE);
expect(parseInt($tr.attr('data-share-permissions'), 10))
.toEqual(OC.PERMISSION_ALL - OC.PERMISSION_SHARE - OC.PERMISSION_DELETE);
});
});
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment