AllowEditPost and PostEditTimeLimit migration (#8208)

* AllowEditPost and PostEditTimeLimit migration

* Not set EDIT_POST permission to sysadmin_role if ALLOW_EDIT_POST is configured to NEVER

* Remove a bit of code duplication
Этот коммит содержится в:
Jesús Espino
2018-02-09 16:31:01 +01:00
коммит произвёл Martin Kraft
родитель 96ffde43dc
Коммит 0aa7ecd5e8
10 изменённых файлов: 86 добавлений и 26 удалений

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

@@ -489,16 +489,13 @@ func TestUpdatePost(t *testing.T) {
isLicensed := utils.IsLicensed()
license := utils.License()
allowEditPost := *th.App.Config().ServiceSettings.AllowEditPost
defer func() {
utils.SetIsLicensed(isLicensed)
utils.SetLicense(license)
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowEditPost = allowEditPost })
}()
utils.SetIsLicensed(true)
utils.SetLicense(&model.License{Features: &model.Features{}})
utils.License().Features.SetDefaults()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowEditPost = model.ALLOW_EDIT_POST_ALWAYS })
post := &model.Post{ChannelId: channel.Id, Message: "zz" + model.NewId() + "a"}
rpost, resp := Client.CreatePost(post)
@@ -571,18 +568,14 @@ func TestPatchPost(t *testing.T) {
isLicensed := utils.IsLicensed()
license := utils.License()
allowEditPost := *th.App.Config().ServiceSettings.AllowEditPost
defer func() {
utils.SetIsLicensed(isLicensed)
utils.SetLicense(license)
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowEditPost = allowEditPost })
}()
utils.SetIsLicensed(true)
utils.SetLicense(&model.License{Features: &model.Features{}})
utils.License().Features.SetDefaults()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowEditPost = model.ALLOW_EDIT_POST_ALWAYS })
post := &model.Post{
ChannelId: channel.Id,
IsPinned: true,