Automatic Merge
Этот коммит содержится в:
Mattermost Build
2026-03-20 21:30:55 +01:00
коммит произвёл GitHub
родитель 532f2882d1
Коммит 450dba8cad
2 изменённых файлов: 56 добавлений и 0 удалений

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

@@ -1020,6 +1020,12 @@ func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
// Users who can't create posts in a channel shouldn't be able to edit them either.
userCreatePostPermissionCheckWithContext(c, originalPost.ChannelId)
if c.Err != nil {
return
}
auditRec.AddEventPriorState(originalPost)
auditRec.AddEventObjectType("post")
@@ -1157,6 +1163,12 @@ func postPatchChecks(c *Context, auditRec *model.AuditRecord, message *string) b
return false
}
// Users who can't create posts in a channel shouldn't be able to edit them either.
userCreatePostPermissionCheckWithContext(c, originalPost.ChannelId)
if c.Err != nil {
return false
}
if *c.App.Config().ServiceSettings.PostEditTimeLimit != -1 && model.GetMillis() > originalPost.CreateAt+int64(*c.App.Config().ServiceSettings.PostEditTimeLimit*1000) && message != nil {
c.Err = model.NewAppError("patchPost", "api.post.update_post.permissions_time_limit.app_error", map[string]any{"timeLimit": *c.App.Config().ServiceSettings.PostEditTimeLimit}, "", http.StatusBadRequest)
return isMember