Skip to content

Commit

Permalink
File id as string for sharing and other components
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Petry committed Feb 16, 2018
1 parent 87151df commit e255991
Show file tree
Hide file tree
Showing 24 changed files with 111 additions and 109 deletions.
6 changes: 3 additions & 3 deletions apps/comments/tests/js/commentscollectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('OCA.Comments.CommentCollection', function() {
actorId: 'user1',
actorDisplayName: 'User One',
objectType: 'files',
objectId: 5,
objectId: '5',
message: 'First',
creationDateTime: Date.UTC(2016, 1, 3, 10, 5, 0)
};
Expand All @@ -33,7 +33,7 @@ describe('OCA.Comments.CommentCollection', function() {
actorId: 'user2',
actorDisplayName: 'User Two',
objectType: 'files',
objectId: 5,
objectId: '5',
message: 'Second\nNewline',
creationDateTime: Date.UTC(2016, 1, 3, 10, 0, 0)
};
Expand All @@ -43,7 +43,7 @@ describe('OCA.Comments.CommentCollection', function() {
actorId: 'user3',
actorDisplayName: 'User Three',
objectType: 'files',
objectId: 5,
objectId: '5',
message: 'Third',
creationDateTime: Date.UTC(2016, 1, 3, 5, 0, 0)
};
Expand Down
8 changes: 4 additions & 4 deletions apps/comments/tests/js/commentstabviewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('OCA.Comments.CommentsTabView tests', function() {
fetchStub = sinon.stub(OCA.Comments.CommentCollection.prototype, 'fetchNext');
view = new OCA.Comments.CommentsTabView();
fileInfoModel = new OCA.Files.FileInfoModel({
id: 5,
id: '5',
name: 'One.txt',
mimetype: 'text/plain',
permissions: 31,
Expand All @@ -60,7 +60,7 @@ describe('OCA.Comments.CommentsTabView tests', function() {
actorId: 'user1',
actorDisplayName: 'User One',
objectType: 'files',
objectId: 5,
objectId: '5',
message: 'First',
creationDateTime: new Date(Date.UTC(2016, 1, 3, 10, 5, 0)).toUTCString()
});
Expand All @@ -70,7 +70,7 @@ describe('OCA.Comments.CommentsTabView tests', function() {
actorId: 'user2',
actorDisplayName: 'User Two',
objectType: 'files',
objectId: 5,
objectId: '5',
message: 'Second\nNewline',
creationDateTime: new Date(Date.UTC(2016, 1, 3, 10, 0, 0)).toUTCString()
});
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('OCA.Comments.CommentsTabView tests', function() {
actorId: 'user3',
actorDisplayName: 'User Three',
objectType: 'files',
objectId: 5,
objectId: '5',
message: 'Third',
creationDateTime: new Date(Date.UTC(2016, 1, 3, 5, 0, 0)).toUTCString()
});
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/tests/js/filespluginSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('OCA.Comments.FilesPlugin tests', function() {
OCA.Comments.FilesPlugin.attach(fileList);

testFiles = [{
id: 1,
id: '1',
type: 'file',
name: 'One.txt',
path: '/subdir',
Expand Down
14 changes: 7 additions & 7 deletions apps/files/tests/js/detailsviewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('OCA.Files.DetailsView tests', function() {
detailsView.addDetailView(testView2);
detailsView.render();

var fileInfo = {id: 5, name: 'test.txt'};
var fileInfo = {id: '5', name: 'test.txt'};
viewRenderStub.reset();
detailsView.setFileInfo(fileInfo);

Expand Down Expand Up @@ -80,8 +80,8 @@ describe('OCA.Files.DetailsView tests', function() {
it('updates tab model and rerenders on-demand as soon as it gets selected', function() {
var tab1RenderStub = sinon.stub(testView, 'render');
var tab2RenderStub = sinon.stub(testView2, 'render');
var fileInfo1 = new OCA.Files.FileInfoModel({id: 5, name: 'test.txt'});
var fileInfo2 = new OCA.Files.FileInfoModel({id: 8, name: 'test2.txt'});
var fileInfo1 = new OCA.Files.FileInfoModel({id: '5', name: 'test.txt'});
var fileInfo2 = new OCA.Files.FileInfoModel({id: '8', name: 'test2.txt'});

detailsView.setFileInfo(fileInfo1);

Expand Down Expand Up @@ -166,7 +166,7 @@ describe('OCA.Files.DetailsView tests', function() {
detailsView.addTabView(testView2);
detailsView.addTabView(testView3);

var fileInfo = {id: 5, name: 'test.txt'};
var fileInfo = {id: '5', name: 'test.txt'};
detailsView.setFileInfo(fileInfo);

expect(testView.canDisplay.calledOnce).toEqual(true);
Expand All @@ -184,7 +184,7 @@ describe('OCA.Files.DetailsView tests', function() {
detailsView.addTabView(testView);
detailsView.addTabView(testView2);

var fileInfo = {id: 5, name: 'test.txt'};
var fileInfo = {id: '5', name: 'test.txt'};
detailsView.setFileInfo(fileInfo);

expect(testView.canDisplay.calledOnce).toEqual(true);
Expand All @@ -203,13 +203,13 @@ describe('OCA.Files.DetailsView tests', function() {
detailsView.addTabView(testView);
detailsView.addTabView(testView2);

var fileInfo = {id: 5, name: 'test.txt', mimetype: 'text/plain'};
var fileInfo = {id: '5', name: 'test.txt', mimetype: 'text/plain'};
detailsView.setFileInfo(fileInfo);

expect(detailsView.$el.find('.tabHeader[data-tabid=test1]').hasClass('selected')).toEqual(true);
expect(detailsView.$el.find('.tabHeader[data-tabid=test2]').hasClass('selected')).toEqual(false);

detailsView.setFileInfo({id: 10, name: 'folder', mimetype: 'httpd/unix-directory'});
detailsView.setFileInfo({id: '10', name: 'folder', mimetype: 'httpd/unix-directory'});

expect(detailsView.$el.find('.tabHeader[data-tabid=test1]').hasClass('selected')).toEqual(false);
expect(detailsView.$el.find('.tabHeader[data-tabid=test2]').hasClass('selected')).toEqual(true);
Expand Down
2 changes: 1 addition & 1 deletion apps/files/tests/js/favoritesfilelistspec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('OCA.Files.FavoritesFileList tests', function() {
expect(fetchStub.calledOnce).toEqual(true);

deferred.resolve(207, [{
id: 7,
id: '7',
name: 'test.txt',
path: '/somedir',
size: 123,
Expand Down
12 changes: 6 additions & 6 deletions apps/files/tests/js/fileactionsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('OCA.Files.FileActions tests', function() {

beforeEach(function() {
var fileData = {
id: 18,
id: '18',
type: 'file',
name: 'testName.txt',
mimetype: 'text/plain',
Expand Down Expand Up @@ -273,7 +273,7 @@ describe('OCA.Files.FileActions tests', function() {
beforeEach(function() {
clock = sinon.useFakeTimers();
var fileData = {
id: 18,
id: '18',
type: 'file',
name: 'testName.txt',
mimetype: 'text/plain',
Expand Down Expand Up @@ -318,7 +318,7 @@ describe('OCA.Files.FileActions tests', function() {
});
it('also triggers action handler when calling triggerAction()', function() {
var model = new OCA.Files.FileInfoModel({
id: 1,
id: '1',
name: 'Test.txt',
path: '/subdir',
mime: 'text/plain',
Expand Down Expand Up @@ -359,7 +359,7 @@ describe('OCA.Files.FileActions tests', function() {
var $tr;
beforeEach(function() {
var fileData = {
id: 18,
id: '18',
type: 'file',
name: 'testName.txt',
mimetype: 'text/plain',
Expand Down Expand Up @@ -408,7 +408,7 @@ describe('OCA.Files.FileActions tests', function() {
var $tr;
beforeEach(function() {
var fileData = {
id: 18,
id: '18',
type: 'file',
name: 'testName.txt',
path: '/anotherpath/there',
Expand Down Expand Up @@ -621,7 +621,7 @@ describe('OCA.Files.FileActions tests', function() {
var handleDownloadStub = sinon.stub(OCA.Files.Files, 'handleDownload');
var busyStub = sinon.stub(fileList, 'showFileBusyState');
var fileData = {
id: 18,
id: '18',
type: 'file',
name: 'testName.txt',
mimetype: 'text/plain',
Expand Down
8 changes: 4 additions & 4 deletions apps/files/tests/js/fileactionsmenuSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('OCA.Files.FileActionsMenu tests', function() {
fileActions.setDefault('all', 'Testdefault');

var fileData = {
id: 18,
id: '18',
type: 'file',
name: 'testName.txt',
mimetype: 'text/plain',
Expand Down Expand Up @@ -228,7 +228,7 @@ describe('OCA.Files.FileActionsMenu tests', function() {
it('redirects to download URL when clicking download', function() {
var redirectStub = sinon.stub(OC, 'redirect');
var fileData = {
id: 18,
id: '18',
type: 'file',
name: 'testName.txt',
mimetype: 'text/plain',
Expand Down Expand Up @@ -260,7 +260,7 @@ describe('OCA.Files.FileActionsMenu tests', function() {
it('takes the file\'s path into account when clicking download', function() {
var redirectStub = sinon.stub(OC, 'redirect');
var fileData = {
id: 18,
id: '18',
type: 'file',
name: 'testName.txt',
path: '/anotherpath/there',
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('OCA.Files.FileActionsMenu tests', function() {
it('deletes file when clicking delete', function() {
var deleteStub = sinon.stub(fileList, 'do_delete');
var fileData = {
id: 18,
id: '18',
type: 'file',
name: 'testName.txt',
path: '/somepath/dir',
Expand Down
4 changes: 2 additions & 2 deletions apps/files/tests/js/mainfileinfodetailviewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() {
fileActions: fileActions
});
testFileInfo = new OCA.Files.FileInfoModel({
id: 5,
id: '5',
name: 'One.txt',
mimetype: 'text/plain',
permissions: 31,
Expand Down Expand Up @@ -198,7 +198,7 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() {
it('unbinds change listener from model', function() {
view.setFileInfo(testFileInfo);
view.setFileInfo(new OCA.Files.FileInfoModel({
id: 999,
id: '999',
name: 'test.txt',
path: '/'
}));
Expand Down
2 changes: 1 addition & 1 deletion apps/files/tests/js/tagspluginspec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('OCA.Files.TagsPlugin tests', function() {
OCA.Files.TagsPlugin.attach(fileList);

testFiles = [{
id: 1,
id: '1',
type: 'file',
name: 'One.txt',
path: '/subdir',
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/API/Remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private static function extendShareInfo($share) {
$share['mtime'] = $info->getMtime();
$share['permissions'] = $info->getPermissions();
$share['type'] = $info->getType();
$share['file_id'] = $info->getId();
$share['file_id'] = strval($info->getId());

return $share;
}
Expand Down
6 changes: 3 additions & 3 deletions apps/files_sharing/lib/API/Share20OCS.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ protected function formatShare(\OCP\Share\IShare $share) {
$result['mimetype'] = $node->getMimeType();
$result['storage_id'] = $node->getStorage()->getId();
$result['storage'] = $node->getStorage()->getCache()->getNumericStorageId();
$result['item_source'] = $node->getId();
$result['file_source'] = $node->getId();
$result['file_parent'] = $node->getParent()->getId();
$result['item_source'] = strval($node->getId());
$result['file_source'] = strval($node->getId());
$result['file_parent'] = strval($node->getParent()->getId());
$result['file_target'] = $share->getTarget();

if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
Expand Down
Loading

0 comments on commit e255991

Please sign in to comment.