示例#1
0
文件: form.go 项目: trigrass2/wego
func (form *PostForm) SavePost(post *models.Post, user *models.User) error {
	utils.SetFormValues(form, post)
	post.CategoryId = form.Category
	post.TopicId = form.Topic
	post.UserId = user.Id
	post.LastReplyId = user.Id
	post.LastAuthorId = user.Id
	post.CanEdit = true
	post.ContentCache = utils.RenderMarkdown(form.Content)

	// mentioned follow users
	FilterMentions(user, post.ContentCache)

	return post.Insert()
}