коммит произвёл
GitHub
родитель
f290745496
Коммит
c3ed07e679
@@ -61,7 +61,7 @@ func TestConfigSave(t *testing.T) {
|
||||
t.Run("trigger a config changed event for the cluster", func(t *testing.T) {
|
||||
oldCfg := th.Service.Config()
|
||||
newCfg := oldCfg.Clone()
|
||||
newCfg.ServiceSettings.SiteURL = model.NewString("http://newhost.me")
|
||||
newCfg.ServiceSettings.SiteURL = model.NewPointer("http://newhost.me")
|
||||
|
||||
sanitizedOldCfg := th.Service.configStore.RemoveEnvironmentOverrides(oldCfg)
|
||||
sanitizedNewCfg := th.Service.configStore.RemoveEnvironmentOverrides(newCfg)
|
||||
@@ -87,16 +87,16 @@ func TestConfigSave(t *testing.T) {
|
||||
|
||||
// Change a random config setting
|
||||
cfg := th.Service.Config().Clone()
|
||||
cfg.ThemeSettings.EnableThemeSelection = model.NewBool(!*cfg.ThemeSettings.EnableThemeSelection)
|
||||
cfg.ThemeSettings.EnableThemeSelection = model.NewPointer(!*cfg.ThemeSettings.EnableThemeSelection)
|
||||
th.Service.SaveConfig(cfg, false)
|
||||
metricsMock.AssertNumberOfCalls(t, "Register", 0)
|
||||
|
||||
// Disable metrics
|
||||
cfg.MetricsSettings.Enable = model.NewBool(false)
|
||||
cfg.MetricsSettings.Enable = model.NewPointer(false)
|
||||
th.Service.SaveConfig(cfg, false)
|
||||
|
||||
// Change the metrics setting
|
||||
cfg.MetricsSettings.Enable = model.NewBool(true)
|
||||
cfg.MetricsSettings.Enable = model.NewPointer(true)
|
||||
th.Service.SaveConfig(cfg, false)
|
||||
metricsMock.AssertNumberOfCalls(t, "Register", 1)
|
||||
})
|
||||
|
||||
@@ -264,7 +264,7 @@ type ChannelOption func(*model.Channel)
|
||||
|
||||
func WithShared(v bool) ChannelOption {
|
||||
return func(channel *model.Channel) {
|
||||
channel.Shared = model.NewBool(v)
|
||||
channel.Shared = model.NewPointer(v)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ func TestMetrics(t *testing.T) {
|
||||
// there is no config listener for the metrics
|
||||
// we handle it on config save step
|
||||
cfg := th.Service.Config().Clone()
|
||||
cfg.MetricsSettings.Enable = model.NewBool(true)
|
||||
cfg.MetricsSettings.Enable = model.NewPointer(true)
|
||||
th.Service.SaveConfig(cfg, false)
|
||||
|
||||
require.NotNil(t, th.Service.metrics)
|
||||
@@ -109,7 +109,7 @@ func TestMetrics(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, http.StatusOK, resp.StatusCode)
|
||||
|
||||
cfg.MetricsSettings.Enable = model.NewBool(false)
|
||||
cfg.MetricsSettings.Enable = model.NewPointer(false)
|
||||
th.Service.SaveConfig(cfg, false)
|
||||
|
||||
_, err = http.Get(metricsAddr)
|
||||
|
||||
@@ -81,7 +81,7 @@ func TestServerSyncSharedChannelHandler(t *testing.T) {
|
||||
mockChannelStore := &mocks.ChannelStore{}
|
||||
mockChannelStore.On("Get", "channelID", true).Return(&model.Channel{
|
||||
Id: "channelID",
|
||||
Shared: model.NewBool(true),
|
||||
Shared: model.NewPointer(true),
|
||||
}, nil)
|
||||
|
||||
mockUserStore := &mocks.UserStore{}
|
||||
|
||||
@@ -852,7 +852,7 @@ func (wc *WebConn) ShouldSendEvent(msg *model.WebSocketEvent) bool {
|
||||
// see sensitive data. Prevents admin clients from receiving events with bad data
|
||||
var hasReadPrivateDataPermission *bool
|
||||
if msg.GetBroadcast().ContainsSanitizedData {
|
||||
hasReadPrivateDataPermission = model.NewBool(wc.Suite.RolesGrantPermission(wc.GetSession().GetUserRoles(), model.PermissionManageSystem.Id))
|
||||
hasReadPrivateDataPermission = model.NewPointer(wc.Suite.RolesGrantPermission(wc.GetSession().GetUserRoles(), model.PermissionManageSystem.Id))
|
||||
|
||||
if *hasReadPrivateDataPermission {
|
||||
return false
|
||||
@@ -862,7 +862,7 @@ func (wc *WebConn) ShouldSendEvent(msg *model.WebSocketEvent) bool {
|
||||
// If the event contains sensitive data, only send to users with permission to see it
|
||||
if msg.GetBroadcast().ContainsSensitiveData {
|
||||
if hasReadPrivateDataPermission == nil {
|
||||
hasReadPrivateDataPermission = model.NewBool(wc.Suite.RolesGrantPermission(wc.GetSession().GetUserRoles(), model.PermissionManageSystem.Id))
|
||||
hasReadPrivateDataPermission = model.NewPointer(wc.Suite.RolesGrantPermission(wc.GetSession().GetUserRoles(), model.PermissionManageSystem.Id))
|
||||
}
|
||||
|
||||
if !*hasReadPrivateDataPermission {
|
||||
|
||||
Ссылка в новой задаче
Block a user