MM-51021 - Remove PostEditTimeLimit check for plugins and a few other code paths (#22422)

* lift PostEditTimeLimit check to API code; tests

* lift PatchPost time limit check into API layer; test

* fix test

* fix i18n; fix test

* fix test
Этот коммит содержится в:
Christopher Poile
2023-03-09 13:37:23 -05:00
коммит произвёл GitHub
родитель 280bc7f97e
Коммит 53f5f2f267
4 изменённых файлов: 62 добавлений и 6 удалений

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

@@ -809,6 +809,11 @@ func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
post.Id = c.Params.PostId
if *c.App.Config().ServiceSettings.PostEditTimeLimit != -1 && model.GetMillis() > originalPost.CreateAt+int64(*c.App.Config().ServiceSettings.PostEditTimeLimit*1000) && post.Message != originalPost.Message {
c.Err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_time_limit.app_error", map[string]any{"timeLimit": *c.App.Config().ServiceSettings.PostEditTimeLimit}, "", http.StatusBadRequest)
return
}
rpost, err := c.App.UpdatePost(c.AppContext, c.App.PostWithProxyRemovedFromImageURLs(&post), false)
if err != nil {
c.Err = err
@@ -863,6 +868,11 @@ func patchPost(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if *c.App.Config().ServiceSettings.PostEditTimeLimit != -1 && model.GetMillis() > originalPost.CreateAt+int64(*c.App.Config().ServiceSettings.PostEditTimeLimit*1000) && post.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
}
patchedPost, err := c.App.PatchPost(c.AppContext, c.Params.PostId, c.App.PostPatchWithProxyRemovedFromImageURLs(&post))
if err != nil {
c.Err = err