diff --git a/helpers/transactionTypes.js b/helpers/transactionTypes.js index c5ec427c..03b81ab7 100644 --- a/helpers/transactionTypes.js +++ b/helpers/transactionTypes.js @@ -10,5 +10,11 @@ module.exports = { IN_TRANSFER: 6, OUT_TRANSFER: 7, CHAT_MESSAGE: 8, - STATE: 9 + STATE: 9, + CHAT_MESSAGE_TYPES: { + LEGACY_MESSAGE: 0, + ORDINARY_MESSAGE: 1, + RICH_TEXT_MESSAGE: 2, + SIGNAL_MESSAGE: 3 + } }; diff --git a/modules/chatrooms.js b/modules/chatrooms.js index 5b75c4c7..82a512a6 100644 --- a/modules/chatrooms.js +++ b/modules/chatrooms.js @@ -72,7 +72,7 @@ __private.listChats = function (filter, cb) { } else { where.push(`("t_type" = ${transactionTypes.CHAT_MESSAGE} OR "t_type" = ${transactionTypes.SEND})`); } - where.push('(NOT("c_type" = 3) OR c_type IS NULL) '); + where.push(`(NOT("c_type" = ${transactionTypes.CHAT_MESSAGE_TYPES.SIGNAL_MESSAGE}) OR c_type IS NULL) `); if (filter.senderId) { where.push('"t_senderId" = ${name}'); params.name = filter.senderId; @@ -162,7 +162,7 @@ __private.listMessages = function (filter, cb) { where.push('"c_type" = ${type}'); params.type = filter.type; } else { - where.push('(NOT("c_type" = 3) OR c_type IS NULL) '); + where.push(`(NOT("c_type" = ${transactionTypes.CHAT_MESSAGE_TYPES.SIGNAL_MESSAGE}) OR c_type IS NULL)`); } if (filter.withoutDirectTransfers) { where.push('"t_type" = ' + transactionTypes.CHAT_MESSAGE);