mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
add error message
This commit is contained in:
+27
-27
@@ -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
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user