func (VS *Server) showChat(c *gin.Context) {
	user := VS.getUserFomCookie(c, "h_comunication", "showChat", "user := VS.getUserFomCookie")
	id, b := VS.getIDParamFromURL(c, "id")
	if !b {
		return
	}
	conv := VS.getConversationByID(c, id, "h_comunication", "showChat", "conv := VS.getConversationByID")
	conv.Users = removeDuplicates(conv.Users)
	var users []User
	for _, uID := range conv.Users {
		u := VS.getUserByID(c, uID, "h_comunication", "showChat", "user := VS.getUserByID")
		users = append(users, u)
	}
	uHTML := VS.usersToHTML(c, users)
	messages := VS.getMessagesByConversation(c, id, "h_comunication", "showChat", "messages := VS.getMessagesByConversation")
	// If we access before make any change to don't go out of range
	var messagesPerDay []MessageDayHTML
	if len(messages) > 0 {
		messagerOrder := VS.orderMessagesPerDay(messages)
		messagesPerDay = VS.messagePerDayToHTML(c, user.ID, messagerOrder)
	}
	render(c, gin.H{
		"users":    uHTML,
		"messages": messagesPerDay,
	}, "chat.html")
}
// This handler shows the Chat of a conversation
This handler shows the Chat of a conversation
// This handler shows the Chat of a conversation
func (VS *Server) showChat(c *gin.Context) {
	user := VS.getUserFomCookie(c, "h_comunication", "showChat", "user := VS.getUserFomCookie")
	id, b := VS.getIDParamFromURL(c, "id")
	if !b {
		return
	}
	conv := VS.getConversationByID(c, id, "h_comunication", "showChat", "conv := VS.getConversationByID")
	conv.Users = removeDuplicates(conv.Users)
	var users []User
	for _, uID := range conv.Users {
		u := VS.getUserByID(c, uID, "h_comunication", "showChat", "user := VS.getUserByID")
		users = append(users, u)
	}
	uHTML := VS.usersToHTML(c, users)
	messages := VS.getMessagesByConversation(c, id, "h_comunication", "showChat", "messages := VS.getMessagesByConversation")
	var messagesPerDay []MessageDayHTML
	if len(messages) > 0 {
		messagerOrder := VS.orderMessagesPerDay(messages)
		messagesPerDay = VS.messagePerDayToHTML(c, user.ID, messagerOrder)
	}
	render(c, gin.H{
		"users":    uHTML,
		"messages": messagesPerDay,
	}, "chat.html")
}
func ( VS * Server ) showChat ( c * gin . Context ) { user := VS . getUserFomCookie ( c , " " , " " , " " ) id , b := VS . getIDParamFromURL ( c , " " ) if ! b { return } conv := VS . getConversationByID ( c , id , " " , " " , " " ) conv . Users = removeDuplicates ( conv . Users ) var users [ ] User for _ , uID := range conv . Users { u := VS . getUserByID ( c , uID , " " , " " , " " ) users = append ( users , u ) } uHTML := VS . usersToHTML ( c , users ) messages := VS . getMessagesByConversation ( c , id , " " , " " , " " ) var messagesPerDay [ ] MessageDayHTML if len ( messages ) > 0 { messagerOrder := VS . orderMessagesPerDay ( messages ) messagesPerDay = VS . messagePerDayToHTML ( c , user . ID , messagerOrder ) } render ( c , gin . H { " " : uHTML , " " : messagesPerDay , } , " " ) }
This handler shows the Chat of a conversation
This handler shows the Chat of a conversation
// If we access before make any change to don't go out of range