Просмотр исходного кода

Merge pull request #47 from overleaf/jpa-bump-dev-env-3-3-2-testing

[misc] bump the dev-env to 3.3.2
Christopher Hoskin 6 лет назад
Родитель
Сommit
bd5eb4eef6

+ 1 - 2
services/chat/.eslintrc

@@ -1,7 +1,6 @@
 // this file was auto-generated, do not edit it directly.
 // instead run bin/update_build_scripts from
 // https://github.com/sharelatex/sharelatex-dev-environment
-// Version: 1.4.0
 {
   "extends": [
     "standard",
@@ -9,7 +8,7 @@
     "prettier/standard"
   ],
   "parserOptions": {
-    "ecmaVersion": 2017
+    "ecmaVersion": 2018
   },
   "plugins": [
     "mocha",

+ 17 - 0
services/chat/.github/dependabot.yml

@@ -0,0 +1,17 @@
+version: 2
+updates:
+  - package-ecosystem: "npm"
+    directory: "/"
+    schedule:
+      interval: "daily"
+
+    pull-request-branch-name:
+      # Separate sections of the branch name with a hyphen
+      # Docker images use the branch name and do not support slashes in tags
+      # https://github.com/overleaf/google-ops/issues/822
+      # https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#pull-request-branch-nameseparator
+      separator: "-"
+
+    # Block informal upgrades -- security upgrades use a separate queue.
+    # https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#open-pull-requests-limit
+    open-pull-requests-limit: 0

+ 3 - 0
services/chat/.gitignore

@@ -7,3 +7,6 @@ node_modules/
 plato/
 
 **/*.map
+
+# managed by dev-environment$ bin/update_build_scripts
+.npmrc

+ 0 - 1
services/chat/.prettierrc

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.4.0
 {
   "semi": false,
   "singleQuote": true

+ 1 - 4
services/chat/Dockerfile

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.4.0
 
 FROM node:10.21.0 as base
 
@@ -12,12 +11,10 @@ FROM base as app
 #wildcard as some files may not be in all repos
 COPY package*.json npm-shrink*.json /app/
 
-RUN npm install --quiet
+RUN npm ci --quiet
 
 COPY . /app
 
-
-
 FROM base
 
 COPY --from=app /app /app

+ 0 - 131
services/chat/Jenkinsfile

@@ -1,131 +0,0 @@
-String cron_string = BRANCH_NAME == "master" ? "@daily" : ""
-
-pipeline {
-  agent any
-
-  environment {
-    GIT_PROJECT = "chat"
-    JENKINS_WORKFLOW = "chat-sharelatex"
-    TARGET_URL = "${env.JENKINS_URL}blue/organizations/jenkins/${JENKINS_WORKFLOW}/detail/$BRANCH_NAME/$BUILD_NUMBER/pipeline"
-    GIT_API_URL = "https://api.github.com/repos/overleaf/${GIT_PROJECT}/statuses/$GIT_COMMIT"
-  }
-
-  triggers {
-    pollSCM('* * * * *')
-    cron(cron_string)
-  }
-
-  stages {
-
-    stage('Install') {
-      steps {
-        withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
-          sh "curl $GIT_API_URL \
-            --data '{ \
-            \"state\" : \"pending\", \
-            \"target_url\": \"$TARGET_URL\", \
-            \"description\": \"Your build is underway\", \
-            \"context\": \"ci/jenkins\" }' \
-            -u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
-        }
-      }
-    }
-
-    stage('Build') {
-      steps {
-        sh 'make build'
-      }
-    }
-
-    stage('Linting') {
-      steps {
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make format'
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make lint'
-      }
-    }
-
-    stage('Unit Tests') {
-      steps {
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_unit'
-      }
-    }
-
-    stage('Acceptance Tests') {
-      steps {
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
-      }
-    }
-
-    stage('Package and docker push') {
-      steps {
-        sh 'echo ${BUILD_NUMBER} > build_number.txt'
-        sh 'touch build.tar.gz' // Avoid tar warning about files changing during read
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make tar'
-        
-        withCredentials([file(credentialsId: 'gcr.io_overleaf-ops', variable: 'DOCKER_REPO_KEY_PATH')]) {
-          sh 'docker login -u _json_key --password-stdin https://gcr.io/overleaf-ops < ${DOCKER_REPO_KEY_PATH}'
-        }
-        sh 'DOCKER_REPO=gcr.io/overleaf-ops make publish'
-        sh 'docker logout https://gcr.io/overleaf-ops'
-        
-      }
-    }
-
-    stage('Publish to s3') {
-      steps {
-        sh 'echo ${BRANCH_NAME}-${BUILD_NUMBER} > build_number.txt'
-        withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
-            s3Upload(file:'build.tar.gz', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/${BUILD_NUMBER}.tar.gz")
-        }
-        withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
-            // The deployment process uses this file to figure out the latest build
-            s3Upload(file:'build_number.txt', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/latest")
-        }
-      }
-    }
-  }
-
-  post {
-    always {
-      sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_clean'
-      sh 'make clean'
-    }
-
-    success {
-      withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
-        sh "curl $GIT_API_URL \
-          --data '{ \
-          \"state\" : \"success\", \
-          \"target_url\": \"$TARGET_URL\", \
-          \"description\": \"Your build succeeded!\", \
-          \"context\": \"ci/jenkins\" }' \
-          -u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
-      }
-    }
-
-    failure {
-      mail(from: "${EMAIL_ALERT_FROM}",
-           to: "${EMAIL_ALERT_TO}",
-           subject: "Jenkins build failed: ${JOB_NAME}:${BUILD_NUMBER}",
-           body: "Build: ${BUILD_URL}")
-      withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
-        sh "curl $GIT_API_URL \
-          --data '{ \
-          \"state\" : \"failure\", \
-          \"target_url\": \"$TARGET_URL\", \
-          \"description\": \"Your build failed\", \
-          \"context\": \"ci/jenkins\" }' \
-          -u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
-      }
-    }
-  }
-
-  // The options directive is for configuration that applies to the whole job.
-  options {
-    // we'd like to make sure remove old builds, so we don't fill up our storage!
-    buildDiscarder(logRotator(numToKeepStr:'50'))
-
-    // And we'd really like to be sure that this build doesn't hang forever, so let's time it out after:
-    timeout(time: 30, unit: 'MINUTES')
-  }
-}

+ 37 - 12
services/chat/Makefile

@@ -1,11 +1,12 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.4.0
 
 BUILD_NUMBER ?= local
 BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
 PROJECT_NAME = chat
+BUILD_DIR_NAME = $(shell pwd | xargs basename | tr -cd '[a-zA-Z0-9_.\-]')
+
 DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
 DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \
 	BRANCH_NAME=$(BRANCH_NAME) \
@@ -13,39 +14,63 @@ DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \
 	MOCHA_GREP=${MOCHA_GREP} \
 	docker-compose ${DOCKER_COMPOSE_FLAGS}
 
+DOCKER_COMPOSE_TEST_ACCEPTANCE = \
+	COMPOSE_PROJECT_NAME=test_acceptance_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE)
+
+DOCKER_COMPOSE_TEST_UNIT = \
+	COMPOSE_PROJECT_NAME=test_unit_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE)
+
 clean:
 	docker rmi ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
 	docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
 
 format:
-	$(DOCKER_COMPOSE) run --rm test_unit npm run format
+	$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format
 
 format_fix:
-	$(DOCKER_COMPOSE) run --rm test_unit npm run format:fix
+	$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format:fix
 
 lint:
-	$(DOCKER_COMPOSE) run --rm test_unit npm run lint
+	$(DOCKER_COMPOSE) run --rm test_unit npm run --silent lint
 
 test: format lint test_unit test_acceptance
 
 test_unit:
-	@[ ! -d test/unit ] && echo "chat has no unit tests" || $(DOCKER_COMPOSE) run --rm test_unit
+ifneq (,$(wildcard test/unit))
+	$(DOCKER_COMPOSE_TEST_UNIT) run --rm test_unit
+	$(MAKE) test_unit_clean
+endif
+
+test_clean: test_unit_clean
+test_unit_clean:
+ifneq (,$(wildcard test/unit))
+	$(DOCKER_COMPOSE_TEST_UNIT) down -v -t 0
+endif
 
-test_acceptance: test_clean test_acceptance_pre_run test_acceptance_run
+test_acceptance: test_acceptance_clean test_acceptance_pre_run test_acceptance_run
+	$(MAKE) test_acceptance_clean
 
-test_acceptance_debug: test_clean test_acceptance_pre_run test_acceptance_run_debug
+test_acceptance_debug: test_acceptance_clean test_acceptance_pre_run test_acceptance_run_debug
+	$(MAKE) test_acceptance_clean
 
 test_acceptance_run:
-	@[ ! -d test/acceptance ] && echo "chat has no acceptance tests" || $(DOCKER_COMPOSE) run --rm test_acceptance
+ifneq (,$(wildcard test/acceptance))
+	$(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance
+endif
 
 test_acceptance_run_debug:
-	@[ ! -d test/acceptance ] && echo "chat has no acceptance tests" || $(DOCKER_COMPOSE) run -p 127.0.0.9:19999:19999 --rm test_acceptance npm run test:acceptance -- --inspect=0.0.0.0:19999 --inspect-brk
+ifneq (,$(wildcard test/acceptance))
+	$(DOCKER_COMPOSE_TEST_ACCEPTANCE) run -p 127.0.0.9:19999:19999 --rm test_acceptance npm run test:acceptance -- --inspect=0.0.0.0:19999 --inspect-brk
+endif
 
-test_clean:
-	$(DOCKER_COMPOSE) down -v -t 0
+test_clean: test_acceptance_clean
+test_acceptance_clean:
+	$(DOCKER_COMPOSE_TEST_ACCEPTANCE) down -v -t 0
 
 test_acceptance_pre_run:
-	@[ ! -f test/acceptance/js/scripts/pre-run ] && echo "chat has no pre acceptance tests task" || $(DOCKER_COMPOSE) run --rm test_acceptance test/acceptance/js/scripts/pre-run
+ifneq (,$(wildcard test/acceptance/js/scripts/pre-run))
+	$(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance test/acceptance/js/scripts/pre-run
+endif
 
 build:
 	docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \

+ 3 - 3
services/chat/app.js

@@ -15,14 +15,14 @@ if (!module.parent) {
   const port =
     __guard__(
       settings.internal != null ? settings.internal.chat : undefined,
-      x => x.port
+      (x) => x.port
     ) || 3010
   const host =
     __guard__(
       settings.internal != null ? settings.internal.chat : undefined,
-      x1 => x1.host
+      (x1) => x1.host
     ) || 'localhost'
-  Server.server.listen(port, host, function(error) {
+  Server.server.listen(port, host, function (error) {
     if (error != null) {
       throw error
     }

+ 2 - 2
services/chat/app/js/Features/Messages/MessageFormatter.js

@@ -31,7 +31,7 @@ module.exports = MessageFormatter = {
   },
 
   formatMessagesForClientSide(messages) {
-    return Array.from(messages).map(message =>
+    return Array.from(messages).map((message) =>
       this.formatMessageForClientSide(message)
     )
   },
@@ -44,7 +44,7 @@ module.exports = MessageFormatter = {
     }
 
     const threads = {}
-    const getThread = function(room) {
+    const getThread = function (room) {
       const thread_id = room.thread_id.toString()
       if (threads[thread_id] != null) {
         return threads[thread_id]

+ 27 - 21
services/chat/app/js/Features/Messages/MessageHttpController.js

@@ -53,12 +53,15 @@ module.exports = MessageHttpController = {
   getAllThreads(req, res, next) {
     const { project_id } = req.params
     logger.log({ project_id }, 'getting all threads')
-    return ThreadManager.findAllThreadRooms(project_id, function(error, rooms) {
+    return ThreadManager.findAllThreadRooms(project_id, function (
+      error,
+      rooms
+    ) {
       if (error != null) {
         return next(error)
       }
-      const room_ids = rooms.map(r => r._id)
-      return MessageManager.findAllMessagesInRooms(room_ids, function(
+      const room_ids = rooms.map((r) => r._id)
+      return MessageManager.findAllMessagesInRooms(room_ids, function (
         error,
         messages
       ) {
@@ -75,20 +78,23 @@ module.exports = MessageHttpController = {
     const { project_id, thread_id } = req.params
     const { user_id } = req.body
     logger.log({ user_id, project_id, thread_id }, 'marking thread as resolved')
-    return ThreadManager.resolveThread(project_id, thread_id, user_id, function(
-      error
-    ) {
-      if (error != null) {
-        return next(error)
+    return ThreadManager.resolveThread(
+      project_id,
+      thread_id,
+      user_id,
+      function (error) {
+        if (error != null) {
+          return next(error)
+        }
+        return res.sendStatus(204)
       }
-      return res.sendStatus(204)
-    })
+    )
   }, // No content
 
   reopenThread(req, res, next) {
     const { project_id, thread_id } = req.params
     logger.log({ project_id, thread_id }, 'reopening thread')
-    return ThreadManager.reopenThread(project_id, thread_id, function(error) {
+    return ThreadManager.reopenThread(project_id, thread_id, function (error) {
       if (error != null) {
         return next(error)
       }
@@ -99,14 +105,14 @@ module.exports = MessageHttpController = {
   deleteThread(req, res, next) {
     const { project_id, thread_id } = req.params
     logger.log({ project_id, thread_id }, 'deleting thread')
-    return ThreadManager.deleteThread(project_id, thread_id, function(
+    return ThreadManager.deleteThread(project_id, thread_id, function (
       error,
       room_id
     ) {
       if (error != null) {
         return next(error)
       }
-      return MessageManager.deleteAllMessagesInRoom(room_id, function(error) {
+      return MessageManager.deleteAllMessagesInRoom(room_id, function (error) {
         if (error != null) {
           return next(error)
         }
@@ -122,7 +128,7 @@ module.exports = MessageHttpController = {
       { project_id, thread_id, message_id, content },
       'editing message'
     )
-    return ThreadManager.findOrCreateThread(project_id, thread_id, function(
+    return ThreadManager.findOrCreateThread(project_id, thread_id, function (
       error,
       room
     ) {
@@ -134,7 +140,7 @@ module.exports = MessageHttpController = {
         message_id,
         content,
         Date.now(),
-        function(error) {
+        function (error) {
           if (error != null) {
             return next(error)
           }
@@ -147,14 +153,14 @@ module.exports = MessageHttpController = {
   deleteMessage(req, res, next) {
     const { project_id, thread_id, message_id } = req.params
     logger.log({ project_id, thread_id, message_id }, 'deleting message')
-    return ThreadManager.findOrCreateThread(project_id, thread_id, function(
+    return ThreadManager.findOrCreateThread(project_id, thread_id, function (
       error,
       room
     ) {
       if (error != null) {
         return next(error)
       }
-      return MessageManager.deleteMessage(room._id, message_id, function(
+      return MessageManager.deleteMessage(room._id, message_id, function (
         error,
         message
       ) {
@@ -187,7 +193,7 @@ module.exports = MessageHttpController = {
     return ThreadManager.findOrCreateThread(
       project_id,
       client_thread_id,
-      function(error, thread) {
+      function (error, thread) {
         if (error != null) {
           return next(error)
         }
@@ -196,7 +202,7 @@ module.exports = MessageHttpController = {
           user_id,
           content,
           Date.now(),
-          function(error, message) {
+          function (error, message) {
             if (error != null) {
               return next(error)
             }
@@ -229,7 +235,7 @@ module.exports = MessageHttpController = {
     return ThreadManager.findOrCreateThread(
       project_id,
       client_thread_id,
-      function(error, thread) {
+      function (error, thread) {
         if (error != null) {
           return next(error)
         }
@@ -242,7 +248,7 @@ module.exports = MessageHttpController = {
           thread_object_id,
           limit,
           before,
-          function(error, messages) {
+          function (error, messages) {
             if (error != null) {
               return next(error)
             }

+ 10 - 13
services/chat/app/js/Features/Messages/MessageManager.js

@@ -23,7 +23,7 @@ const logger = require('logger-sharelatex')
 module.exports = MessageManager = {
   createMessage(room_id, user_id, content, timestamp, callback) {
     if (callback == null) {
-      callback = function(error, message) {}
+      callback = function (error, message) {}
     }
     let newMessageOpts = {
       content,
@@ -37,23 +37,20 @@ module.exports = MessageManager = {
 
   getMessages(room_id, limit, before, callback) {
     if (callback == null) {
-      callback = function(error, messages) {}
+      callback = function (error, messages) {}
     }
     let query = { room_id }
     if (before != null) {
       query.timestamp = { $lt: before }
     }
     query = this._ensureIdsAreObjectIds(query)
-    const cursor = db.messages
-      .find(query)
-      .sort({ timestamp: -1 })
-      .limit(limit)
+    const cursor = db.messages.find(query).sort({ timestamp: -1 }).limit(limit)
     return cursor.toArray(callback)
   },
 
   findAllMessagesInRooms(room_ids, callback) {
     if (callback == null) {
-      callback = function(error, messages) {}
+      callback = function (error, messages) {}
     }
     return db.messages.find(
       {
@@ -65,7 +62,7 @@ module.exports = MessageManager = {
 
   deleteAllMessagesInRoom(room_id, callback) {
     if (callback == null) {
-      callback = function(error) {}
+      callback = function (error) {}
     }
     return db.messages.remove(
       {
@@ -77,7 +74,7 @@ module.exports = MessageManager = {
 
   updateMessage(room_id, message_id, content, timestamp, callback) {
     if (callback == null) {
-      callback = function(error, message) {}
+      callback = function (error, message) {}
     }
     const query = this._ensureIdsAreObjectIds({
       _id: message_id,
@@ -91,7 +88,7 @@ module.exports = MessageManager = {
           edited_at: timestamp
         }
       },
-      function(error) {
+      function (error) {
         if (error != null) {
           return callback(error)
         }
@@ -102,13 +99,13 @@ module.exports = MessageManager = {
 
   deleteMessage(room_id, message_id, callback) {
     if (callback == null) {
-      callback = function(error) {}
+      callback = function (error) {}
     }
     const query = this._ensureIdsAreObjectIds({
       _id: message_id,
       room_id
     })
-    return db.messages.remove(query, function(error) {
+    return db.messages.remove(query, function (error) {
       if (error != null) {
         return callback(error)
       }
@@ -135,7 +132,7 @@ module.exports = MessageManager = {
   'findAllMessagesInRooms',
   'updateMessage',
   'deleteMessage'
-].map(method =>
+].map((method) =>
   metrics.timeAsyncMethod(
     MessageManager,
     method,

+ 10 - 10
services/chat/app/js/Features/Threads/ThreadManager.js

@@ -24,7 +24,7 @@ module.exports = ThreadManager = {
   findOrCreateThread(project_id, thread_id, callback) {
     let query, update
     if (callback == null) {
-      callback = function(error, thread) {}
+      callback = function (error, thread) {}
     }
     project_id = ObjectId(project_id.toString())
     if (thread_id !== ThreadManager.GLOBAL_THREAD) {
@@ -50,13 +50,13 @@ module.exports = ThreadManager = {
       }
     }
 
-    return db.rooms.update(query, { $set: update }, { upsert: true }, function(
+    return db.rooms.update(query, { $set: update }, { upsert: true }, function (
       error
     ) {
       if (error != null) {
         return callback(error)
       }
-      return db.rooms.find(query, function(error, rooms) {
+      return db.rooms.find(query, function (error, rooms) {
         if (rooms == null) {
           rooms = []
         }
@@ -70,7 +70,7 @@ module.exports = ThreadManager = {
 
   findAllThreadRooms(project_id, callback) {
     if (callback == null) {
-      callback = function(error, rooms) {}
+      callback = function (error, rooms) {}
     }
     return db.rooms.find(
       {
@@ -87,7 +87,7 @@ module.exports = ThreadManager = {
 
   resolveThread(project_id, thread_id, user_id, callback) {
     if (callback == null) {
-      callback = function(error) {}
+      callback = function (error) {}
     }
     return db.rooms.update(
       {
@@ -108,7 +108,7 @@ module.exports = ThreadManager = {
 
   reopenThread(project_id, thread_id, callback) {
     if (callback == null) {
-      callback = function(error) {}
+      callback = function (error) {}
     }
     return db.rooms.update(
       {
@@ -126,9 +126,9 @@ module.exports = ThreadManager = {
 
   deleteThread(project_id, thread_id, callback) {
     if (callback == null) {
-      callback = function(error, room_id) {}
+      callback = function (error, room_id) {}
     }
-    return this.findOrCreateThread(project_id, thread_id, function(
+    return this.findOrCreateThread(project_id, thread_id, function (
       error,
       room
     ) {
@@ -139,7 +139,7 @@ module.exports = ThreadManager = {
         {
           _id: room._id
         },
-        function(error) {
+        function (error) {
           if (error != null) {
             return callback(error)
           }
@@ -155,6 +155,6 @@ module.exports = ThreadManager = {
   'resolveThread',
   'reopenThread',
   'deleteThread'
-].map(method =>
+].map((method) =>
   metrics.timeAsyncMethod(ThreadManager, method, 'mongo.ThreadManager', logger)
 )

+ 2 - 2
services/chat/app/js/router.js

@@ -16,7 +16,7 @@ const { ObjectId } = require('./mongojs')
 
 module.exports = Router = {
   route(app) {
-    app.param('project_id', function(req, res, next, project_id) {
+    app.param('project_id', function (req, res, next, project_id) {
       if (ObjectId.isValid(project_id)) {
         return next()
       } else {
@@ -24,7 +24,7 @@ module.exports = Router = {
       }
     })
 
-    app.param('thread_id', function(req, res, next, thread_id) {
+    app.param('thread_id', function (req, res, next, thread_id) {
       if (ObjectId.isValid(thread_id)) {
         return next()
       } else {

+ 1 - 3
services/chat/buildscript.txt

@@ -1,10 +1,8 @@
 chat
---acceptance-creds=None
 --dependencies=mongo
 --docker-repos=gcr.io/overleaf-ops
 --env-add=
 --env-pass-through=
---language=es
 --node-version=10.21.0
 --public-repo=False
---script-version=1.4.0
+--script-version=3.3.2

+ 3 - 2
services/chat/config/settings.defaults.js

@@ -8,8 +8,9 @@ module.exports = {
 
   apis: {
     web: {
-      url: `http://${process.env.WEB_HOST || 'localhost'}:${process.env
-        .WEB_PORT || 3000}`,
+      url: `http://${process.env.WEB_HOST || 'localhost'}:${
+        process.env.WEB_PORT || 3000
+      }`,
       user: process.env.WEB_API_USER || 'sharelatex',
       pass: process.env.WEB_API_PASSWORD || 'password'
     }

+ 3 - 2
services/chat/docker-compose.ci.yml

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.4.0
 
 version: "2.3"
 
@@ -12,6 +11,7 @@ services:
     command: npm run test:unit:_run
     environment:
       NODE_ENV: test
+      NODE_OPTIONS: "--unhandled-rejections=strict"
 
 
   test_acceptance:
@@ -24,6 +24,7 @@ services:
       POSTGRES_HOST: postgres
       MOCHA_GREP: ${MOCHA_GREP}
       NODE_ENV: test
+      NODE_OPTIONS: "--unhandled-rejections=strict"
     depends_on:
       mongo:
         condition: service_healthy
@@ -39,4 +40,4 @@ services:
     command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs .
     user: root
   mongo:
-    image: mongo:3.6
+    image: mongo:4.0

+ 5 - 4
services/chat/docker-compose.yml

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.4.0
 
 version: "2.3"
 
@@ -14,7 +13,8 @@ services:
     environment:
       MOCHA_GREP: ${MOCHA_GREP}
       NODE_ENV: test
-    command: npm run test:unit
+      NODE_OPTIONS: "--unhandled-rejections=strict"
+    command: npm run --silent test:unit
     user: node
 
   test_acceptance:
@@ -30,12 +30,13 @@ services:
       MOCHA_GREP: ${MOCHA_GREP}
       LOG_LEVEL: ERROR
       NODE_ENV: test
+      NODE_OPTIONS: "--unhandled-rejections=strict"
     user: node
     depends_on:
       mongo:
         condition: service_healthy
-    command: npm run test:acceptance
+    command: npm run --silent test:acceptance
 
   mongo:
-    image: mongo:3.6
+    image: mongo:4.0
 

+ 0 - 1
services/chat/nodemon.json

@@ -8,7 +8,6 @@
   "execMap": {
     "js": "npm run start"
   },
-
   "watch": [
     "app/js/",
     "app.js",

+ 285 - 123
services/chat/package-lock.json

@@ -134,6 +134,24 @@
         "google-auth-library": "^5.5.0",
         "retry-request": "^4.0.0",
         "teeny-request": "^6.0.0"
+      },
+      "dependencies": {
+        "google-auth-library": {
+          "version": "5.10.1",
+          "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
+          "integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
+          "requires": {
+            "arrify": "^2.0.0",
+            "base64-js": "^1.3.0",
+            "ecdsa-sig-formatter": "^1.0.11",
+            "fast-text-encoding": "^1.0.0",
+            "gaxios": "^2.1.0",
+            "gcp-metadata": "^3.4.0",
+            "gtoken": "^4.1.0",
+            "jws": "^4.0.0",
+            "lru-cache": "^5.0.0"
+          }
+        }
       }
     },
     "@google-cloud/debug-agent": {
@@ -336,9 +354,9 @@
       }
     },
     "@google-cloud/logging": {
-      "version": "7.2.3",
-      "resolved": "https://registry.npmjs.org/@google-cloud/logging/-/logging-7.2.3.tgz",
-      "integrity": "sha512-MLAlYVBihCs0e581n9VUYOPJcrSpwSdL7KAjy2wgQidmRD9aWjvg97F22JMCtvrUiFBmAjiJVtn1JyNIXlv0Yw==",
+      "version": "7.3.0",
+      "resolved": "https://registry.npmjs.org/@google-cloud/logging/-/logging-7.3.0.tgz",
+      "integrity": "sha512-xTW1V4MKpYC0mjSugyuiyUoZ9g6A42IhrrO3z7Tt3SmAb2IRj2Gf4RLoguKKncs340ooZFXrrVN/++t2Aj5zgg==",
       "requires": {
         "@google-cloud/common": "^2.2.2",
         "@google-cloud/paginator": "^2.0.0",
@@ -358,7 +376,7 @@
         "snakecase-keys": "^3.0.0",
         "stream-events": "^1.0.4",
         "through2": "^3.0.0",
-        "type-fest": "^0.11.0"
+        "type-fest": "^0.12.0"
       },
       "dependencies": {
         "dot-prop": {
@@ -369,25 +387,41 @@
             "is-obj": "^2.0.0"
           }
         },
+        "google-auth-library": {
+          "version": "5.10.1",
+          "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
+          "integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
+          "requires": {
+            "arrify": "^2.0.0",
+            "base64-js": "^1.3.0",
+            "ecdsa-sig-formatter": "^1.0.11",
+            "fast-text-encoding": "^1.0.0",
+            "gaxios": "^2.1.0",
+            "gcp-metadata": "^3.4.0",
+            "gtoken": "^4.1.0",
+            "jws": "^4.0.0",
+            "lru-cache": "^5.0.0"
+          }
+        },
         "is-obj": {
           "version": "2.0.0",
           "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
           "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="
         },
         "type-fest": {
-          "version": "0.11.0",
-          "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz",
-          "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ=="
+          "version": "0.12.0",
+          "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.12.0.tgz",
+          "integrity": "sha512-53RyidyjvkGpnWPMF9bQgFtWp+Sl8O2Rp13VavmJgfAP9WWG6q6TkrKU8iyJdnwnfgHI6k2hTlgqH4aSdjoTbg=="
         }
       }
     },
     "@google-cloud/logging-bunyan": {
-      "version": "2.0.3",
-      "resolved": "https://registry.npmjs.org/@google-cloud/logging-bunyan/-/logging-bunyan-2.0.3.tgz",
-      "integrity": "sha512-8n9MwsCRd4v8WZg17+d3m7qInud7lYTm5rpwXHY0/lzWEJYjeiztT09BiCYh56EEhHr+ynymJnzUDZKazkywlg==",
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/@google-cloud/logging-bunyan/-/logging-bunyan-3.0.0.tgz",
+      "integrity": "sha512-ZLVXEejNQ27ktGcA3S/sd7GPefp7kywbn+/KoBajdb1Syqcmtc98jhXpYQBXVtNP2065iyu77s4SBaiYFbTC5A==",
       "requires": {
         "@google-cloud/logging": "^7.0.0",
-        "google-auth-library": "^5.0.0"
+        "google-auth-library": "^6.0.0"
       }
     },
     "@google-cloud/paginator": {
@@ -771,9 +805,9 @@
       }
     },
     "@grpc/grpc-js": {
-      "version": "0.6.18",
-      "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-0.6.18.tgz",
-      "integrity": "sha512-uAzv/tM8qpbf1vpx1xPMfcUMzbfdqJtdCYAqY/LsLeQQlnTb4vApylojr+wlCyr7bZeg3AFfHvtihnNOQQt/nA==",
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.0.5.tgz",
+      "integrity": "sha512-Hm+xOiqAhcpT9RYM8lc15dbQD7aQurM7ZU8ulmulepiPlN7iwBXXwP3vSBUimoFoApRqz7pSIisXU8pZaCB4og==",
       "requires": {
         "semver": "^6.2.0"
       },
@@ -786,9 +820,9 @@
       }
     },
     "@grpc/proto-loader": {
-      "version": "0.5.3",
-      "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.3.tgz",
-      "integrity": "sha512-8qvUtGg77G2ZT2HqdqYoM/OY97gQd/0crSG34xNmZ4ZOsv3aQT/FQV9QfZPazTGna6MIoyUd+u6AxsoZjJ/VMQ==",
+      "version": "0.5.5",
+      "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.5.tgz",
+      "integrity": "sha512-WwN9jVNdHRQoOBo9FDH7qU+mgfjPc8GygPYms3M+y3fbQLfnCe/Kv/E01t7JRgnrsOHH8euvSbed3mIalXhwqQ==",
       "requires": {
         "lodash.camelcase": "^4.3.0",
         "protobufjs": "^6.8.6"
@@ -824,9 +858,9 @@
       }
     },
     "@overleaf/o-error": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/@overleaf/o-error/-/o-error-2.1.0.tgz",
-      "integrity": "sha512-Zd9sks9LrLw8ErHt/cXeWIkyxWAqNAvNGn7wIjLQJH6TTEEW835PWOhpch+hQwwWsTxWIx/JDj+IpZ3ouw925g=="
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/@overleaf/o-error/-/o-error-3.0.0.tgz",
+      "integrity": "sha512-LsM2s6Iy9G97ktPo0ys4VxtI/m3ahc1ZHwjo5XnhXtjeIkkkVAehsrcRRoV/yWepPjymB0oZonhcfojpjYR/tg=="
     },
     "@protobufjs/aspromise": {
       "version": "1.1.2",
@@ -933,9 +967,9 @@
       "dev": true
     },
     "@tootallnate/once": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.0.0.tgz",
-      "integrity": "sha512-KYyTT/T6ALPkIRd2Ge080X/BsXvy9O0hcWTtMWkPvwAwF99+vn6Dv4GzrFT/Nn1LePr+FFDbRXXlqmsy9lw2zA=="
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
+      "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw=="
     },
     "@types/caseless": {
       "version": "0.12.2",
@@ -968,9 +1002,9 @@
       "dev": true
     },
     "@types/fs-extra": {
-      "version": "8.1.0",
-      "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.0.tgz",
-      "integrity": "sha512-UoOfVEzAUpeSPmjm7h1uk5MH6KZma2z2O7a75onTGjnNvAvMVrPzPL/vBbT65iIGHWj6rokwfmYcmxmlSf2uwg==",
+      "version": "8.1.1",
+      "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.1.tgz",
+      "integrity": "sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w==",
       "requires": {
         "@types/node": "*"
       }
@@ -1113,9 +1147,9 @@
       "dev": true
     },
     "agent-base": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz",
-      "integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==",
+      "version": "6.0.1",
+      "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.1.tgz",
+      "integrity": "sha512-01q25QQDwLSsyfhrKbn8yuur+JNw0H+0Y4JiGIKd3z9aYk/w/2kxD/Upc+t2ZBBSUNff50VjPsSW2YxM8QYKVg==",
       "requires": {
         "debug": "4"
       },
@@ -1472,6 +1506,7 @@
       "version": "1.8.12",
       "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.12.tgz",
       "integrity": "sha1-8VDw9nSKvdcq6uhPBEA74u8RN5c=",
+      "dev": true,
       "requires": {
         "dtrace-provider": "~0.8",
         "moment": "^2.10.6",
@@ -1583,6 +1618,11 @@
       "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
       "dev": true
     },
+    "charenc": {
+      "version": "0.0.2",
+      "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
+      "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
+    },
     "check-error": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
@@ -1861,6 +1901,11 @@
         }
       }
     },
+    "crypt": {
+      "version": "0.0.2",
+      "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
+      "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
+    },
     "crypto-random-string": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz",
@@ -3007,9 +3052,9 @@
       "dev": true
     },
     "gaxios": {
-      "version": "2.3.2",
-      "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-2.3.2.tgz",
-      "integrity": "sha512-K/+py7UvKRDaEwEKlLiRKrFr+wjGjsMz5qH7Vs549QJS7cpSCOT/BbWL7pzqECflc46FcNPipjSfB+V1m8PAhw==",
+      "version": "2.3.4",
+      "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-2.3.4.tgz",
+      "integrity": "sha512-US8UMj8C5pRnao3Zykc4AAVr+cffoNKRTg9Rsf2GiuZCW69vgJj38VK2PzlPuQU73FZ/nTk9/Av6/JGcE1N9vA==",
       "requires": {
         "abort-controller": "^3.0.0",
         "extend": "^3.0.2",
@@ -3117,27 +3162,100 @@
       }
     },
     "google-auth-library": {
-      "version": "5.10.1",
-      "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
-      "integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
+      "version": "6.0.6",
+      "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.0.6.tgz",
+      "integrity": "sha512-fWYdRdg55HSJoRq9k568jJA1lrhg9i2xgfhVIMJbskUmbDpJGHsbv9l41DGhCDXM21F9Kn4kUwdysgxSYBYJUw==",
       "requires": {
         "arrify": "^2.0.0",
         "base64-js": "^1.3.0",
         "ecdsa-sig-formatter": "^1.0.11",
         "fast-text-encoding": "^1.0.0",
-        "gaxios": "^2.1.0",
-        "gcp-metadata": "^3.4.0",
-        "gtoken": "^4.1.0",
+        "gaxios": "^3.0.0",
+        "gcp-metadata": "^4.1.0",
+        "gtoken": "^5.0.0",
         "jws": "^4.0.0",
-        "lru-cache": "^5.0.0"
+        "lru-cache": "^6.0.0"
+      },
+      "dependencies": {
+        "bignumber.js": {
+          "version": "9.0.0",
+          "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
+          "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
+        },
+        "gaxios": {
+          "version": "3.1.0",
+          "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-3.1.0.tgz",
+          "integrity": "sha512-DDTn3KXVJJigtz+g0J3vhcfbDbKtAroSTxauWsdnP57sM5KZ3d2c/3D9RKFJ86s43hfw6WULg6TXYw/AYiBlpA==",
+          "requires": {
+            "abort-controller": "^3.0.0",
+            "extend": "^3.0.2",
+            "https-proxy-agent": "^5.0.0",
+            "is-stream": "^2.0.0",
+            "node-fetch": "^2.3.0"
+          }
+        },
+        "gcp-metadata": {
+          "version": "4.1.4",
+          "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.1.4.tgz",
+          "integrity": "sha512-5J/GIH0yWt/56R3dNaNWPGQ/zXsZOddYECfJaqxFWgrZ9HC2Kvc5vl9upOgUUHKzURjAVf2N+f6tEJiojqXUuA==",
+          "requires": {
+            "gaxios": "^3.0.0",
+            "json-bigint": "^1.0.0"
+          }
+        },
+        "google-p12-pem": {
+          "version": "3.0.2",
+          "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.2.tgz",
+          "integrity": "sha512-tbjzndQvSIHGBLzHnhDs3cL4RBjLbLXc2pYvGH+imGVu5b4RMAttUTdnmW2UH0t11QeBTXZ7wlXPS7hrypO/tg==",
+          "requires": {
+            "node-forge": "^0.9.0"
+          }
+        },
+        "gtoken": {
+          "version": "5.0.3",
+          "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.0.3.tgz",
+          "integrity": "sha512-Nyd1wZCMRc2dj/mAD0LlfQLcAO06uKdpKJXvK85SGrF5+5+Bpfil9u/2aw35ltvEHjvl0h5FMKN5knEU+9JrOg==",
+          "requires": {
+            "gaxios": "^3.0.0",
+            "google-p12-pem": "^3.0.0",
+            "jws": "^4.0.0",
+            "mime": "^2.2.0"
+          }
+        },
+        "is-stream": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
+          "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw=="
+        },
+        "json-bigint": {
+          "version": "1.0.0",
+          "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
+          "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
+          "requires": {
+            "bignumber.js": "^9.0.0"
+          }
+        },
+        "lru-cache": {
+          "version": "6.0.0",
+          "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+          "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+          "requires": {
+            "yallist": "^4.0.0"
+          }
+        },
+        "yallist": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+          "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
+        }
       }
     },
     "google-gax": {
-      "version": "1.14.2",
-      "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-1.14.2.tgz",
-      "integrity": "sha512-Nde+FdqALbV3QgMA4KlkxOHfrj9busnZ3EECwy/1gDJm9vhKGwDLWzErqRU5g80OoGSAMgyY7DWIfqz7ina4Jw==",
+      "version": "1.15.3",
+      "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-1.15.3.tgz",
+      "integrity": "sha512-3JKJCRumNm3x2EksUTw4P1Rad43FTpqrtW9jzpf3xSMYXx+ogaqTM1vGo7VixHB4xkAyATXVIa3OcNSh8H9zsQ==",
       "requires": {
-        "@grpc/grpc-js": "^0.6.18",
+        "@grpc/grpc-js": "~1.0.3",
         "@grpc/proto-loader": "^0.5.1",
         "@types/fs-extra": "^8.0.1",
         "@types/long": "^4.0.0",
@@ -3148,12 +3266,53 @@
         "lodash.at": "^4.6.0",
         "lodash.has": "^4.5.2",
         "node-fetch": "^2.6.0",
-        "protobufjs": "^6.8.8",
+        "protobufjs": "^6.8.9",
         "retry-request": "^4.0.0",
         "semver": "^6.0.0",
         "walkdir": "^0.4.0"
       },
       "dependencies": {
+        "@types/node": {
+          "version": "13.13.15",
+          "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.15.tgz",
+          "integrity": "sha512-kwbcs0jySLxzLsa2nWUAGOd/s21WU1jebrEdtzhsj1D4Yps1EOuyI1Qcu+FD56dL7NRNIJtDDjcqIG22NwkgLw=="
+        },
+        "google-auth-library": {
+          "version": "5.10.1",
+          "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
+          "integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
+          "requires": {
+            "arrify": "^2.0.0",
+            "base64-js": "^1.3.0",
+            "ecdsa-sig-formatter": "^1.0.11",
+            "fast-text-encoding": "^1.0.0",
+            "gaxios": "^2.1.0",
+            "gcp-metadata": "^3.4.0",
+            "gtoken": "^4.1.0",
+            "jws": "^4.0.0",
+            "lru-cache": "^5.0.0"
+          }
+        },
+        "protobufjs": {
+          "version": "6.10.1",
+          "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.1.tgz",
+          "integrity": "sha512-pb8kTchL+1Ceg4lFd5XUpK8PdWacbvV5SK2ULH2ebrYtl4GjJmS24m6CKME67jzV53tbJxHlnNOSqQHbTsR9JQ==",
+          "requires": {
+            "@protobufjs/aspromise": "^1.1.2",
+            "@protobufjs/base64": "^1.1.2",
+            "@protobufjs/codegen": "^2.0.4",
+            "@protobufjs/eventemitter": "^1.1.0",
+            "@protobufjs/fetch": "^1.1.0",
+            "@protobufjs/float": "^1.0.2",
+            "@protobufjs/inquire": "^1.1.0",
+            "@protobufjs/path": "^1.1.2",
+            "@protobufjs/pool": "^1.1.0",
+            "@protobufjs/utf8": "^1.1.0",
+            "@types/long": "^4.0.1",
+            "@types/node": "^13.7.0",
+            "long": "^4.0.0"
+          }
+        },
         "semver": {
           "version": "6.3.0",
           "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@@ -4074,44 +4233,33 @@
       }
     },
     "logger-sharelatex": {
-      "version": "1.9.1",
-      "resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-1.9.1.tgz",
-      "integrity": "sha512-9s6JQnH/PN+Js2CmI8+J3MQCTNlRzP2Dh4pcekXrV6Jm5J4HzyPi+6d3zfBskZ4NBmaUVw9hC4p5dmdaRmh4mQ==",
-      "requires": {
-        "@google-cloud/logging-bunyan": "^2.0.0",
-        "@overleaf/o-error": "^2.0.0",
-        "bunyan": "1.8.12",
-        "raven": "1.1.3",
-        "request": "2.88.0",
-        "yn": "^3.1.1"
+      "version": "2.2.0",
+      "resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-2.2.0.tgz",
+      "integrity": "sha512-ko+OmE25XHJJCiz1R9EgwlfM7J/5olpunUfR3WcfuqOQrcUqsdBrDA2sOytngT0ViwjCR0Fh4qZVPwEWfmrvwA==",
+      "requires": {
+        "@google-cloud/logging-bunyan": "^3.0.0",
+        "@overleaf/o-error": "^3.0.0",
+        "bunyan": "^1.8.14",
+        "node-fetch": "^2.6.0",
+        "raven": "^2.6.4",
+        "yn": "^4.0.0"
       },
       "dependencies": {
-        "request": {
-          "version": "2.88.0",
-          "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
-          "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
-          "requires": {
-            "aws-sign2": "~0.7.0",
-            "aws4": "^1.8.0",
-            "caseless": "~0.12.0",
-            "combined-stream": "~1.0.6",
-            "extend": "~3.0.2",
-            "forever-agent": "~0.6.1",
-            "form-data": "~2.3.2",
-            "har-validator": "~5.1.0",
-            "http-signature": "~1.2.0",
-            "is-typedarray": "~1.0.0",
-            "isstream": "~0.1.2",
-            "json-stringify-safe": "~5.0.1",
-            "mime-types": "~2.1.19",
-            "oauth-sign": "~0.9.0",
-            "performance-now": "^2.1.0",
-            "qs": "~6.5.2",
-            "safe-buffer": "^5.1.2",
-            "tough-cookie": "~2.4.3",
-            "tunnel-agent": "^0.6.0",
-            "uuid": "^3.3.2"
+        "bunyan": {
+          "version": "1.8.14",
+          "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.14.tgz",
+          "integrity": "sha512-LlahJUxXzZLuw/hetUQJmRgZ1LF6+cr5TPpRj6jf327AsiIq2jhYEH4oqUUkVKTor+9w2BT3oxVwhzE5lw9tcg==",
+          "requires": {
+            "dtrace-provider": "~0.8",
+            "moment": "^2.19.3",
+            "mv": "~2",
+            "safe-json-stringify": "~1"
           }
+        },
+        "yn": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/yn/-/yn-4.0.0.tgz",
+          "integrity": "sha512-huWiiCS4TxKc4SfgmTwW1K7JmXPPAmuXWYy4j9qjQo4+27Kni8mGhAAi1cloRWmBe2EqcLgt3IGqQoRL/MtPgg=="
         }
       }
     },
@@ -4199,11 +4347,6 @@
         }
       }
     },
-    "lsmod": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/lsmod/-/lsmod-1.0.0.tgz",
-      "integrity": "sha1-mgD3bco26yP6BTUK/htYXUKZ5ks="
-    },
     "lynx": {
       "version": "0.1.1",
       "resolved": "https://registry.npmjs.org/lynx/-/lynx-0.1.1.tgz",
@@ -4245,6 +4388,23 @@
       "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.1.0.tgz",
       "integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g=="
     },
+    "md5": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
+      "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
+      "requires": {
+        "charenc": "0.0.2",
+        "crypt": "0.0.2",
+        "is-buffer": "~1.1.6"
+      },
+      "dependencies": {
+        "is-buffer": {
+          "version": "1.1.6",
+          "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+          "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
+        }
+      }
+    },
     "media-typer": {
       "version": "0.3.0",
       "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@@ -5152,9 +5312,9 @@
       "dev": true
     },
     "prettier": {
-      "version": "1.19.1",
-      "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
-      "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
+      "version": "2.0.5",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz",
+      "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==",
       "dev": true
     },
     "prettier-eslint": {
@@ -5397,6 +5557,12 @@
             "mimic-fn": "^1.0.0"
           }
         },
+        "prettier": {
+          "version": "1.19.1",
+          "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
+          "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
+          "dev": true
+        },
         "restore-cursor": {
           "version": "2.0.0",
           "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
@@ -5886,21 +6052,26 @@
       "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
     },
     "raven": {
-      "version": "1.1.3",
-      "resolved": "https://registry.npmjs.org/raven/-/raven-1.1.3.tgz",
-      "integrity": "sha1-QnPBrm005CMPUbLAEEGjK5Iygio=",
+      "version": "2.6.4",
+      "resolved": "https://registry.npmjs.org/raven/-/raven-2.6.4.tgz",
+      "integrity": "sha512-6PQdfC4+DQSFncowthLf+B6Hr0JpPsFBgTVYTAOq7tCmx/kR4SXbeawtPch20+3QfUcQDoJBLjWW1ybvZ4kXTw==",
       "requires": {
         "cookie": "0.3.1",
-        "json-stringify-safe": "5.0.1",
-        "lsmod": "1.0.0",
-        "stack-trace": "0.0.9",
-        "uuid": "3.0.0"
+        "md5": "^2.2.1",
+        "stack-trace": "0.0.10",
+        "timed-out": "4.0.1",
+        "uuid": "3.3.2"
       },
       "dependencies": {
+        "stack-trace": {
+          "version": "0.0.10",
+          "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
+          "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
+        },
         "uuid": {
-          "version": "3.0.0",
-          "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.0.tgz",
-          "integrity": "sha1-Zyj8BFnEUNeWqZwxg3VpvfZy1yg="
+          "version": "3.3.2",
+          "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
+          "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
         }
       }
     },
@@ -6407,9 +6578,9 @@
       }
     },
     "snakecase-keys": {
-      "version": "3.1.2",
-      "resolved": "https://registry.npmjs.org/snakecase-keys/-/snakecase-keys-3.1.2.tgz",
-      "integrity": "sha512-NrzHj8ctStnd1LYx3+L4buS7yildFum7WAbQQxkhPCNi3Qeqv7hoBne2c9n++HWxDG9Nv23pNEyyLCITZTv24Q==",
+      "version": "3.2.0",
+      "resolved": "https://registry.npmjs.org/snakecase-keys/-/snakecase-keys-3.2.0.tgz",
+      "integrity": "sha512-WTJ0NhCH/37J+PU3fuz0x5b6TvtWQChTcKPOndWoUy0pteKOe0hrHMzSRsJOWSIP48EQkzUEsgQPmrG3W8pFNQ==",
       "requires": {
         "map-obj": "^4.0.0",
         "to-snake-case": "^1.0.0"
@@ -6494,7 +6665,8 @@
     "stack-trace": {
       "version": "0.0.9",
       "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
-      "integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU="
+      "integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=",
+      "dev": true
     },
     "statsd-parser": {
       "version": "0.0.4",
@@ -6669,15 +6841,22 @@
       }
     },
     "teeny-request": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-6.0.2.tgz",
-      "integrity": "sha512-B6fxA0fSnY/bul06NggdN1nywtr5U5Uvt96pHfTi8pi4MNe6++VUWcAAFBrcMeha94s+gULwA5WvagoSZ+AcYg==",
+      "version": "6.0.3",
+      "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-6.0.3.tgz",
+      "integrity": "sha512-TZG/dfd2r6yeji19es1cUIwAlVD8y+/svB1kAC2Y0bjEyysrfbO8EZvJBRwIE6WkwmUoB7uvWLwTIhJbMXZ1Dw==",
       "requires": {
         "http-proxy-agent": "^4.0.0",
         "https-proxy-agent": "^5.0.0",
         "node-fetch": "^2.2.0",
         "stream-events": "^1.0.5",
-        "uuid": "^3.3.2"
+        "uuid": "^7.0.0"
+      },
+      "dependencies": {
+        "uuid": {
+          "version": "7.0.3",
+          "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",
+          "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg=="
+        }
       }
     },
     "term-size": {
@@ -6801,8 +6980,7 @@
     "timed-out": {
       "version": "4.0.1",
       "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
-      "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=",
-      "dev": true
+      "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8="
     },
     "timekeeper": {
       "version": "2.2.0",
@@ -6873,22 +7051,6 @@
         "nopt": "~1.0.10"
       }
     },
-    "tough-cookie": {
-      "version": "2.4.3",
-      "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
-      "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
-      "requires": {
-        "psl": "^1.1.24",
-        "punycode": "^1.4.1"
-      },
-      "dependencies": {
-        "punycode": {
-          "version": "1.4.1",
-          "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
-          "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
-        }
-      }
-    },
     "tslib": {
       "version": "1.11.1",
       "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",

+ 3 - 2
services/chat/package.json

@@ -13,7 +13,7 @@
     "nodemon": "nodemon --config nodemon.json",
     "test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
     "test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
-    "lint": "node_modules/.bin/eslint .",
+    "lint": "node_modules/.bin/eslint --max-warnings 0 .",
     "format": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --list-different",
     "format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
   },
@@ -22,7 +22,7 @@
     "body-parser": "^1.19.0",
     "errorhandler": "^1.5.1",
     "express": "4.17.1",
-    "logger-sharelatex": "^1.9.1",
+    "logger-sharelatex": "^2.2.0",
     "metrics-sharelatex": "^2.5.0",
     "mongojs": "3.1.0",
     "request": "^2.88.2",
@@ -46,6 +46,7 @@
     "eslint-plugin-standard": "^4.0.1",
     "mocha": "^7.1.0",
     "nodemon": "^2.0.2",
+    "prettier": "^2.0.0",
     "prettier-eslint-cli": "^5.0.0",
     "sandboxed-module": "^2.0.3",
     "sinon": "^9.0.0",

+ 5 - 5
services/chat/test/acceptance/js/DeletingAMessageTests.js

@@ -14,16 +14,16 @@ const { expect } = require('chai')
 const ChatClient = require('./helpers/ChatClient')
 const ChatApp = require('./helpers/ChatApp')
 
-describe('Deleting a message', function() {
-  before(function(done) {
+describe('Deleting a message', function () {
+  before(function (done) {
     this.project_id = ObjectId().toString()
     this.user_id = ObjectId().toString()
     this.thread_id = ObjectId().toString()
     return ChatApp.ensureRunning(done)
   })
 
-  return describe('in a thread', function() {
-    before(function(done) {
+  return describe('in a thread', function () {
+    before(function (done) {
       return ChatClient.sendMessage(
         this.project_id,
         this.thread_id,
@@ -58,7 +58,7 @@ describe('Deleting a message', function() {
       )
     })
 
-    return it('should then remove the message from the threads', function(done) {
+    return it('should then remove the message from the threads', function (done) {
       return ChatClient.getThreads(
         this.project_id,
         (error, response, threads) => {

+ 5 - 5
services/chat/test/acceptance/js/DeletingAThreadTests.js

@@ -16,15 +16,15 @@ const crypto = require('crypto')
 const ChatClient = require('./helpers/ChatClient')
 const ChatApp = require('./helpers/ChatApp')
 
-describe('Deleting a thread', function() {
-  before(function(done) {
+describe('Deleting a thread', function () {
+  before(function (done) {
     this.project_id = ObjectId().toString()
     this.user_id = ObjectId().toString()
     return ChatApp.ensureRunning(done)
   })
 
-  return describe('with a thread that is deleted', function() {
-    before(function(done) {
+  return describe('with a thread that is deleted', function () {
+    before(function (done) {
       this.thread_id = ObjectId().toString()
       this.content = 'deleted thread message'
       return ChatClient.sendMessage(
@@ -48,7 +48,7 @@ describe('Deleting a thread', function() {
       )
     })
 
-    return it('should then not list the thread for the project', function(done) {
+    return it('should then not list the thread for the project', function (done) {
       return ChatClient.getThreads(
         this.project_id,
         (error, response, threads) => {

+ 5 - 5
services/chat/test/acceptance/js/EditingAMessageTests.js

@@ -15,16 +15,16 @@ const { expect } = require('chai')
 const ChatClient = require('./helpers/ChatClient')
 const ChatApp = require('./helpers/ChatApp')
 
-describe('Editing a message', function() {
-  before(function(done) {
+describe('Editing a message', function () {
+  before(function (done) {
     this.project_id = ObjectId().toString()
     this.user_id = ObjectId().toString()
     this.thread_id = ObjectId().toString()
     return ChatApp.ensureRunning(done)
   })
 
-  return describe('in a thread', function() {
-    before(function(done) {
+  return describe('in a thread', function () {
+    before(function (done) {
       this.content = 'thread message'
       this.new_content = 'updated thread message'
       return ChatClient.sendMessage(
@@ -54,7 +54,7 @@ describe('Editing a message', function() {
       )
     })
 
-    return it('should then list the updated message in the threads', function(done) {
+    return it('should then list the updated message in the threads', function (done) {
       return ChatClient.getThreads(
         this.project_id,
         (error, response, threads) => {

+ 14 - 14
services/chat/test/acceptance/js/GettingMessagesTests.js

@@ -18,8 +18,8 @@ const crypto = require('crypto')
 const ChatClient = require('./helpers/ChatClient')
 const ChatApp = require('./helpers/ChatApp')
 
-describe('Getting messages', function() {
-  before(function(done) {
+describe('Getting messages', function () {
+  before(function (done) {
     this.user_id1 = ObjectId().toString()
     this.user_id2 = ObjectId().toString()
     this.content1 = 'foo bar'
@@ -27,19 +27,19 @@ describe('Getting messages', function() {
     return ChatApp.ensureRunning(done)
   })
 
-  describe('globally', function() {
-    before(function(done) {
+  describe('globally', function () {
+    before(function (done) {
       this.project_id = ObjectId().toString()
       return async.series(
         [
-          cb =>
+          (cb) =>
             ChatClient.sendGlobalMessage(
               this.project_id,
               this.user_id1,
               this.content1,
               cb
             ),
-          cb =>
+          (cb) =>
             ChatClient.sendGlobalMessage(
               this.project_id,
               this.user_id2,
@@ -51,7 +51,7 @@ describe('Getting messages', function() {
       )
     })
 
-    return it('should contain the messages and populated users when getting the messages', function(done) {
+    return it('should contain the messages and populated users when getting the messages', function (done) {
       return ChatClient.getGlobalMessages(
         this.project_id,
         (error, response, messages) => {
@@ -67,14 +67,14 @@ describe('Getting messages', function() {
     })
   })
 
-  return describe('from all the threads', function() {
-    before(function(done) {
+  return describe('from all the threads', function () {
+    before(function (done) {
       this.project_id = ObjectId().toString()
       this.thread_id1 = ObjectId().toString()
       this.thread_id2 = ObjectId().toString()
       return async.series(
         [
-          cb =>
+          (cb) =>
             ChatClient.sendMessage(
               this.project_id,
               this.thread_id1,
@@ -82,7 +82,7 @@ describe('Getting messages', function() {
               'one',
               cb
             ),
-          cb =>
+          (cb) =>
             ChatClient.sendMessage(
               this.project_id,
               this.thread_id2,
@@ -90,7 +90,7 @@ describe('Getting messages', function() {
               'two',
               cb
             ),
-          cb =>
+          (cb) =>
             ChatClient.sendMessage(
               this.project_id,
               this.thread_id1,
@@ -98,7 +98,7 @@ describe('Getting messages', function() {
               'three',
               cb
             ),
-          cb =>
+          (cb) =>
             ChatClient.sendMessage(
               this.project_id,
               this.thread_id2,
@@ -111,7 +111,7 @@ describe('Getting messages', function() {
       )
     })
 
-    return it('should contain a dictionary of threads with messages with populated users', function(done) {
+    return it('should contain a dictionary of threads with messages with populated users', function (done) {
       return ChatClient.getThreads(
         this.project_id,
         (error, response, threads) => {

+ 11 - 11
services/chat/test/acceptance/js/ResolvingAThreadTests.js

@@ -17,15 +17,15 @@ const crypto = require('crypto')
 const ChatClient = require('./helpers/ChatClient')
 const ChatApp = require('./helpers/ChatApp')
 
-describe('Resolving a thread', function() {
-  before(function(done) {
+describe('Resolving a thread', function () {
+  before(function (done) {
     this.project_id = ObjectId().toString()
     this.user_id = ObjectId().toString()
     return ChatApp.ensureRunning(done)
   })
 
-  describe('with a resolved thread', function() {
-    before(function(done) {
+  describe('with a resolved thread', function () {
+    before(function (done) {
       this.thread_id = ObjectId().toString()
       this.content = 'resolved message'
       return ChatClient.sendMessage(
@@ -50,7 +50,7 @@ describe('Resolving a thread', function() {
       )
     })
 
-    return it('should then list the thread as resolved', function(done) {
+    return it('should then list the thread as resolved', function (done) {
       return ChatClient.getThreads(
         this.project_id,
         (error, response, threads) => {
@@ -68,8 +68,8 @@ describe('Resolving a thread', function() {
     })
   })
 
-  describe('when a thread is not resolved', function() {
-    before(function(done) {
+  describe('when a thread is not resolved', function () {
+    before(function (done) {
       this.thread_id = ObjectId().toString()
       this.content = 'open message'
       return ChatClient.sendMessage(
@@ -85,7 +85,7 @@ describe('Resolving a thread', function() {
       )
     })
 
-    return it('should not list the thread as resolved', function(done) {
+    return it('should not list the thread as resolved', function (done) {
       return ChatClient.getThreads(
         this.project_id,
         (error, response, threads) => {
@@ -98,8 +98,8 @@ describe('Resolving a thread', function() {
     })
   })
 
-  return describe('when a thread is resolved then reopened', function() {
-    before(function(done) {
+  return describe('when a thread is resolved then reopened', function () {
+    before(function (done) {
       this.thread_id = ObjectId().toString()
       this.content = 'resolved message'
       return ChatClient.sendMessage(
@@ -132,7 +132,7 @@ describe('Resolving a thread', function() {
       )
     })
 
-    return it('should not list the thread as resolved', function(done) {
+    return it('should not list the thread as resolved', function (done) {
       return ChatClient.getThreads(
         this.project_id,
         (error, response, threads) => {

+ 21 - 21
services/chat/test/acceptance/js/SendingAMessageTests.js

@@ -17,13 +17,13 @@ const { expect } = require('chai')
 const ChatClient = require('./helpers/ChatClient')
 const ChatApp = require('./helpers/ChatApp')
 
-describe('Sending a message', function() {
-  before(function(done) {
+describe('Sending a message', function () {
+  before(function (done) {
     return ChatApp.ensureRunning(done)
   })
 
-  describe('globally', function() {
-    before(function(done) {
+  describe('globally', function () {
+    before(function (done) {
       this.project_id = ObjectId().toString()
       this.user_id = ObjectId().toString()
       this.content = 'global message'
@@ -42,7 +42,7 @@ describe('Sending a message', function() {
       )
     })
 
-    return it('should then list the message in the project messages', function(done) {
+    return it('should then list the message in the project messages', function (done) {
       return ChatClient.getGlobalMessages(
         this.project_id,
         (error, response, messages) => {
@@ -56,8 +56,8 @@ describe('Sending a message', function() {
     })
   })
 
-  describe('to a thread', function() {
-    before(function(done) {
+  describe('to a thread', function () {
+    before(function (done) {
       this.project_id = ObjectId().toString()
       this.user_id = ObjectId().toString()
       this.thread_id = ObjectId().toString()
@@ -78,7 +78,7 @@ describe('Sending a message', function() {
       )
     })
 
-    it('should then list the message in the threads', function(done) {
+    it('should then list the message in the threads', function (done) {
       return ChatClient.getThreads(
         this.project_id,
         (error, response, threads) => {
@@ -93,7 +93,7 @@ describe('Sending a message', function() {
       )
     })
 
-    return it('should not appear in the global messages', function(done) {
+    return it('should not appear in the global messages', function (done) {
       return ChatClient.getGlobalMessages(
         this.project_id,
         (error, response, messages) => {
@@ -106,15 +106,15 @@ describe('Sending a message', function() {
     })
   })
 
-  return describe('failure cases', function() {
-    before(function() {
+  return describe('failure cases', function () {
+    before(function () {
       this.project_id = ObjectId().toString()
       this.user_id = ObjectId().toString()
       return (this.thread_id = ObjectId().toString())
     })
 
-    describe('with a malformed user_id', function() {
-      return it('should return a graceful error', function(done) {
+    describe('with a malformed user_id', function () {
+      return it('should return a graceful error', function (done) {
         return ChatClient.sendMessage(
           this.project_id,
           this.thread_id,
@@ -129,8 +129,8 @@ describe('Sending a message', function() {
       })
     })
 
-    describe('with a malformed project_id', function() {
-      return it('should return a graceful error', function(done) {
+    describe('with a malformed project_id', function () {
+      return it('should return a graceful error', function (done) {
         return ChatClient.sendMessage(
           'malformed-project',
           this.thread_id,
@@ -145,8 +145,8 @@ describe('Sending a message', function() {
       })
     })
 
-    describe('with a malformed thread_id', function() {
-      return it('should return a graceful error', function(done) {
+    describe('with a malformed thread_id', function () {
+      return it('should return a graceful error', function (done) {
         return ChatClient.sendMessage(
           this.project_id,
           'malformed-thread-id',
@@ -161,8 +161,8 @@ describe('Sending a message', function() {
       })
     })
 
-    describe('with no content', function() {
-      return it('should return a graceful error', function(done) {
+    describe('with no content', function () {
+      return it('should return a graceful error', function (done) {
         return ChatClient.sendMessage(
           this.project_id,
           this.thread_id,
@@ -177,8 +177,8 @@ describe('Sending a message', function() {
       })
     })
 
-    return describe('with very long content', function() {
-      return it('should return a graceful error', function(done) {
+    return describe('with very long content', function () {
+      return it('should return a graceful error', function (done) {
         const content = new Buffer(10240).toString('hex')
         return ChatClient.sendMessage(
           this.project_id,

+ 2 - 2
services/chat/test/acceptance/js/helpers/ChatApp.js

@@ -20,7 +20,7 @@ module.exports = {
   callbacks: [],
   ensureRunning(callback) {
     if (callback == null) {
-      callback = function(error) {}
+      callback = function (error) {}
     }
     if (this.running) {
       return callback()
@@ -29,7 +29,7 @@ module.exports = {
     } else {
       this.initing = true
       this.callbacks.push(callback)
-      return app.listen(3010, 'localhost', error => {
+      return app.listen(3010, 'localhost', (error) => {
         if (error != null) {
           throw error
         }