diff --git a/public/openapi/components/schemas/Chats.yaml b/public/openapi/components/schemas/Chats.yaml index fe2ff9f73c..36404313ff 100644 --- a/public/openapi/components/schemas/Chats.yaml +++ b/public/openapi/components/schemas/Chats.yaml @@ -37,9 +37,9 @@ MessageObject: roomId: type: number deleted: - type: boolean + type: number system: - type: boolean + type: number edited: type: number timestampISO: diff --git a/public/openapi/read/user/userslug/chats/roomid.yaml b/public/openapi/read/user/userslug/chats/roomid.yaml index 025499b753..cb350aa2e0 100644 --- a/public/openapi/read/user/userslug/chats/roomid.yaml +++ b/public/openapi/read/user/userslug/chats/roomid.yaml @@ -59,9 +59,9 @@ get: roomId: type: string deleted: - type: boolean + type: number system: - type: boolean + type: number edited: type: number timestampISO: diff --git a/src/messaging/create.js b/src/messaging/create.js index 87ec24729f..872f22613f 100644 --- a/src/messaging/create.js +++ b/src/messaging/create.js @@ -67,6 +67,7 @@ module.exports = function (Messaging) { Messaging.addMessageToRoom(roomId, mid, timestamp), Messaging.markRead(uid, roomId), db.sortedSetAdd('messages:mid', timestamp, mid), + db.incrObjectField('global', 'messageCount'), ]; if (roomData.public) { tasks.push( diff --git a/src/upgrades/3.3.0/chat_message_mids.js b/src/upgrades/3.3.0/chat_message_mids.js index ebb79324fa..d7f349ae98 100644 --- a/src/upgrades/3.3.0/chat_message_mids.js +++ b/src/upgrades/3.3.0/chat_message_mids.js @@ -4,7 +4,6 @@ const db = require('../../database'); const batch = require('../../batch'); - module.exports = { name: 'Set mid on message objects and create messages:mid', timestamp: Date.UTC(2023, 6, 27), @@ -41,5 +40,7 @@ module.exports = { }, { batch: 500, }); + const count = await db.sortedSetCard(`messages:mid`); + await db.setObjectField('global', 'messageCount', count); }, };