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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
280bc7f97e
Коммит
53f5f2f267
@@ -631,11 +631,6 @@ func (a *App) UpdatePost(c *request.Context, post *model.Post, safeUpdate bool)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if *a.Config().ServiceSettings.PostEditTimeLimit != -1 && model.GetMillis() > oldPost.CreateAt+int64(*a.Config().ServiceSettings.PostEditTimeLimit*1000) && post.Message != oldPost.Message {
|
||||
err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_time_limit.app_error", map[string]any{"timeLimit": *a.Config().ServiceSettings.PostEditTimeLimit}, "", http.StatusBadRequest)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
channel, err := a.GetChannel(c, oldPost.ChannelId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -309,7 +309,7 @@ func TestUpdatePostTimeLimit(t *testing.T) {
|
||||
})
|
||||
post.Message = model.NewId()
|
||||
_, err = th.App.UpdatePost(th.Context, post, true)
|
||||
require.NotNil(t, err, "should fail on update old post")
|
||||
require.Nil(t, err, "should allow you to edit an old post because the time check is applied above in the call hierarchy")
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.PostEditTimeLimit = -1
|
||||
|
||||
Ссылка в новой задаче
Block a user