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

Merge branch 'master' of https://bitbucket.org/sharelatex/notifications-sharelatex

Henrique Dias 10 лет назад
Родитель
Сommit
957e9cd486

+ 1 - 1
services/notifications/app.coffee

@@ -40,6 +40,6 @@ app.get '*', (req, res)->
 	res.send 404
 	res.send 404
 
 
 host = Settings.internal?.notifications?.host || "localhost"
 host = Settings.internal?.notifications?.host || "localhost"
-port = Settings.internal?.notifications?.port || 3033
+port = Settings.internal?.notifications?.port || 3042
 app.listen port, host, ->
 app.listen port, host, ->
 	logger.info "notifications starting up, listening on #{host}:#{port}"
 	logger.info "notifications starting up, listening on #{host}:#{port}"

+ 6 - 3
services/notifications/app/coffee/HealthCheckController.coffee

@@ -26,18 +26,21 @@ module.exports =
 				opts.json = true
 				opts.json = true
 				request.get opts, (err, res, body)->
 				request.get opts, (err, res, body)->
 					if res.statusCode != 200
 					if res.statusCode != 200
-						return cb("status code not 200, its #{res.statusCode}")
+						e = "status code not 200 #{res.statusCode}"
+						logger.err err:err, e
+						return cb(e)
 
 
 					hasNotification = _.some body, (notification)-> 
 					hasNotification = _.some body, (notification)-> 
 						notification.key == notification_key and notification.user_id == user_id.toString()
 						notification.key == notification_key and notification.user_id == user_id.toString()
 					if hasNotification
 					if hasNotification
-						cb(null,body)
+						cb(null, body)
 					else
 					else
-						logger.log body:body, "what is in the body"
+						logger.log body:body, "got notifications response for health check"
 						return cb("notification not found in response")
 						return cb("notification not found in response")
 		]
 		]
 		async.series jobs, (err, body)->
 		async.series jobs, (err, body)->
 			if err?
 			if err?
+				logger.err err:err, "error running health check"
 				return callback(err)
 				return callback(err)
 			else
 			else
 				notification_id = body[1][0]._id
 				notification_id = body[1][0]._id

+ 1 - 1
services/notifications/app/coffee/Notifications.coffee

@@ -34,7 +34,7 @@ module.exports =
 			user_id:ObjectId(user_id)
 			user_id:ObjectId(user_id)
 			_id:ObjectId(notification_id)
 			_id:ObjectId(notification_id)
 		updateOperation = 
 		updateOperation = 
-			"$unset": {templateKey:true}
+			"$unset": {templateKey:true, messageOpts: true}
 		db.notifications.update searchOps, updateOperation, callback
 		db.notifications.update searchOps, updateOperation, callback
 
 
 	removeNotificationKey: (user_id, notification_key, callback)->
 	removeNotificationKey: (user_id, notification_key, callback)->

+ 1 - 1
services/notifications/config/settings.defaults.coffee

@@ -1,7 +1,7 @@
 module.exports = Settings =
 module.exports = Settings =
 	internal:
 	internal:
 		notifications:
 		notifications:
-			port: 3033
+			port: 3042
 			host: "localhost"
 			host: "localhost"
 
 
 	mongo:
 	mongo:

+ 2 - 2
services/notifications/test/unit/coffee/NotificationsTests.coffee

@@ -69,7 +69,7 @@ describe 'Notifications Tests', ->
 					user_id:ObjectId(user_id)
 					user_id:ObjectId(user_id)
 					_id:ObjectId(notification_id)
 					_id:ObjectId(notification_id)
 				updateOperation = 
 				updateOperation = 
-					"$unset": {templateKey:true}
+					"$unset": {templateKey:true, messageOpts:true}
 				@updateStub.calledWith(searchOps, updateOperation).should.equal true
 				@updateStub.calledWith(searchOps, updateOperation).should.equal true
 				done()
 				done()
 
 
@@ -84,4 +84,4 @@ describe 'Notifications Tests', ->
 				updateOperation = 
 				updateOperation = 
 					"$unset": {templateKey:true}
 					"$unset": {templateKey:true}
 				@updateStub.calledWith(searchOps, updateOperation).should.equal true
 				@updateStub.calledWith(searchOps, updateOperation).should.equal true
-				done()
+				done()