[BUG] getDirectByUsernames and Creation of Direct Room returning general channel instead expected direct room by usernames
Twitter-Dev opened this issue · comments
Twitter-Dev commented
What happened?
- I'm trying to send the helperMessage on Installation of Apps in Direct room with members (appbot and installer) ie: notion.bot but i have observed when i'm trying to get the Direct room by method
getDirectByUsernames([appBotUsername,installerUsername])
if this direct room doesn't exist its returninggeneral channel
and the expected behaviour should be undefined if the direct room with the appBot and installer doesn't exist. so we can create one
Code Snippet:
// try to get the room with usernames
// case where we may not a room already
// admin may have deleted the room
let room: IRoom | undefined = await read
.getRoomReader()
.getDirectByUsernames([appbotUserName, InstallerUsername]);
// // room exist but returning general channel instead not the expected behaviour
if (room) {
return room;
}
// will create direct room with the expected users but caution when creating the direct room
// its not creating the expected direct room
const newRoom = modify
.getCreator()
.startRoom()
.setType(RoomType.DIRECT_MESSAGE)
.setCreator(creator)
.setMembersToBeAddedByUsernames(usernames);
const roomId = await modify.getCreator().finish(newRoom);
RC Version
v6.2.2
What browsers are you seeing the problem on?
- Firefox
- Chrome