decaf cleanup: remove unnecessary callback fallbacks

GitOrigin-RevId: a6b347e121a30221a305116327e42ad070e81977
This commit is contained in:
Tim Alby 2022-01-07 11:47:08 +01:00 committed by Copybot
parent ea8e0af551
commit b5d2122f05
3 changed files with 0 additions and 36 deletions

View file

@ -5,9 +5,6 @@ const logger = require('@overleaf/logger')
module.exports = MessageManager = { module.exports = MessageManager = {
createMessage(roomId, userId, content, timestamp, callback) { createMessage(roomId, userId, content, timestamp, callback) {
if (!callback) {
callback = function () {}
}
let newMessageOpts = { let newMessageOpts = {
content, content,
room_id: roomId, room_id: roomId,
@ -25,9 +22,6 @@ module.exports = MessageManager = {
}, },
getMessages(roomId, limit, before, callback) { getMessages(roomId, limit, before, callback) {
if (!callback) {
callback = function () {}
}
let query = { room_id: roomId } let query = { room_id: roomId }
if (before) { if (before) {
query.timestamp = { $lt: before } query.timestamp = { $lt: before }
@ -41,9 +35,6 @@ module.exports = MessageManager = {
}, },
findAllMessagesInRooms(roomIds, callback) { findAllMessagesInRooms(roomIds, callback) {
if (!callback) {
callback = function () {}
}
db.messages db.messages
.find({ .find({
room_id: { $in: roomIds }, room_id: { $in: roomIds },
@ -52,9 +43,6 @@ module.exports = MessageManager = {
}, },
deleteAllMessagesInRoom(roomId, callback) { deleteAllMessagesInRoom(roomId, callback) {
if (!callback) {
callback = function () {}
}
db.messages.deleteMany( db.messages.deleteMany(
{ {
room_id: roomId, room_id: roomId,
@ -64,9 +52,6 @@ module.exports = MessageManager = {
}, },
updateMessage(roomId, messageId, content, timestamp, callback) { updateMessage(roomId, messageId, content, timestamp, callback) {
if (!callback) {
callback = function () {}
}
const query = this._ensureIdsAreObjectIds({ const query = this._ensureIdsAreObjectIds({
_id: messageId, _id: messageId,
room_id: roomId, room_id: roomId,
@ -84,9 +69,6 @@ module.exports = MessageManager = {
}, },
deleteMessage(roomId, messageId, callback) { deleteMessage(roomId, messageId, callback) {
if (!callback) {
callback = function () {}
}
const query = this._ensureIdsAreObjectIds({ const query = this._ensureIdsAreObjectIds({
_id: messageId, _id: messageId,
room_id: roomId, room_id: roomId,

View file

@ -8,9 +8,6 @@ module.exports = ThreadManager = {
findOrCreateThread(projectId, threadId, callback) { findOrCreateThread(projectId, threadId, callback) {
let query, update let query, update
if (!callback) {
callback = function () {}
}
projectId = ObjectId(projectId.toString()) projectId = ObjectId(projectId.toString())
if (threadId !== ThreadManager.GLOBAL_THREAD) { if (threadId !== ThreadManager.GLOBAL_THREAD) {
threadId = ObjectId(threadId.toString()) threadId = ObjectId(threadId.toString())
@ -49,9 +46,6 @@ module.exports = ThreadManager = {
}, },
findAllThreadRooms(projectId, callback) { findAllThreadRooms(projectId, callback) {
if (!callback) {
callback = function () {}
}
db.rooms db.rooms
.find( .find(
{ {
@ -67,9 +61,6 @@ module.exports = ThreadManager = {
}, },
resolveThread(projectId, threadId, userId, callback) { resolveThread(projectId, threadId, userId, callback) {
if (!callback) {
callback = function () {}
}
db.rooms.updateOne( db.rooms.updateOne(
{ {
project_id: ObjectId(projectId.toString()), project_id: ObjectId(projectId.toString()),
@ -88,9 +79,6 @@ module.exports = ThreadManager = {
}, },
reopenThread(projectId, threadId, callback) { reopenThread(projectId, threadId, callback) {
if (!callback) {
callback = function () {}
}
db.rooms.updateOne( db.rooms.updateOne(
{ {
project_id: ObjectId(projectId.toString()), project_id: ObjectId(projectId.toString()),
@ -106,9 +94,6 @@ module.exports = ThreadManager = {
}, },
deleteThread(projectId, threadId, callback) { deleteThread(projectId, threadId, callback) {
if (!callback) {
callback = function () {}
}
this.findOrCreateThread(projectId, threadId, function (error, room) { this.findOrCreateThread(projectId, threadId, function (error, room) {
if (error) { if (error) {
return callback(error) return callback(error)

View file

@ -6,9 +6,6 @@ module.exports = {
initing: false, initing: false,
callbacks: [], callbacks: [],
ensureRunning(callback) { ensureRunning(callback) {
if (!callback) {
callback = function () {}
}
if (this.running) { if (this.running) {
return callback() return callback()
} else if (this.initing) { } else if (this.initing) {