mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[misc] fix express deprecations
Co-Authored-By: Jakob Ackermann <jakob.ackermann@overleaf.com>
This commit is contained in:
committed by
Jakob Ackermann
parent
4ab49ec6c5
commit
7302c0ce0b
@@ -33,12 +33,12 @@ metrics.injectMetricsRoute(app)
|
||||
|
||||
app.post('/user/:user_id', controller.addNotification)
|
||||
app.get('/user/:user_id', controller.getUserNotifications)
|
||||
app.del(
|
||||
app.delete(
|
||||
'/user/:user_id/notification/:notification_id',
|
||||
controller.removeNotificationId
|
||||
)
|
||||
app.del('/user/:user_id', controller.removeNotificationKey)
|
||||
app.del('/key/:key', controller.removeNotificationByKeyOnly)
|
||||
app.delete('/user/:user_id', controller.removeNotificationKey)
|
||||
app.delete('/key/:key', controller.removeNotificationByKeyOnly)
|
||||
|
||||
app.get('/status', (req, res) => res.send('notifications sharelatex up'))
|
||||
|
||||
@@ -46,14 +46,14 @@ app.get('/health_check', (req, res) =>
|
||||
HealthCheckController.check(function(err) {
|
||||
if (err != null) {
|
||||
logger.err({ err }, 'error performing health check')
|
||||
return res.send(500)
|
||||
return res.sendStatus(500)
|
||||
} else {
|
||||
return res.send(200)
|
||||
return res.sendStatus(200)
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
app.get('*', (req, res) => res.send(404))
|
||||
app.get('*', (req, res) => res.sendStatus(404))
|
||||
|
||||
const host =
|
||||
__guard__(
|
||||
|
||||
@@ -40,7 +40,7 @@ module.exports = {
|
||||
if (err != null) {
|
||||
return res.sendStatus(500)
|
||||
} else {
|
||||
return res.send()
|
||||
return res.sendStatus(200)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -57,7 +57,7 @@ module.exports = {
|
||||
return Notifications.removeNotificationId(
|
||||
req.params.user_id,
|
||||
req.params.notification_id,
|
||||
(err, notifications) => res.send()
|
||||
(err, notifications) => res.sendStatus(200)
|
||||
)
|
||||
},
|
||||
|
||||
@@ -70,7 +70,7 @@ module.exports = {
|
||||
return Notifications.removeNotificationKey(
|
||||
req.params.user_id,
|
||||
req.body.key,
|
||||
(err, notifications) => res.send()
|
||||
(err, notifications) => res.sendStatus(200)
|
||||
)
|
||||
},
|
||||
|
||||
@@ -80,7 +80,7 @@ module.exports = {
|
||||
metrics.inc('removeNotificationKey')
|
||||
return Notifications.removeNotificationByKeyOnly(
|
||||
notification_key,
|
||||
(err, notifications) => res.send()
|
||||
(err, notifications) => res.sendStatus(200)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,10 +76,11 @@ describe('Notifications Controller', function() {
|
||||
body: this.stubbedNotification
|
||||
}
|
||||
return this.controller.addNotification(req, {
|
||||
send: result => {
|
||||
sendStatus: code => {
|
||||
this.notifications.addNotification
|
||||
.calledWith(user_id, this.stubbedNotification)
|
||||
.should.equal(true)
|
||||
code.should.equal(200)
|
||||
return done()
|
||||
}
|
||||
})
|
||||
@@ -96,10 +97,11 @@ describe('Notifications Controller', function() {
|
||||
}
|
||||
}
|
||||
return this.controller.removeNotificationId(req, {
|
||||
send: result => {
|
||||
sendStatus: code => {
|
||||
this.notifications.removeNotificationId
|
||||
.calledWith(user_id, notification_id)
|
||||
.should.equal(true)
|
||||
code.should.equal(200)
|
||||
return done()
|
||||
}
|
||||
})
|
||||
@@ -116,10 +118,11 @@ describe('Notifications Controller', function() {
|
||||
body: { key: notification_key }
|
||||
}
|
||||
return this.controller.removeNotificationKey(req, {
|
||||
send: result => {
|
||||
sendStatus: code => {
|
||||
this.notifications.removeNotificationKey
|
||||
.calledWith(user_id, notification_key)
|
||||
.should.equal(true)
|
||||
code.should.equal(200)
|
||||
return done()
|
||||
}
|
||||
})
|
||||
@@ -137,10 +140,11 @@ describe('Notifications Controller', function() {
|
||||
}
|
||||
}
|
||||
return this.controller.removeNotificationByKeyOnly(req, {
|
||||
send: result => {
|
||||
sendStatus: code => {
|
||||
this.notifications.removeNotificationByKeyOnly
|
||||
.calledWith(notification_key)
|
||||
.should.equal(true)
|
||||
code.should.equal(200)
|
||||
return done()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user