diff --git a/services/web/app/src/infrastructure/ExpressLocals.js b/services/web/app/src/infrastructure/ExpressLocals.js index 5ba7760c0e..1a4ebe9875 100644 --- a/services/web/app/src/infrastructure/ExpressLocals.js +++ b/services/web/app/src/infrastructure/ExpressLocals.js @@ -317,22 +317,6 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) { next() }) - webRouter.use(function(req, res, next) { - res.locals.uiConfig = { - defaultResizerSizeOpen: 7, - defaultResizerSizeClosed: 7, - eastResizerCursor: 'ew-resize', - westResizerCursor: 'ew-resize', - chatResizerSizeOpen: 7, - chatResizerSizeClosed: 0, - chatMessageBorderSaturation: '85%', - chatMessageBorderLightness: '40%', - chatMessageBgSaturation: '85%', - chatMessageBgLightness: '40%' - } - next() - }) - webRouter.use(function(req, res, next) { // TODO if (Settings.overleaf != null) { diff --git a/services/web/app/views/project/editor.pug b/services/web/app/views/project/editor.pug index 0034ec8369..834a6a4fc3 100644 --- a/services/web/app/views/project/editor.pug +++ b/services/web/app/views/project/editor.pug @@ -194,7 +194,6 @@ block content window.aceBasePath = "/js/#{lib('ace')}" //- Set path for PDFjs CMaps window.pdfCMapsPath = "/js/cmaps/" - window.uiConfig = JSON.parse('!{StringHelper.stringifyJsonForScript(uiConfig)}'); //- enable doc hash checking for all projects //- used in public/js/libs/sharejs.js window.useShareJsHash = true diff --git a/services/web/frontend/js/features/chat/components/message.js b/services/web/frontend/js/features/chat/components/message.js index c9cd2f2b05..c2f0e1b320 100644 --- a/services/web/frontend/js/features/chat/components/message.js +++ b/services/web/frontend/js/features/chat/components/message.js @@ -4,33 +4,20 @@ import ColorManager from '../../../ide/colors/ColorManager' import MessageContent from './message-content' function Message({ message, userId }) { - const { - chatMessageBorderSaturation, - chatMessageBorderLightness, - chatMessageBgSaturation, - chatMessageBgLightness - } = window.uiConfig - function hue(user) { return user ? ColorManager.getHueForUserId(user.id) : 0 } function getMessageStyle(user) { return { - borderColor: `hsl(${hue( - user - )}, ${chatMessageBorderSaturation}, ${chatMessageBorderLightness})`, - backgroundColor: `hsl(${hue( - user - )}, ${chatMessageBgSaturation}, ${chatMessageBgLightness})` + borderColor: `hsl(${hue(user)}, 85%, 40%)`, + backgroundColor: `hsl(${hue(user)}, 85%, 40%` } } function getArrowStyle(user) { return { - borderColor: `hsl(${hue( - user - )}, ${chatMessageBorderSaturation}, ${chatMessageBorderLightness})` + borderColor: `hsl(${hue(user)}, 85%, 40%)` } } diff --git a/services/web/frontend/js/ide.js b/services/web/frontend/js/ide.js index 5e0a267d2e..db7a8c7b1b 100644 --- a/services/web/frontend/js/ide.js +++ b/services/web/frontend/js/ide.js @@ -103,8 +103,8 @@ App.controller('IdeController', function( pdfWidth: 0, reviewPanelOpen: localStorage(`ui.reviewPanelOpen.${window.project_id}`), miniReviewPanelVisible: false, - chatResizerSizeOpen: window.uiConfig.chatResizerSizeOpen, - chatResizerSizeClosed: window.uiConfig.chatResizerSizeClosed + chatResizerSizeOpen: 7, + chatResizerSizeClosed: 7 } $scope.user = window.user diff --git a/services/web/frontend/js/ide/directives/layout.js b/services/web/frontend/js/ide/directives/layout.js index becf1c3583..5a54d765bb 100644 --- a/services/web/frontend/js/ide/directives/layout.js +++ b/services/web/frontend/js/ide/directives/layout.js @@ -35,13 +35,13 @@ export default App.directive('layout', ($parse, $compile, ide) => ({ if (attrs.spacingOpen != null) { spacingOpen = parseInt(attrs.spacingOpen, 10) } else { - spacingOpen = window.uiConfig.defaultResizerSizeOpen + spacingOpen = 7 } if (attrs.spacingClosed != null) { spacingClosed = parseInt(attrs.spacingClosed, 10) } else { - spacingClosed = window.uiConfig.defaultResizerSizeClosed + spacingClosed = 7 } const options = { @@ -93,13 +93,8 @@ export default App.directive('layout', ($parse, $compile, ide) => ({ } } - if (window.uiConfig.eastResizerCursor != null) { - options.east.resizerCursor = window.uiConfig.eastResizerCursor - } - - if (window.uiConfig.westResizerCursor != null) { - options.west.resizerCursor = window.uiConfig.westResizerCursor - } + options.east.resizerCursor = 'ew-resize' + options.west.resizerCursor = 'ew-resize' const repositionControls = function() { state = element.layout().readState() diff --git a/services/web/frontend/stories/chat.stories.js b/services/web/frontend/stories/chat.stories.js index 272d9eb591..6898814d1c 100644 --- a/services/web/frontend/stories/chat.stories.js +++ b/services/web/frontend/stories/chat.stories.js @@ -4,10 +4,7 @@ import { v4 as uuid } from 'uuid' import { ContextRoot } from '../js/shared/context/root-context' import ChatPane from '../js/features/chat/components/chat-pane' -import { - stubUIConfig, - stubMathJax -} from '../../test/frontend/features/chat/components/stubs' +import { stubMathJax } from '../../test/frontend/features/chat/components/stubs' import { setupContext } from './fixtures/context' const ONE_MINUTE = 60 * 1000 @@ -43,7 +40,6 @@ function generateMessages(count) { return messages } -stubUIConfig() stubMathJax() setupContext() diff --git a/services/web/test/frontend/features/chat/components/chat-pane.test.js b/services/web/test/frontend/features/chat/components/chat-pane.test.js index d66ac00ebe..7daaa6cd1d 100644 --- a/services/web/test/frontend/features/chat/components/chat-pane.test.js +++ b/services/web/test/frontend/features/chat/components/chat-pane.test.js @@ -8,12 +8,7 @@ import { renderWithChatContext, cleanUpContext } from '../../../helpers/render-with-context' -import { - stubMathJax, - stubUIConfig, - tearDownMathJaxStubs, - tearDownUIConfigStubs -} from './stubs' +import { stubMathJax, tearDownMathJaxStubs } from './stubs' describe('', function() { const user = { @@ -41,12 +36,10 @@ describe('', function() { fetchMock.reset() cleanUpContext() - stubUIConfig() stubMathJax() }) afterEach(function() { - tearDownUIConfigStubs() tearDownMathJaxStubs() }) diff --git a/services/web/test/frontend/features/chat/components/message-list.test.js b/services/web/test/frontend/features/chat/components/message-list.test.js index a73adab450..ccbe9e0d96 100644 --- a/services/web/test/frontend/features/chat/components/message-list.test.js +++ b/services/web/test/frontend/features/chat/components/message-list.test.js @@ -4,12 +4,7 @@ import { expect } from 'chai' import { screen, render, fireEvent } from '@testing-library/react' import MessageList from '../../../../../frontend/js/features/chat/components/message-list' -import { - stubMathJax, - stubUIConfig, - tearDownMathJaxStubs, - tearDownUIConfigStubs -} from './stubs' +import { stubMathJax, tearDownMathJaxStubs } from './stubs' describe('', function() { const currentUser = { @@ -36,12 +31,10 @@ describe('', function() { } before(function() { - stubUIConfig() stubMathJax() }) after(function() { - tearDownUIConfigStubs() tearDownMathJaxStubs() }) diff --git a/services/web/test/frontend/features/chat/components/message.test.js b/services/web/test/frontend/features/chat/components/message.test.js index c6a07ddcf4..41e5c1314e 100644 --- a/services/web/test/frontend/features/chat/components/message.test.js +++ b/services/web/test/frontend/features/chat/components/message.test.js @@ -3,12 +3,7 @@ import React from 'react' import { render, screen } from '@testing-library/react' import Message from '../../../../../frontend/js/features/chat/components/message' -import { - stubMathJax, - stubUIConfig, - tearDownMathJaxStubs, - tearDownUIConfigStubs -} from './stubs' +import { stubMathJax, tearDownMathJaxStubs } from './stubs' describe('', function() { const currentUser = { @@ -19,13 +14,11 @@ describe('', function() { beforeEach(function() { window.user = currentUser - stubUIConfig() stubMathJax() }) afterEach(function() { delete window.user - tearDownUIConfigStubs() tearDownMathJaxStubs() }) diff --git a/services/web/test/frontend/features/chat/components/stubs.js b/services/web/test/frontend/features/chat/components/stubs.js index 7fe5af41f9..2a52159225 100644 --- a/services/web/test/frontend/features/chat/components/stubs.js +++ b/services/web/test/frontend/features/chat/components/stubs.js @@ -1,18 +1,5 @@ import sinon from 'sinon' -export function stubUIConfig() { - window.uiConfig = { - chatMessageBorderSaturation: '85%', - chatMessageBorderLightness: '40%', - chatMessageBgSaturation: '85%', - chatMessageBgLightness: '40%' - } -} - -export function tearDownUIConfigStubs() { - delete window.uiConfig -} - export function stubMathJax() { window.MathJax = { Hub: {