Skip to content

Commit

Permalink
fix circular dependency and add renderMode to test expected result
Browse files Browse the repository at this point in the history
  • Loading branch information
benptc committed Mar 15, 2024
1 parent dcbdbbe commit a4ac496
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions controllers/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const formidable = require('formidable');
const utilities = require('../libraries/utilities');
const {fileExists, unlinkIfExists, mkdirIfNotExists} = utilities;
const {startSplatTask} = require('./object/SplatTask.js');
const server = require('../server');
const { beatPort } = require('../config.js');

// Variables populated from server.js with setup()
Expand All @@ -28,6 +27,7 @@ let objectLookup;
let activeHeartbeats;
let knownObjects;
let setAnchors;
let objectBeatSender;

const deleteObject = async function(objectID) {
let object = utilities.getObject(objects, objectID);
Expand Down Expand Up @@ -603,8 +603,7 @@ const uploadTarget = async (objectName, req, res) => {
await utilities.writeObjectToFile(objects, thisObjectId, globalVariables.saveToDisk);
await setAnchors();

// await objectBeatSender(beatPort, thisObjectId, objects[thisObjectId].ip, true);
await server.objectBeatSender(beatPort, thisObjectId, objects[thisObjectId].ip, true);
await objectBeatSender(beatPort, thisObjectId, objects[thisObjectId].ip, true);

// delete the tmp folder and any files within it
await utilities.rmdirIfExists(uploadDir);
Expand Down Expand Up @@ -641,7 +640,7 @@ const getObject = function (objectID, excludeUnpinned) {
};

const setup = function (objects_, globalVariables_, hardwareAPI_, objectsPath_, sceneGraph_,
objectLookup_, activeHeartbeats_, knownObjects_, setAnchors_) {
objectLookup_, activeHeartbeats_, knownObjects_, setAnchors_, objectBeatSender_) {
objects = objects_;
globalVariables = globalVariables_;
hardwareAPI = hardwareAPI_;
Expand All @@ -651,6 +650,7 @@ const setup = function (objects_, globalVariables_, hardwareAPI_, objectsPath_,
activeHeartbeats = activeHeartbeats_;
knownObjects = knownObjects_;
setAnchors = setAnchors_;
objectBeatSender = objectBeatSender_;
};

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4632,7 +4632,7 @@ function setupControllers() {
linkController.setup(objects, knownObjects, socketArray, globalVariables, hardwareAPI, objectsPath, socketUpdater, engine);
logicNodeController.setup(objects, globalVariables, objectsPath);
nodeController.setup(objects, globalVariables, objectsPath, sceneGraph);
objectController.setup(objects, globalVariables, hardwareAPI, objectsPath, sceneGraph, objectLookup, activeHeartbeats, knownObjects, setAnchors);
objectController.setup(objects, globalVariables, hardwareAPI, objectsPath, sceneGraph, objectLookup, activeHeartbeats, knownObjects, setAnchors, objectBeatSender);
spatialController.setup(objects, globalVariables, hardwareAPI, sceneGraph);
}

Expand Down
1 change: 1 addition & 0 deletions tests/upload-target.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ test('target upload to /content/:objectName', async () => {
version: '3.2.2',
deactivated: false,
protocol: 'R2',
renderMode: null,
visible: false,
visibleText: false,
visibleEditing: false,
Expand Down

0 comments on commit a4ac496

Please sign in to comment.