add error message

This commit is contained in:
Peter Maquiran
2024-06-11 11:46:04 +01:00
parent f3232c835d
commit fe51b38257
27 changed files with 675 additions and 478 deletions
+27 -27
View File
@@ -1,5 +1,5 @@
import { chatUser } from '../models/chatMethod'
import { ChatController } from './chat'
//import { ChatController } from './chat'
export class EventController {
static create() {
@@ -12,36 +12,36 @@ export class EventController {
static async createOrFindGroupFromEvent(name, attendees) {
// chatController.
const {data, roomName} = await ChatController.createGroup(name)
// const {data, roomName} = await ChatController.createGroup(name)
const roomId = data.rid
// const roomId = data.rid
if (data.error.error == "error-duplicate-channel-name") {
const getGroupByName = ChatController.ChatSystemService.getGroupByName(roomName)
if(getGroupByName) {
return getGroupByName
}
} else if (roomId) {
const room = await ChatController.ChatSystemService.waitRoomToCreate(roomId)
const chatUsers: chatUser[] = []
// if (data.error.error == "error-duplicate-channel-name") {
// const getGroupByName = ChatController.ChatSystemService.getGroupByName(roomName)
// if(getGroupByName) {
// return getGroupByName
// }
// } else if (roomId) {
// const room = await ChatController.ChatSystemService.waitRoomToCreate(roomId)
for (let webTRIXUser of attendees ) {
const username = webTRIXUser.EmailAddress.split("@")[0];
const name = webTRIXUser.Name
const findChatUser = ChatController.ChatSystemService.searchContact(name, username)
if(findChatUser) {
chatUsers.push(findChatUser)
}
}
for (let chatUser of chatUsers) {
room.addContacts(chatUser._id)
}
// const chatUsers: chatUser[] = []
return room
}
// for (let webTRIXUser of attendees ) {
// const username = webTRIXUser.EmailAddress.split("@")[0];
// const name = webTRIXUser.Name
// const findChatUser = ChatController.ChatSystemService.searchContact(name, username)
// if(findChatUser) {
// chatUsers.push(findChatUser)
// }
// }
// for (let chatUser of chatUsers) {
// room.addContacts(chatUser._id)
// }
// return room
// }
}