func (VS *Server) conversationToHTML(c *gin.Context, idUser bson.ObjectId, u []Conversation) []ConversationHTML {
	var conversations []ConversationHTML
	var conv ConversationHTML
	var users []User
	for _, m := range u {
		users = nil
		conv.ID = m.ID
		m.Users = removeDuplicates(m.Users)
		for _, user := range m.Users {
			users = append(users, VS.getUserByID(c, user, "h_view", "conversationToHTML", "users = append(users, VS.getUserByID"))
		}
		conv.Users = VS.usersToHTML(c, users)
		msages := VS.getMessagesByConversation(c, m.ID, "h_view", "conversationToHTML", "msages := VS.getMessagesByConversation")
		if len(msages) != 0 {
			conv.LastMessage = msages[len(msages)-1].Text
		}
		conversations = append(conversations, conv)
	}
	return conversations
}
// Create the human readable information for the table for Conversations
Create the human readable information for the table for Conversations
// Create the human readable information for the table for Conversations
func (VS *Server) conversationToHTML(c *gin.Context, idUser bson.ObjectId, u []Conversation) []ConversationHTML {
	var conversations []ConversationHTML
	var conv ConversationHTML
	var users []User
	for _, m := range u {
		users = nil
		conv.ID = m.ID
		m.Users = removeDuplicates(m.Users)
		for _, user := range m.Users {
			users = append(users, VS.getUserByID(c, user, "h_view", "conversationToHTML", "users = append(users, VS.getUserByID"))
		}
		conv.Users = VS.usersToHTML(c, users)
		msages := VS.getMessagesByConversation(c, m.ID, "h_view", "conversationToHTML", "msages := VS.getMessagesByConversation")
		if len(msages) != 0 {
			conv.LastMessage = msages[len(msages)-1].Text
		}
		conversations = append(conversations, conv)
	}
	return conversations
}
func ( VS * Server ) conversationToHTML ( c * gin . Context , idUser bson . ObjectId , u [ ] Conversation ) [ ] ConversationHTML { var conversations [ ] ConversationHTML var conv ConversationHTML var users [ ] User for _ , m := range u { users = nil conv . ID = m . ID m . Users = removeDuplicates ( m . Users ) for _ , user := range m . Users { users = append ( users , VS . getUserByID ( c , user , " " , " " , " " ) ) } conv . Users = VS . usersToHTML ( c , users ) msages := VS . getMessagesByConversation ( c , m . ID , " " , " " , " " ) if len ( msages ) != 0 { conv . LastMessage = msages [ len ( msages ) - 1 ] . Text } conversations = append ( conversations , conv ) } return conversations }
Create the human readable information for the table for Conversations
Create the human readable information for the table for Conversations