Exemplo n.º 1
0
func (me *TestHelper) CreatePost(client *model.Client, channel *model.Channel) *model.Post {
	id := model.NewId()

	post := &model.Post{
		ChannelId: channel.Id,
		Message:   "message_" + id,
	}

	utils.DisableDebugLogForTest()
	r := client.Must(client.CreatePost(post)).Data.(*model.Post)
	utils.EnableDebugLogForTest()
	return r
}
Exemplo n.º 2
0
// postMessage Create a post in Mattermost
func (m *MatterMail) postMessage(client *model.Client, channelID string, message string, fileIds []string) error {
	post := &model.Post{ChannelId: channelID, Message: message}

	if len(fileIds) > 0 {
		post.FileIds = fileIds
	}

	res, err := client.CreatePost(post)
	if res == nil {
		return err
	}

	return nil
}