Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fileid as string in web UI #30435

Merged
merged 3 commits into from
Feb 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion apps/files/js/fileactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@

this.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
var dir = context.$file.attr('data-path') || context.fileList.getCurrentDirectory();
context.fileList.changeDirectory(OC.joinPaths(dir, filename), true, false, parseInt(context.$file.attr('data-id'), 10));
context.fileList.changeDirectory(OC.joinPaths(dir, filename), true, false, context.$file.attr('data-id'));
});

this.registerAction({
Expand Down
4 changes: 0 additions & 4 deletions apps/files/js/fileinfomodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
_filesClient: null,

initialize: function(data, options) {
if (!_.isUndefined(data.id)) {
data.id = parseInt(data.id, 10);
}

if( options ){
if (options.filesClient) {
this._filesClient = options.filesClient;
Expand Down
4 changes: 2 additions & 2 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@
elementToFile: function($el){
$el = $($el);
var data = {
id: parseInt($el.attr('data-id'), 10),
id: $el.attr('data-id'),
name: $el.attr('data-file'),
mimetype: $el.attr('data-mime'),
mtime: parseInt($el.attr('data-mtime'), 10),
Expand Down Expand Up @@ -1859,7 +1859,7 @@
remove: function(name, options){
options = options || {};
var fileEl = this.findFileEl(name);
var fileId = fileEl.data('id');
var fileId = fileEl.attr('data-id');
var index = fileEl.index();
if (!fileEl.length) {
return null;
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
Loading