thread tests
This commit is contained in:
@@ -82,6 +82,7 @@ export default class RegisterMessageInApp {
|
||||
|
||||
async registerMembers(roomId: number) {
|
||||
getAllMembers(this.messageId).then((res) => {
|
||||
if (res.lenght == 0) return;
|
||||
const data = res[0].id.split(",");
|
||||
data.forEach(async (memberId: number) => {
|
||||
await registerMember(roomId, memberId);
|
||||
@@ -124,8 +125,8 @@ export default class RegisterMessageInApp {
|
||||
// todo room not lenght, reply to transfer ?
|
||||
roomId = room[0].room_id;
|
||||
let root_id = room[0].root_id;
|
||||
if (!root_id) root_id = roomId;
|
||||
await registerThread(threadId, room[0].room_id, root_id);
|
||||
if (root_id === undefined) root_id = roomId;
|
||||
await registerThread(threadId, roomId, root_id);
|
||||
});
|
||||
// impl register previous message or go back
|
||||
await registerMessageInRoom(this.messageId, threadId, this.envelope.date);
|
||||
@@ -150,7 +151,7 @@ export default class RegisterMessageInApp {
|
||||
await this.init();
|
||||
if (this.envelope.inReplyTo) {
|
||||
this.inReplyTo = this.envelope.inReplyTo;
|
||||
this.saveReply();
|
||||
await this.saveReply();
|
||||
} else {
|
||||
if (await this.isFromUs()) {
|
||||
if (this.isDm()) {
|
||||
@@ -161,7 +162,7 @@ export default class RegisterMessageInApp {
|
||||
} else {
|
||||
// it is not a reply and not a dm
|
||||
// so it is a channel, which can be possibly a group
|
||||
this.initiateRoom(this.ownerId, RoomType.ROOM);
|
||||
await this.initiateRoom(this.ownerId, RoomType.ROOM);
|
||||
}
|
||||
} else {
|
||||
await this.createOrRegisterOnExistence(this.ownerId, RoomType.ROOM);
|
||||
@@ -181,7 +182,8 @@ export default class RegisterMessageInApp {
|
||||
if (isGroup) {
|
||||
this.createOrRegisterOnMembers(rooms[0].room_id);
|
||||
} else {
|
||||
// reply from channel
|
||||
// reply from CHANNEL or DM or ROOM
|
||||
await this.initiateThread();
|
||||
// todo
|
||||
// if (sender == owner) { // correction from the original sender
|
||||
// // leave in the same channel
|
||||
@@ -191,7 +193,7 @@ export default class RegisterMessageInApp {
|
||||
} else if (rooms.length > 1) {
|
||||
// get the lowest thread (order by room_id)
|
||||
const roomId = rooms[rooms.length - 1].room_id;
|
||||
this.createOrRegisterOnMembers(roomId);
|
||||
await this.createOrRegisterOnMembers(roomId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user