From fb3966ef354e823b4b1828c0a0d3c3d4219044ae Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 22 Jun 2021 12:13:19 +0100 Subject: [PATCH] [misc] CompileController: simplify composing of outputFiles --- services/clsi/app/js/CompileController.js | 14 ++------------ .../clsi/test/unit/js/CompileControllerTests.js | 12 ++---------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/services/clsi/app/js/CompileController.js b/services/clsi/app/js/CompileController.js index 2813bca984..4307736d5a 100644 --- a/services/clsi/app/js/CompileController.js +++ b/services/clsi/app/js/CompileController.js @@ -123,7 +123,7 @@ module.exports = CompileController = { stats, timings, outputFiles: outputFiles.map((file) => { - const record = { + return { url: `${Settings.apis.clsi.url}/project/${request.project_id}` + (request.user_id != null @@ -131,18 +131,8 @@ module.exports = CompileController = { : '') + (file.build != null ? `/build/${file.build}` : '') + `/output/${file.path}`, - path: file.path, - type: file.type, - build: file.build, - contentId: file.contentId + ...file } - if (file.ranges != null) { - record.ranges = file.ranges - } - if (file.size != null) { - record.size = file.size - } - return record }) } }) diff --git a/services/clsi/test/unit/js/CompileControllerTests.js b/services/clsi/test/unit/js/CompileControllerTests.js index 6d6b34ee58..6236be77f0 100644 --- a/services/clsi/test/unit/js/CompileControllerTests.js +++ b/services/clsi/test/unit/js/CompileControllerTests.js @@ -157,11 +157,7 @@ describe('CompileController', function () { outputFiles: this.output_files.map((file) => { return { url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`, - path: file.path, - type: file.type, - build: file.build, - // gets dropped by JSON.stringify - contentId: undefined + ...file } }) } @@ -202,11 +198,7 @@ describe('CompileController', function () { outputFiles: this.output_files.map((file) => { return { url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`, - path: file.path, - type: file.type, - build: file.build, - // gets dropped by JSON.stringify - contentId: undefined + ...file } }) }