коммит произвёл
GitHub
родитель
f290745496
Коммит
c3ed07e679
@@ -22,14 +22,14 @@ func makeTestAtmosCamoProxy() *ImageProxy {
|
||||
configService := &testutils.StaticConfigService{
|
||||
Cfg: &model.Config{
|
||||
ServiceSettings: model.ServiceSettings{
|
||||
SiteURL: model.NewString("https://mattermost.example.com"),
|
||||
AllowedUntrustedInternalConnections: model.NewString("127.0.0.1"),
|
||||
SiteURL: model.NewPointer("https://mattermost.example.com"),
|
||||
AllowedUntrustedInternalConnections: model.NewPointer("127.0.0.1"),
|
||||
},
|
||||
ImageProxySettings: model.ImageProxySettings{
|
||||
Enable: model.NewBool(true),
|
||||
ImageProxyType: model.NewString(model.ImageProxyTypeAtmosCamo),
|
||||
RemoteImageProxyURL: model.NewString("http://images.example.com"),
|
||||
RemoteImageProxyOptions: model.NewString("7e5f3fab20b94782b43cdb022a66985ef28ba355df2c5d5da3c9a05e4b697bac"),
|
||||
Enable: model.NewPointer(true),
|
||||
ImageProxyType: model.NewPointer(model.ImageProxyTypeAtmosCamo),
|
||||
RemoteImageProxyURL: model.NewPointer("http://images.example.com"),
|
||||
RemoteImageProxyOptions: model.NewPointer("7e5f3fab20b94782b43cdb022a66985ef28ba355df2c5d5da3c9a05e4b697bac"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -125,14 +125,14 @@ func TestOnConfigChange(t *testing.T) {
|
||||
require.Equal(t, "https://mattermost.example.com", proxy.backend.(*AtmosCamoBackend).siteURL.String())
|
||||
|
||||
newConfig := proxy.ConfigService.Config().Clone()
|
||||
newConfig.ImageProxySettings.ImageProxyType = model.NewString(model.ImageProxyTypeLocal)
|
||||
newConfig.ImageProxySettings.ImageProxyType = model.NewPointer(model.ImageProxyTypeLocal)
|
||||
|
||||
proxy.ConfigService.(*testutils.StaticConfigService).UpdateConfig(newConfig)
|
||||
|
||||
require.Equal(t, "https://mattermost.example.com", proxy.backend.(*LocalBackend).baseURL.String())
|
||||
|
||||
newConfig = proxy.ConfigService.Config().Clone()
|
||||
newConfig.ImageProxySettings.ImageProxyType = model.NewString(model.ImageProxyTypeAtmosCamo)
|
||||
newConfig.ImageProxySettings.ImageProxyType = model.NewPointer(model.ImageProxyTypeAtmosCamo)
|
||||
|
||||
proxy.ConfigService.(*testutils.StaticConfigService).UpdateConfig(newConfig)
|
||||
|
||||
@@ -146,7 +146,7 @@ func TestOnConfigChange(t *testing.T) {
|
||||
require.Equal(t, "https://mattermost.example.com", proxy.backend.(*LocalBackend).baseURL.String())
|
||||
|
||||
newConfig := proxy.ConfigService.Config().Clone()
|
||||
newConfig.ServiceSettings.SiteURL = model.NewString("https://new.example.com")
|
||||
newConfig.ServiceSettings.SiteURL = model.NewPointer("https://new.example.com")
|
||||
|
||||
proxy.ConfigService.(*testutils.StaticConfigService).UpdateConfig(newConfig)
|
||||
|
||||
@@ -161,7 +161,7 @@ func TestOnConfigChange(t *testing.T) {
|
||||
require.Equal(t, "https://mattermost.example.com", proxy.backend.(*AtmosCamoBackend).siteURL.String())
|
||||
|
||||
newConfig := proxy.ConfigService.Config().Clone()
|
||||
newConfig.ServiceSettings.SiteURL = model.NewString("https://new.example.com")
|
||||
newConfig.ServiceSettings.SiteURL = model.NewPointer("https://new.example.com")
|
||||
|
||||
proxy.ConfigService.(*testutils.StaticConfigService).UpdateConfig(newConfig)
|
||||
|
||||
@@ -176,8 +176,8 @@ func TestOnConfigChange(t *testing.T) {
|
||||
// require.Equal(t, "7e5f3fab20b94782b43cdb022a66985ef28ba355df2c5d5da3c9a05e4b697bac", proxy.backend.(*AtmosCamoBackend).remoteOptions)
|
||||
|
||||
newConfig := proxy.ConfigService.Config().Clone()
|
||||
newConfig.ImageProxySettings.RemoteImageProxyURL = model.NewString("https://new.example.com")
|
||||
newConfig.ImageProxySettings.RemoteImageProxyOptions = model.NewString("some other random hash")
|
||||
newConfig.ImageProxySettings.RemoteImageProxyURL = model.NewPointer("https://new.example.com")
|
||||
newConfig.ImageProxySettings.RemoteImageProxyOptions = model.NewPointer("some other random hash")
|
||||
|
||||
proxy.ConfigService.(*testutils.StaticConfigService).UpdateConfig(newConfig)
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ func makeTestLocalProxy() *ImageProxy {
|
||||
configService := &testutils.StaticConfigService{
|
||||
Cfg: &model.Config{
|
||||
ServiceSettings: model.ServiceSettings{
|
||||
SiteURL: model.NewString("https://mattermost.example.com"),
|
||||
AllowedUntrustedInternalConnections: model.NewString("127.0.0.1"),
|
||||
SiteURL: model.NewPointer("https://mattermost.example.com"),
|
||||
AllowedUntrustedInternalConnections: model.NewPointer("127.0.0.1"),
|
||||
},
|
||||
ImageProxySettings: model.ImageProxySettings{
|
||||
Enable: model.NewBool(true),
|
||||
ImageProxyType: model.NewString(model.ImageProxyTypeLocal),
|
||||
Enable: model.NewPointer(true),
|
||||
ImageProxyType: model.NewPointer(model.ImageProxyTypeLocal),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func TestService_sendProfileImageToRemote(t *testing.T) {
|
||||
|
||||
user := &model.User{
|
||||
Id: model.NewId(),
|
||||
RemoteId: model.NewString(rc.RemoteId),
|
||||
RemoteId: model.NewPointer(rc.RemoteId),
|
||||
}
|
||||
|
||||
provider := testImageProvider{}
|
||||
|
||||
@@ -62,11 +62,11 @@ func (s *BleveEngineTestSuite) setupStore() {
|
||||
|
||||
cfg := &model.Config{}
|
||||
cfg.SetDefaults()
|
||||
cfg.BleveSettings.EnableIndexing = model.NewBool(true)
|
||||
cfg.BleveSettings.EnableSearching = model.NewBool(true)
|
||||
cfg.BleveSettings.EnableAutocomplete = model.NewBool(true)
|
||||
cfg.BleveSettings.IndexDir = model.NewString(s.IndexDir)
|
||||
cfg.SqlSettings.DisableDatabaseSearch = model.NewBool(true)
|
||||
cfg.BleveSettings.EnableIndexing = model.NewPointer(true)
|
||||
cfg.BleveSettings.EnableSearching = model.NewPointer(true)
|
||||
cfg.BleveSettings.EnableAutocomplete = model.NewPointer(true)
|
||||
cfg.BleveSettings.IndexDir = model.NewPointer(s.IndexDir)
|
||||
cfg.SqlSettings.DisableDatabaseSearch = model.NewPointer(true)
|
||||
|
||||
s.SearchEngine = searchengine.NewBroker(cfg)
|
||||
s.Store = searchlayer.NewSearchLayer(&testlib.TestStore{Store: s.SQLStore}, s.SearchEngine, cfg)
|
||||
|
||||
@@ -43,8 +43,8 @@ func TestBleveIndexer(t *testing.T) {
|
||||
|
||||
cfg := &model.Config{
|
||||
BleveSettings: model.BleveSettings{
|
||||
EnableIndexing: model.NewBool(true),
|
||||
IndexDir: model.NewString(tempDir),
|
||||
EnableIndexing: model.NewPointer(true),
|
||||
IndexDir: model.NewPointer(tempDir),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ func (scs *Service) handleChannelCreation(invite channelInviteMsg, rc *model.Rem
|
||||
Header: invite.Header,
|
||||
Purpose: invite.Purpose,
|
||||
CreatorId: rc.CreatorId,
|
||||
Shared: model.NewBool(true),
|
||||
Shared: model.NewPointer(true),
|
||||
}
|
||||
|
||||
// check user perms?
|
||||
|
||||
@@ -93,8 +93,8 @@ func TestOnReceiveChannelInvite(t *testing.T) {
|
||||
createPostPermission := model.ChannelModeratedPermissionsMap[model.PermissionCreatePost.Id]
|
||||
createReactionPermission := model.ChannelModeratedPermissionsMap[model.PermissionAddReaction.Id]
|
||||
updateMap := model.ChannelModeratedRolesPatch{
|
||||
Guests: model.NewBool(false),
|
||||
Members: model.NewBool(false),
|
||||
Guests: model.NewPointer(false),
|
||||
Members: model.NewPointer(false),
|
||||
}
|
||||
|
||||
mockApp.On("CreateChannelWithUser", mockTypeReqContext, mockTypeChannel, mockTypeString).Return(channel, nil)
|
||||
@@ -175,7 +175,7 @@ func TestOnReceiveChannelInvite(t *testing.T) {
|
||||
{"two remotes", &model.User{Id: model.NewId(), RemoteId: &testRemoteID}, &model.User{Id: model.NewId(), RemoteId: &testRemoteID}, true, false},
|
||||
{"two locals", &model.User{Id: model.NewId()}, &model.User{Id: model.NewId()}, true, false},
|
||||
{"can't see", &model.User{Id: model.NewId(), RemoteId: &testRemoteID}, &model.User{Id: model.NewId()}, false, false},
|
||||
{"invalid remoteid", &model.User{Id: model.NewId(), RemoteId: model.NewString("bogus")}, &model.User{Id: model.NewId()}, true, false},
|
||||
{"invalid remoteid", &model.User{Id: model.NewId(), RemoteId: model.NewPointer("bogus")}, &model.User{Id: model.NewId()}, true, false},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
@@ -220,8 +220,8 @@ func (scs *Service) makeChannelReadOnly(channel *model.Channel) *model.AppError
|
||||
createPostPermission := model.ChannelModeratedPermissionsMap[model.PermissionCreatePost.Id]
|
||||
createReactionPermission := model.ChannelModeratedPermissionsMap[model.PermissionAddReaction.Id]
|
||||
updateMap := model.ChannelModeratedRolesPatch{
|
||||
Guests: model.NewBool(false),
|
||||
Members: model.NewBool(false),
|
||||
Guests: model.NewPointer(false),
|
||||
Members: model.NewPointer(false),
|
||||
}
|
||||
|
||||
readonlyChannelModerations := []*model.ChannelModerationPatch{
|
||||
|
||||
@@ -194,7 +194,7 @@ func (scs *Service) upsertSyncUser(c request.CTX, user *model.User, channel *mod
|
||||
var userSaved *model.User
|
||||
if euser == nil {
|
||||
// new user. Make sure the remoteID is correct and insert the record
|
||||
user.RemoteId = model.NewString(rc.RemoteId)
|
||||
user.RemoteId = model.NewPointer(rc.RemoteId)
|
||||
if userSaved, err = scs.insertSyncUser(c, user, channel, rc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -353,7 +353,7 @@ func (scs *Service) updateSyncUser(rctx request.CTX, patch *model.UserPatch, use
|
||||
func (scs *Service) upsertSyncPost(post *model.Post, targetChannel *model.Channel, rc *model.RemoteCluster) (*model.Post, error) {
|
||||
var appErr *model.AppError
|
||||
|
||||
post.RemoteId = model.NewString(rc.RemoteId)
|
||||
post.RemoteId = model.NewPointer(rc.RemoteId)
|
||||
rctx := request.EmptyContext(scs.server.Log())
|
||||
|
||||
rpost, err := scs.server.GetStore().Post().GetSingle(rctx, post.Id, true)
|
||||
@@ -450,7 +450,7 @@ func (scs *Service) upsertSyncReaction(reaction *model.Reaction, targetChannel *
|
||||
if user.GetRemoteID() != rc.RemoteId {
|
||||
return nil, fmt.Errorf("reaction sync failed: %w", ErrRemoteIDMismatch)
|
||||
}
|
||||
reaction.RemoteId = model.NewString(rc.RemoteId)
|
||||
reaction.RemoteId = model.NewPointer(rc.RemoteId)
|
||||
savedReaction, appErr = scs.app.SaveReactionForPost(request.EmptyContext(scs.server.Log()), reaction)
|
||||
} else {
|
||||
// make sure the reaction being deleted is owned by the remote
|
||||
|
||||
Ссылка в новой задаче
Block a user