Prevent flagging of deleted posts and don't show deleted posts in flagged post list (#3846)

Этот коммит содержится в:
Joram Wilander
2016-08-22 20:36:01 -04:00
коммит произвёл Corey Hulen
родитель c3c62ad2ad
Коммит 80d83ae77c
6 изменённых файлов: 78 добавлений и 29 удалений

Просмотреть файл

@@ -1332,6 +1332,7 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
go Publish(message)
go DeletePostFiles(c.TeamId, post)
go DeleteFlaggedPost(c.Session.UserId, post)
result := make(map[string]string)
result["id"] = postId
@@ -1339,6 +1340,13 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
func DeleteFlaggedPost(userId string, post *model.Post) {
if result := <-Srv.Store.Preference().Delete(userId, model.PREFERENCE_CATEGORY_FLAGGED_POST, post.Id); result.Err != nil {
l4g.Warn(utils.T("api.post.delete_flagged_post.app_error.warn"), result.Err)
return
}
}
func DeletePostFiles(teamId string, post *model.Post) {
if len(post.Filenames) == 0 {
return