mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
test: fix test, add joinLeaveMessages to newRoom
This commit is contained in:
@@ -88,7 +88,7 @@ module.exports = function (Messaging) {
|
||||
timestamp: now,
|
||||
notificationSetting: data.notificationSetting,
|
||||
messageCount: 0,
|
||||
joinLeaveMessages: 0,
|
||||
joinLeaveMessages: data.joinLeaveMessages || 0,
|
||||
};
|
||||
|
||||
if (data.hasOwnProperty('roomName') && data.roomName) {
|
||||
@@ -127,7 +127,7 @@ module.exports = function (Messaging) {
|
||||
'chat:rooms:public:order:all',
|
||||
]);
|
||||
|
||||
if (!isPublic) {
|
||||
if (!isPublic && parseInt(room.joinLeaveMessages, 10) === 1) {
|
||||
// chat owner should also get the user-join system message
|
||||
await Messaging.addSystemMessage('user-join', uid, roomId);
|
||||
}
|
||||
|
||||
@@ -184,6 +184,7 @@ describe('Messaging Library', () => {
|
||||
await User.setSetting(mocks.users.baz.uid, 'disableIncomingMessages', '0');
|
||||
const { body } = await callv3API('post', `/chats`, {
|
||||
uids: [mocks.users.baz.uid],
|
||||
joinLeaveMessages: 1,
|
||||
}, 'foo');
|
||||
await User.setSetting(mocks.users.baz.uid, 'disableIncomingMessages', '1');
|
||||
|
||||
@@ -803,7 +804,7 @@ describe('Messaging Library', () => {
|
||||
|
||||
assert.equal(response.statusCode, 200);
|
||||
assert(Array.isArray(body.rooms));
|
||||
assert.equal(body.rooms.length, 3);
|
||||
assert.equal(body.rooms.length, 2);
|
||||
assert.equal(body.title, '[[pages:chats]]');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user