mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
[misc] bump the dev-env to 3.3.2
This commit is contained in:
parent
512cb5df79
commit
e992166680
27 changed files with 199 additions and 280 deletions
|
@ -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
services/chat/.github/dependabot.yml
vendored
Normal file
17
services/chat/.github/dependabot.yml
vendored
Normal file
|
@ -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
services/chat/.gitignore
vendored
3
services/chat/.gitignore
vendored
|
@ -7,3 +7,6 @@ node_modules/
|
|||
plato/
|
||||
|
||||
**/*.map
|
||||
|
||||
# managed by dev-environment$ bin/update_build_scripts
|
||||
.npmrc
|
||||
|
|
|
@ -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,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
|
||||
|
|
131
services/chat/Jenkinsfile
vendored
131
services/chat/Jenkinsfile
vendored
|
@ -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')
|
||||
}
|
||||
}
|
|
@ -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_acceptance: test_clean test_acceptance_pre_run test_acceptance_run
|
||||
test_clean: test_unit_clean
|
||||
test_unit_clean:
|
||||
ifneq (,$(wildcard test/unit))
|
||||
$(DOCKER_COMPOSE_TEST_UNIT) down -v -t 0
|
||||
endif
|
||||
|
||||
test_acceptance_debug: test_clean test_acceptance_pre_run test_acceptance_run_debug
|
||||
test_acceptance: test_acceptance_clean test_acceptance_pre_run test_acceptance_run
|
||||
$(MAKE) test_acceptance_clean
|
||||
|
||||
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) \
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
|
|
|
@ -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,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
|
||||
|
|
|
@ -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'
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
"execMap": {
|
||||
"js": "npm run start"
|
||||
},
|
||||
|
||||
"watch": [
|
||||
"app/js/",
|
||||
"app.js",
|
||||
|
|
12
services/chat/package-lock.json
generated
12
services/chat/package-lock.json
generated
|
@ -5152,9 +5152,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 +5397,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",
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
@ -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",
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue