mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
MM-55733 add request context to Channelstore.Save method (#26141)
This commit is contained in:
parent
401de9b321
commit
dc8fc773dc
34 changed files with 481 additions and 484 deletions
|
|
@ -434,7 +434,7 @@ func TestGetChannelsForScheme(t *testing.T) {
|
|||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
|
||||
channel1, errCh := th.App.Srv().Store().Channel().Save(channel1, 1000000)
|
||||
channel1, errCh := th.App.Srv().Store().Channel().Save(th.Context, channel1, 1000000)
|
||||
assert.NoError(t, errCh)
|
||||
|
||||
l2, _, err := th.SystemAdminClient.GetChannelsForScheme(context.Background(), scheme1.Id, 0, 100)
|
||||
|
|
@ -457,7 +457,7 @@ func TestGetChannelsForScheme(t *testing.T) {
|
|||
Type: model.ChannelTypeOpen,
|
||||
SchemeId: &scheme1.Id,
|
||||
}
|
||||
channel2, err = th.App.Srv().Store().Channel().Save(channel2, 1000000)
|
||||
channel2, err = th.App.Srv().Store().Channel().Save(th.Context, channel2, 1000000)
|
||||
assert.NoError(t, err)
|
||||
|
||||
l4, _, err := th.SystemAdminClient.GetChannelsForScheme(context.Background(), scheme1.Id, 0, 100)
|
||||
|
|
@ -742,7 +742,7 @@ func TestDeleteScheme(t *testing.T) {
|
|||
assert.Zero(t, role6.DeleteAt)
|
||||
|
||||
// Make sure this scheme is in use by a team.
|
||||
channel, err := th.App.Srv().Store().Channel().Save(&model.Channel{
|
||||
channel, err := th.App.Srv().Store().Channel().Save(th.Context, &model.Channel{
|
||||
TeamId: model.NewId(),
|
||||
DisplayName: model.NewId(),
|
||||
Name: model.NewId(),
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ func (a *App) RenameChannel(c request.CTX, channel *model.Channel, newChannelNam
|
|||
|
||||
func (a *App) CreateChannel(c request.CTX, channel *model.Channel, addMember bool) (*model.Channel, *model.AppError) {
|
||||
channel.DisplayName = strings.TrimSpace(channel.DisplayName)
|
||||
sc, nErr := a.Srv().Store().Channel().Save(channel, *a.Config().TeamSettings.MaxChannelsPerTeam)
|
||||
sc, nErr := a.Srv().Store().Channel().Save(c, channel, *a.Config().TeamSettings.MaxChannelsPerTeam)
|
||||
if nErr != nil {
|
||||
var invErr *store.ErrInvalidInput
|
||||
var cErr *store.ErrConflict
|
||||
|
|
@ -528,7 +528,7 @@ func (a *App) createGroupChannel(c request.CTX, userIDs []string) (*model.Channe
|
|||
Type: model.ChannelTypeGroup,
|
||||
}
|
||||
|
||||
channel, nErr := a.Srv().Store().Channel().Save(group, *a.Config().TeamSettings.MaxChannelsPerTeam)
|
||||
channel, nErr := a.Srv().Store().Channel().Save(c, group, *a.Config().TeamSettings.MaxChannelsPerTeam)
|
||||
if nErr != nil {
|
||||
var invErr *store.ErrInvalidInput
|
||||
var cErr *store.ErrConflict
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ func (th *TestHelper) createChannel(team *model.Team, channelType string) *model
|
|||
}
|
||||
|
||||
var err error
|
||||
if channel, err = th.store.Channel().Save(channel, *th.configStore.Get().TeamSettings.MaxChannelsPerTeam); err != nil {
|
||||
if channel, err = th.store.Channel().Save(th.Context, channel, *th.configStore.Get().TeamSettings.MaxChannelsPerTeam); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ func (th *TestHelper) CreateChannel(team *model.Team, options ...ChannelOption)
|
|||
}
|
||||
|
||||
var err error
|
||||
channel, err = th.Service.Store.Channel().Save(channel, 999)
|
||||
channel, err = th.Service.Store.Channel().Save(th.Context, channel, 999)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ func (a *App) AdjustTeamsFromProductLimits(teamLimits *model.TeamsLimits) *model
|
|||
}
|
||||
|
||||
func (a *App) CreateTeam(c request.CTX, team *model.Team) (*model.Team, *model.AppError) {
|
||||
rteam, err := a.ch.srv.teamService.CreateTeam(team)
|
||||
rteam, err := a.ch.srv.teamService.CreateTeam(c, team)
|
||||
if err != nil {
|
||||
var invErr *store.ErrInvalidInput
|
||||
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ import (
|
|||
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||
)
|
||||
|
||||
func (ts *TeamService) CreateTeam(team *model.Team) (*model.Team, error) {
|
||||
func (ts *TeamService) CreateTeam(rctx request.CTX, team *model.Team) (*model.Team, error) {
|
||||
team.InviteId = ""
|
||||
rteam, err := ts.store.Save(team)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if _, err := ts.createDefaultChannels(rteam.Id); err != nil {
|
||||
if _, err := ts.createDefaultChannels(rctx, rteam.Id); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ func (ts *TeamService) GetTeams(teamIDs []string) ([]*model.Team, error) {
|
|||
}
|
||||
|
||||
// CreateDefaultChannels creates channels in the given team for each channel returned by (*App).DefaultChannelNames.
|
||||
func (ts *TeamService) createDefaultChannels(teamID string) ([]*model.Channel, error) {
|
||||
func (ts *TeamService) createDefaultChannels(rctx request.CTX, teamID string) ([]*model.Channel, error) {
|
||||
displayNames := map[string]string{
|
||||
"town-square": i18n.T("api.channel.create_default_channels.town_square"),
|
||||
"off-topic": i18n.T("api.channel.create_default_channels.off_topic"),
|
||||
|
|
@ -56,7 +56,7 @@ func (ts *TeamService) createDefaultChannels(teamID string) ([]*model.Channel, e
|
|||
// and let the subscribers do the job, in this case it would be the channels service.
|
||||
// Currently we are adding services to the server and because of that we are using
|
||||
// the channel store here. This should be replaced in the future.
|
||||
if _, err := ts.channelStore.Save(channel, *ts.config().TeamSettings.MaxChannelsPerTeam); err != nil {
|
||||
if _, err := ts.channelStore.Save(rctx, channel, *ts.config().TeamSettings.MaxChannelsPerTeam); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
channels = append(channels, channel)
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ func TestCreateTeam(t *testing.T) {
|
|||
Type: model.TeamOpen,
|
||||
}
|
||||
|
||||
_, err := th.service.CreateTeam(team)
|
||||
_, err := th.service.CreateTeam(th.Context, team)
|
||||
require.NoError(t, err, "Should create a new team")
|
||||
|
||||
_, err = th.service.CreateTeam(team)
|
||||
_, err = th.service.CreateTeam(th.Context, team)
|
||||
require.Error(t, err, "Should not create a new team - team already exist")
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ func TestJoinUserToTeam(t *testing.T) {
|
|||
Type: model.TeamOpen,
|
||||
}
|
||||
|
||||
_, err := th.service.CreateTeam(team)
|
||||
_, err := th.service.CreateTeam(th.Context, team)
|
||||
require.NoError(t, err, "Should create a new team")
|
||||
|
||||
maxUsersPerTeam := th.service.config().TeamSettings.MaxUsersPerTeam
|
||||
|
|
|
|||
|
|
@ -2257,7 +2257,7 @@ func (s *OpenTracingLayerChannelStore) Restore(channelID string, timestamp int64
|
|||
return err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
|
||||
func (s *OpenTracingLayerChannelStore) Save(rctx request.CTX, channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.Save")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
|
|
@ -2266,7 +2266,7 @@ func (s *OpenTracingLayerChannelStore) Save(channel *model.Channel, maxChannelsP
|
|||
}()
|
||||
|
||||
defer span.Finish()
|
||||
result, err := s.ChannelStore.Save(channel, maxChannelsPerTeam)
|
||||
result, err := s.ChannelStore.Save(rctx, channel, maxChannelsPerTeam)
|
||||
if err != nil {
|
||||
span.LogFields(spanlog.Error(err))
|
||||
ext.Error.Set(span, true)
|
||||
|
|
|
|||
|
|
@ -2483,11 +2483,11 @@ func (s *RetryLayerChannelStore) Restore(channelID string, timestamp int64) erro
|
|||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
|
||||
func (s *RetryLayerChannelStore) Save(rctx request.CTX, channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.ChannelStore.Save(channel, maxChannelsPerTeam)
|
||||
result, err := s.ChannelStore.Save(rctx, channel, maxChannelsPerTeam)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,11 +66,8 @@ func (c *SearchChannelStore) indexChannel(rctx request.CTX, channel *model.Chann
|
|||
}
|
||||
}
|
||||
|
||||
func (c *SearchChannelStore) Save(channel *model.Channel, maxChannels int64) (*model.Channel, error) {
|
||||
// TODO: Use the actuall request context from the App layer
|
||||
// https://mattermost.atlassian.net/browse/MM-55733
|
||||
rctx := request.EmptyContext(c.rootStore.Logger())
|
||||
newChannel, err := c.ChannelStore.Save(channel, maxChannels)
|
||||
func (c *SearchChannelStore) Save(rctx request.CTX, channel *model.Channel, maxChannels int64) (*model.Channel, error) {
|
||||
newChannel, err := c.ChannelStore.Save(rctx, channel, maxChannels)
|
||||
if err == nil {
|
||||
c.indexChannel(rctx, newChannel)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ func (th *SearchTestHelper) deleteBot(botID string) error {
|
|||
}
|
||||
|
||||
func (th *SearchTestHelper) createChannel(teamID, name, displayName, purpose string, channelType model.ChannelType, user *model.User, deleted bool) (*model.Channel, error) {
|
||||
channel, err := th.Store.Channel().Save(&model.Channel{
|
||||
channel, err := th.Store.Channel().Save(th.Context, &model.Channel{
|
||||
TeamId: teamID,
|
||||
DisplayName: displayName,
|
||||
Name: name,
|
||||
|
|
@ -315,7 +315,7 @@ func (th *SearchTestHelper) createGroupChannel(teamID, displayName string, users
|
|||
Type: model.ChannelTypeGroup,
|
||||
}
|
||||
|
||||
channel, err := th.Store.Channel().Save(group, 10000)
|
||||
channel, err := th.Store.Channel().Save(th.Context, group, 10000)
|
||||
if err != nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ func (s SqlChannelStore) upsertPublicChannelT(transaction *sqlxTxWrapper, channe
|
|||
}
|
||||
|
||||
// Save writes the (non-direct) channel to the database.
|
||||
func (s SqlChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (_ *model.Channel, err error) {
|
||||
func (s SqlChannelStore) Save(rctx request.CTX, channel *model.Channel, maxChannelsPerTeam int64) (_ *model.Channel, err error) {
|
||||
if channel.DeleteAt != 0 {
|
||||
return nil, store.NewErrInvalidInput("Channel", "DeleteAt", channel.DeleteAt)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,18 +24,18 @@ func createAudit(ss store.Store, userId, sessionId string) *model.Audit {
|
|||
return &audit
|
||||
}
|
||||
|
||||
func createChannel(ss store.Store, teamId, creatorId string) *model.Channel {
|
||||
func createChannel(rctx request.CTX, ss store.Store, teamId, creatorId string) *model.Channel {
|
||||
m := model.Channel{}
|
||||
m.TeamId = teamId
|
||||
m.CreatorId = creatorId
|
||||
m.DisplayName = "Name"
|
||||
m.Name = "zz" + model.NewId() + "b"
|
||||
m.Type = model.ChannelTypeOpen
|
||||
c, _ := ss.Channel().Save(&m, -1)
|
||||
c, _ := ss.Channel().Save(rctx, &m, -1)
|
||||
return c
|
||||
}
|
||||
|
||||
func createChannelWithSchemeId(ss store.Store, schemeId *string) *model.Channel {
|
||||
func createChannelWithSchemeId(rctx request.CTX, ss store.Store, schemeId *string) *model.Channel {
|
||||
m := model.Channel{}
|
||||
m.SchemeId = schemeId
|
||||
m.TeamId = model.NewId()
|
||||
|
|
@ -43,7 +43,7 @@ func createChannelWithSchemeId(ss store.Store, schemeId *string) *model.Channel
|
|||
m.DisplayName = "Name"
|
||||
m.Name = "zz" + model.NewId() + "b"
|
||||
m.Type = model.ChannelTypeOpen
|
||||
c, _ := ss.Channel().Save(&m, -1)
|
||||
c, _ := ss.Channel().Save(rctx, &m, -1)
|
||||
return c
|
||||
}
|
||||
|
||||
|
|
@ -75,12 +75,12 @@ func createChannelMemberHistory(ss store.Store, channelId, userId string) *model
|
|||
return &m
|
||||
}
|
||||
|
||||
func createChannelWithTeamId(ss store.Store, id string) *model.Channel {
|
||||
return createChannel(ss, id, model.NewId())
|
||||
func createChannelWithTeamId(rctx request.CTX, ss store.Store, id string) *model.Channel {
|
||||
return createChannel(rctx, ss, id, model.NewId())
|
||||
}
|
||||
|
||||
func createChannelWithCreatorId(ss store.Store, id string) *model.Channel {
|
||||
return createChannel(ss, model.NewId(), id)
|
||||
func createChannelWithCreatorId(rctx request.CTX, ss store.Store, id string) *model.Channel {
|
||||
return createChannel(rctx, ss, model.NewId(), id)
|
||||
}
|
||||
|
||||
func createChannelMemberWithChannelId(rctx request.CTX, ss store.Store, id string) *model.ChannelMember {
|
||||
|
|
@ -452,8 +452,8 @@ func TestCheckChannelsChannelMemberHistoryIntegrity(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
channel := createChannel(ss, model.NewId(), model.NewId())
|
||||
user := createUser(rctx, ss)
|
||||
channel := createChannel(rctx, ss, model.NewId(), model.NewId())
|
||||
cmh := createChannelMemberHistory(ss, channel.Id, user.Id)
|
||||
|
||||
dbmap.Exec(`DELETE FROM Channels Where Id=?`, channel.Id)
|
||||
|
|
@ -483,7 +483,7 @@ func TestCheckChannelsChannelMembersIntegrity(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
channel := createChannel(ss, model.NewId(), model.NewId())
|
||||
channel := createChannel(rctx, ss, model.NewId(), model.NewId())
|
||||
member := createChannelMemberWithChannelId(rctx, ss, channel.Id)
|
||||
dbmap.Exec(`DELETE FROM Channels Where Id=?`, channel.Id)
|
||||
result := checkChannelsChannelMembersIntegrity(store)
|
||||
|
|
@ -539,7 +539,7 @@ func TestCheckChannelsOutgoingWebhooksIntegrity(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
channel := createChannel(ss, model.NewId(), model.NewId())
|
||||
channel := createChannel(rctx, ss, model.NewId(), model.NewId())
|
||||
channelId := channel.Id
|
||||
wh := createOutgoingWebhook(ss, model.NewId(), channelId, model.NewId())
|
||||
dbmap.Exec(`DELETE FROM Channels Where Id=?`, channel.Id)
|
||||
|
|
@ -652,7 +652,7 @@ func TestCheckPostsPostsRootIdIntegrity(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
channel := createChannel(ss, model.NewId(), model.NewId())
|
||||
channel := createChannel(rctx, ss, model.NewId(), model.NewId())
|
||||
root := createPost(rctx, ss, channel.Id, model.NewId(), "", "")
|
||||
rootId := root.Id
|
||||
post := createPost(rctx, ss, channel.Id, model.NewId(), root.Id, root.Id)
|
||||
|
|
@ -715,7 +715,7 @@ func TestCheckSchemesChannelsIntegrity(t *testing.T) {
|
|||
createDefaultRoles(ss)
|
||||
scheme := createScheme(ss)
|
||||
schemeId := scheme.Id
|
||||
channel := createChannelWithSchemeId(ss, &schemeId)
|
||||
channel := createChannelWithSchemeId(rctx, ss, &schemeId)
|
||||
dbmap.Exec(`DELETE FROM Schemes WHERE Id=?`, scheme.Id)
|
||||
result := checkSchemesChannelsIntegrity(store)
|
||||
require.NoError(t, result.Err)
|
||||
|
|
@ -805,7 +805,7 @@ func TestCheckTeamsChannelsIntegrity(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
channel := createChannelWithTeamId(ss, model.NewId())
|
||||
channel := createChannelWithTeamId(rctx, ss, model.NewId())
|
||||
result := checkTeamsChannelsIntegrity(store)
|
||||
require.NoError(t, result.Err)
|
||||
data := result.Data.(model.RelationalIntegrityCheckData)
|
||||
|
|
@ -818,7 +818,7 @@ func TestCheckTeamsChannelsIntegrity(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("should not include direct channel with empty teamid", func(t *testing.T) {
|
||||
channel := createChannelWithTeamId(ss, model.NewId())
|
||||
channel := createChannelWithTeamId(rctx, ss, model.NewId())
|
||||
userA := createUser(rctx, ss)
|
||||
userB := createUser(rctx, ss)
|
||||
direct, err := ss.Channel().CreateDirectChannel(rctx, userA, userB)
|
||||
|
|
@ -839,7 +839,7 @@ func TestCheckTeamsChannelsIntegrity(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("should include direct channel with non empty teamid", func(t *testing.T) {
|
||||
channel := createChannelWithTeamId(ss, model.NewId())
|
||||
channel := createChannelWithTeamId(rctx, ss, model.NewId())
|
||||
userA := createUser(rctx, ss)
|
||||
userB := createUser(rctx, ss)
|
||||
direct, err := ss.Channel().CreateDirectChannel(rctx, userA, userB)
|
||||
|
|
@ -1051,7 +1051,7 @@ func TestCheckUsersChannelsIntegrity(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
channel := createChannelWithCreatorId(ss, model.NewId())
|
||||
channel := createChannelWithCreatorId(rctx, ss, model.NewId())
|
||||
result := checkUsersChannelsIntegrity(store)
|
||||
require.NoError(t, result.Err)
|
||||
data := result.Data.(model.RelationalIntegrityCheckData)
|
||||
|
|
@ -1079,7 +1079,7 @@ func TestCheckUsersChannelMemberHistoryIntegrity(t *testing.T) {
|
|||
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
user := createUser(rctx, ss)
|
||||
channel := createChannel(ss, model.NewId(), model.NewId())
|
||||
channel := createChannel(rctx, ss, model.NewId(), model.NewId())
|
||||
cmh := createChannelMemberHistory(ss, channel.Id, user.Id)
|
||||
dbmap.Exec(`DELETE FROM Users WHERE Id=?`, user.Id)
|
||||
result := checkUsersChannelMemberHistoryIntegrity(store)
|
||||
|
|
@ -1109,7 +1109,7 @@ func TestCheckUsersChannelMembersIntegrity(t *testing.T) {
|
|||
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
user := createUser(rctx, ss)
|
||||
channel := createChannelWithCreatorId(ss, user.Id)
|
||||
channel := createChannelWithCreatorId(rctx, ss, user.Id)
|
||||
member := createChannelMember(rctx, ss, channel.Id, user.Id)
|
||||
dbmap.Exec(`DELETE FROM Users WHERE Id=?`, user.Id)
|
||||
result := checkUsersChannelMembersIntegrity(store)
|
||||
|
|
@ -1622,7 +1622,7 @@ func TestCheckThreadsTeamsIntegrity(t *testing.T) {
|
|||
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
team := createTeam(ss)
|
||||
channel := createChannel(ss, team.Id, model.NewId())
|
||||
channel := createChannel(rctx, ss, team.Id, model.NewId())
|
||||
root := createPost(rctx, ss, channel.Id, model.NewId(), "", "")
|
||||
post := createPost(rctx, ss, channel.Id, model.NewId(), root.Id, root.Id)
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ type TeamStore interface {
|
|||
}
|
||||
|
||||
type ChannelStore interface {
|
||||
Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error)
|
||||
Save(rctx request.CTX, channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error)
|
||||
CreateDirectChannel(ctx request.CTX, userID *model.User, otherUserID *model.User, channelOptions ...model.ChannelOption) (*model.Channel, error)
|
||||
SaveDirectChannel(ctx request.CTX, channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) (*model.Channel, error)
|
||||
Update(ctx request.CTX, channel *model.Channel) (*model.Channel, error)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ func testLogJoinEvent(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, err := ss.Channel().Save(&ch, -1)
|
||||
channel, err := ss.Channel().Save(rctx, &ch, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
// and a test user
|
||||
|
|
@ -60,7 +60,7 @@ func testLogLeaveEvent(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, err := ss.Channel().Save(&ch, -1)
|
||||
channel, err := ss.Channel().Save(rctx, &ch, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
// and a test user
|
||||
|
|
@ -89,7 +89,7 @@ func testGetUsersInChannelAtChannelMemberHistory(t *testing.T, rctx request.CTX,
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, err := ss.Channel().Save(ch, -1)
|
||||
channel, err := ss.Channel().Save(rctx, ch, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
// and a test user
|
||||
|
|
@ -185,7 +185,7 @@ func testGetUsersInChannelAtChannelMembers(t *testing.T, rctx request.CTX, ss st
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, err := ss.Channel().Save(channel, -1)
|
||||
channel, err := ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
// and a test user
|
||||
|
|
@ -297,7 +297,7 @@ func testPermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, err := ss.Channel().Save(channel, -1)
|
||||
channel, err := ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
// and two test users
|
||||
|
|
@ -358,7 +358,7 @@ func testPermanentDeleteBatchForRetentionPolicies(t *testing.T, rctx request.CTX
|
|||
Type: model.TeamOpen,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -403,7 +403,7 @@ func testGetChannelsLeftSince(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Type: model.TeamOpen,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -193,7 +193,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store
|
|||
team := setupTeam(t, rctx, ss, userId)
|
||||
|
||||
// Set up two channels, one favorited and one not
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
Type: model.ChannelTypeOpen,
|
||||
Name: "channel1",
|
||||
|
|
@ -206,7 +206,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel2, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
Type: model.ChannelTypeOpen,
|
||||
Name: "channel2",
|
||||
|
|
@ -254,7 +254,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store
|
|||
team := setupTeam(t, rctx, ss, userId)
|
||||
|
||||
// Set up two channels
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
Type: model.ChannelTypeOpen,
|
||||
Name: "channel1",
|
||||
|
|
@ -268,7 +268,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel2, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
Type: model.ChannelTypeOpen,
|
||||
Name: "channel2",
|
||||
|
|
@ -392,7 +392,7 @@ func testCreateInitialSidebarCategories(t *testing.T, rctx request.CTX, ss store
|
|||
team2 := setupTeam(t, rctx, ss, userId)
|
||||
|
||||
// Set up a channel on another team and favorite it
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team2.Id,
|
||||
Type: model.ChannelTypeOpen,
|
||||
Name: "channel1",
|
||||
|
|
@ -537,13 +537,13 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
require.NotEmpty(t, res)
|
||||
|
||||
// Create some channels
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
Name: model.NewId(),
|
||||
}, 100)
|
||||
require.NoError(t, err)
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
Name: model.NewId(),
|
||||
|
|
@ -588,13 +588,13 @@ func testCreateSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type)
|
||||
|
||||
// Create some channels
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
Name: model.NewId(),
|
||||
}, 100)
|
||||
require.NoError(t, nErr)
|
||||
channel2, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel2, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
Name: model.NewId(),
|
||||
|
|
@ -721,7 +721,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq
|
|||
require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type)
|
||||
|
||||
// Join some channels
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel1",
|
||||
DisplayName: "DEF",
|
||||
TeamId: team.Id,
|
||||
|
|
@ -735,7 +735,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq
|
|||
})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel2, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel2, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel2",
|
||||
DisplayName: "ABC",
|
||||
TeamId: team.Id,
|
||||
|
|
@ -789,7 +789,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq
|
|||
channelsCategory := categories.Categories[1]
|
||||
|
||||
// Join a channel on another team
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "abc",
|
||||
TeamId: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
|
|
@ -834,7 +834,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq
|
|||
require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type)
|
||||
|
||||
// Join some channels
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel1",
|
||||
DisplayName: "DEF",
|
||||
TeamId: team.Id,
|
||||
|
|
@ -848,7 +848,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq
|
|||
})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel2, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel2, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel2",
|
||||
DisplayName: "ABC",
|
||||
TeamId: team.Id,
|
||||
|
|
@ -944,7 +944,7 @@ func testGetSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s Sq
|
|||
dmsCategory := categories.Categories[2]
|
||||
|
||||
// Create a GM
|
||||
gmChannel, nErr := ss.Channel().Save(&model.Channel{
|
||||
gmChannel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "abc",
|
||||
TeamId: "",
|
||||
Type: model.ChannelTypeGroup,
|
||||
|
|
@ -1293,7 +1293,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory.Type)
|
||||
|
||||
// Join a channel
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
|
|
@ -1553,7 +1553,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
require.Equal(t, model.SidebarCategoryChannels, channelsCategory2.Type)
|
||||
|
||||
// Have both users join a channel
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
|
|
@ -1666,7 +1666,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
team := setupTeam(t, rctx, ss, userId)
|
||||
|
||||
// Create some channels
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
|
|
@ -1834,7 +1834,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
team := setupTeam(t, rctx, ss, userId)
|
||||
|
||||
// Join a channel
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
|
|
@ -1902,7 +1902,7 @@ func testUpdateSidebarCategories(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
team := setupTeam(t, rctx, ss, userId)
|
||||
|
||||
// Join a channel
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
|
|
@ -2002,7 +2002,7 @@ func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store,
|
|||
}
|
||||
|
||||
// Create some channels and assign them to a custom category
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: model.NewId(),
|
||||
TeamId: teamId,
|
||||
Type: model.ChannelTypeOpen,
|
||||
|
|
@ -2051,7 +2051,7 @@ func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store,
|
|||
}
|
||||
|
||||
// Create some channels and assign them to a custom category
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: model.NewId(),
|
||||
TeamId: teamId,
|
||||
Type: model.ChannelTypeOpen,
|
||||
|
|
@ -2118,7 +2118,7 @@ func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store,
|
|||
require.Len(t, res.Categories, 3)
|
||||
|
||||
// On the first team, create some channels and assign them to a custom category
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: model.NewId(),
|
||||
TeamId: teamId,
|
||||
Type: model.ChannelTypeOpen,
|
||||
|
|
@ -2134,7 +2134,7 @@ func testClearSidebarOnTeamLeave(t *testing.T, rctx request.CTX, ss store.Store,
|
|||
require.NoError(t, err)
|
||||
|
||||
// Do the same on the second team
|
||||
channel2, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel2, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: model.NewId(),
|
||||
TeamId: team2.Id,
|
||||
Type: model.ChannelTypeOpen,
|
||||
|
|
@ -2211,7 +2211,7 @@ func testDeleteSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s
|
|||
}
|
||||
|
||||
// Create some channels
|
||||
channel1, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: model.NewId(),
|
||||
TeamId: teamId,
|
||||
Type: model.ChannelTypeOpen,
|
||||
|
|
@ -2219,7 +2219,7 @@ func testDeleteSidebarCategory(t *testing.T, rctx request.CTX, ss store.Store, s
|
|||
require.NoError(t, nErr)
|
||||
defer ss.Channel().PermanentDelete(rctx, channel1.Id)
|
||||
|
||||
channel2, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel2, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: model.NewId(),
|
||||
TeamId: teamId,
|
||||
Type: model.ChannelTypePrivate,
|
||||
|
|
@ -2304,7 +2304,7 @@ func testUpdateSidebarChannelsByPreferences(t *testing.T, rctx request.CTX, ss s
|
|||
require.NoError(t, nErr)
|
||||
require.NotEmpty(t, res)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: teamId,
|
||||
|
|
@ -2353,7 +2353,7 @@ func testSidebarCategoryDeadlock(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
team := setupTeam(t, rctx, ss, userID)
|
||||
|
||||
// Join a channel
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
Name: "channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
TeamId: team.Id,
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ func testComplianceExport(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
c1.DisplayName = "Channel2"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, nErr = ss.Channel().Save(c1, -1)
|
||||
c1, nErr = ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
o1 := &model.Post{}
|
||||
|
|
@ -266,7 +266,7 @@ func testComplianceExportDirectMessages(t *testing.T, rctx request.CTX, ss store
|
|||
c1.DisplayName = "Channel2"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, nErr = ss.Channel().Save(c1, -1)
|
||||
c1, nErr = ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
cDM, nErr := ss.Channel().CreateDirectChannel(rctx, u1, u2)
|
||||
|
|
@ -446,7 +446,7 @@ func testMessageExportPublicChannel(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
DisplayName: "Public Channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, nErr = ss.Channel().Save(channel, -1)
|
||||
channel, nErr = ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// user1 posts twice in the public channel
|
||||
|
|
@ -550,7 +550,7 @@ func testMessageExportPrivateChannel(t *testing.T, rctx request.CTX, ss store.St
|
|||
DisplayName: "Private Channel",
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
channel, nErr = ss.Channel().Save(channel, -1)
|
||||
channel, nErr = ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// user1 posts twice in the private channel
|
||||
|
|
@ -748,7 +748,7 @@ func testMessageExportGroupMessageChannel(t *testing.T, rctx request.CTX, ss sto
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeGroup,
|
||||
}
|
||||
groupMessageChannel, nErr = ss.Channel().Save(groupMessageChannel, -1)
|
||||
groupMessageChannel, nErr = ss.Channel().Save(rctx, groupMessageChannel, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// user1 posts in the GM
|
||||
|
|
@ -823,7 +823,7 @@ func testEditExportMessage(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
DisplayName: "Public Channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, nErr = ss.Channel().Save(channel, -1)
|
||||
channel, nErr = ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// user1 posts in the public channel
|
||||
|
|
@ -915,7 +915,7 @@ func testEditAfterExportMessage(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
DisplayName: "Public Channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, nErr = ss.Channel().Save(channel, -1)
|
||||
channel, nErr = ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// user1 posts in the public channel
|
||||
|
|
@ -1026,7 +1026,7 @@ func testDeleteExportMessage(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
DisplayName: "Public Channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, nErr = ss.Channel().Save(channel, -1)
|
||||
channel, nErr = ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// user1 posts in the public channel
|
||||
|
|
@ -1111,7 +1111,7 @@ func testDeleteAfterExportMessage(t *testing.T, rctx request.CTX, ss store.Store
|
|||
DisplayName: "Public Channel",
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, nErr = ss.Channel().Save(channel, -1)
|
||||
channel, nErr = ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// user1 posts in the public channel
|
||||
|
|
|
|||
|
|
@ -683,14 +683,14 @@ func testFileInfoStoreGetFilesBatchForIndexing(t *testing.T, rctx request.CTX, s
|
|||
c1.DisplayName = "Channel1"
|
||||
c1.Name = "zz" + model.NewId() + "b"
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, _ = ss.Channel().Save(c1, -1)
|
||||
c1, _ = ss.Channel().Save(rctx, c1, -1)
|
||||
|
||||
c2 := &model.Channel{}
|
||||
c2.TeamId = model.NewId()
|
||||
c2.DisplayName = "Channel2"
|
||||
c2.Name = "zz" + model.NewId() + "b"
|
||||
c2.Type = model.ChannelTypeOpen
|
||||
c2, _ = ss.Channel().Save(c2, -1)
|
||||
c2, _ = ss.Channel().Save(rctx, c2, -1)
|
||||
|
||||
o1 := &model.Post{}
|
||||
o1.ChannelId = c1.Id
|
||||
|
|
|
|||
|
|
@ -1151,7 +1151,7 @@ func testGroupGetMemberUsersNotInChannel(t *testing.T, rctx request.CTX, ss stor
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen, // Query does not look at type so this shouldn't matter.
|
||||
}
|
||||
channel, nErr := ss.Channel().Save(channel, 9999)
|
||||
channel, nErr := ss.Channel().Save(rctx, channel, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// returns no members when channel does not exist
|
||||
|
|
@ -2045,7 +2045,7 @@ func testChannelMembersToAdd(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen, // Query does not look at type so this shouldn't matter.
|
||||
}
|
||||
channel, nErr = ss.Channel().Save(channel, 9999)
|
||||
channel, nErr = ss.Channel().Save(rctx, channel, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// Create GroupChannel
|
||||
|
|
@ -2243,7 +2243,7 @@ func testChannelMembersToAddSingleChannel(t *testing.T, rctx request.CTX, ss sto
|
|||
Name: "z-z-" + model.NewId() + "a",
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel1, nErr = ss.Channel().Save(channel1, 999)
|
||||
channel1, nErr = ss.Channel().Save(rctx, channel1, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel2 := &model.Channel{
|
||||
|
|
@ -2251,7 +2251,7 @@ func testChannelMembersToAddSingleChannel(t *testing.T, rctx request.CTX, ss sto
|
|||
Name: "z-z-" + model.NewId() + "a",
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel2, nErr = ss.Channel().Save(channel2, 999)
|
||||
channel2, nErr = ss.Channel().Save(rctx, channel2, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, err = ss.Group().CreateGroupSyncable(model.NewGroupChannel(group1.Id, channel1.Id, true))
|
||||
|
|
@ -2528,7 +2528,7 @@ func testChannelMembersToRemoveSingleChannel(t *testing.T, rctx request.CTX, ss
|
|||
Type: model.ChannelTypeOpen,
|
||||
GroupConstrained: model.NewBool(true),
|
||||
}
|
||||
channel1, nErr := ss.Channel().Save(channel1, 999)
|
||||
channel1, nErr := ss.Channel().Save(rctx, channel1, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel2 := &model.Channel{
|
||||
|
|
@ -2537,7 +2537,7 @@ func testChannelMembersToRemoveSingleChannel(t *testing.T, rctx request.CTX, ss
|
|||
Type: model.ChannelTypeOpen,
|
||||
GroupConstrained: model.NewBool(true),
|
||||
}
|
||||
channel2, nErr = ss.Channel().Save(channel2, 999)
|
||||
channel2, nErr = ss.Channel().Save(rctx, channel2, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
for _, user := range []*model.User{user1, user2} {
|
||||
|
|
@ -2630,7 +2630,7 @@ func pendingMemberRemovalsDataSetup(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
Type: model.ChannelTypePrivate,
|
||||
GroupConstrained: model.NewBool(true),
|
||||
}
|
||||
channelConstrained, nErr = ss.Channel().Save(channelConstrained, 9999)
|
||||
channelConstrained, nErr = ss.Channel().Save(rctx, channelConstrained, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channelUnconstrained := &model.Channel{
|
||||
|
|
@ -2639,7 +2639,7 @@ func pendingMemberRemovalsDataSetup(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
channelUnconstrained, nErr = ss.Channel().Save(channelUnconstrained, 9999)
|
||||
channelUnconstrained, nErr = ss.Channel().Save(rctx, channelUnconstrained, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// create teams
|
||||
|
|
@ -2741,7 +2741,7 @@ func testGetGroupsByChannel(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel1, err := ss.Channel().Save(channel1, 9999)
|
||||
channel1, err := ss.Channel().Save(rctx, channel1, 9999)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Create Groups 1, 2 and a deleted group
|
||||
|
|
@ -2791,7 +2791,7 @@ func testGetGroupsByChannel(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel2, nErr := ss.Channel().Save(channel2, 9999)
|
||||
channel2, nErr := ss.Channel().Save(rctx, channel2, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// Create Group3
|
||||
|
|
@ -2989,7 +2989,7 @@ func testGetGroupsAssociatedToChannelsByTeam(t *testing.T, rctx request.CTX, ss
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel1, err := ss.Channel().Save(channel1, 9999)
|
||||
channel1, err := ss.Channel().Save(rctx, channel1, 9999)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Create Groups 1, 2 and a deleted group
|
||||
|
|
@ -3039,7 +3039,7 @@ func testGetGroupsAssociatedToChannelsByTeam(t *testing.T, rctx request.CTX, ss
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel2, err = ss.Channel().Save(channel2, 9999)
|
||||
channel2, err = ss.Channel().Save(rctx, channel2, 9999)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Create Group3
|
||||
|
|
@ -3481,7 +3481,7 @@ func testGetGroups(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
channel1, nErr := ss.Channel().Save(channel1, 9999)
|
||||
channel1, nErr := ss.Channel().Save(rctx, channel1, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// Create Groups 1 and 2
|
||||
|
|
@ -3545,7 +3545,7 @@ func testGetGroups(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
channel2, nErr = ss.Channel().Save(channel2, 9999)
|
||||
channel2, nErr = ss.Channel().Save(rctx, channel2, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// Create Channel3
|
||||
|
|
@ -3555,7 +3555,7 @@ func testGetGroups(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
channel3, nErr = ss.Channel().Save(channel3, 9999)
|
||||
channel3, nErr = ss.Channel().Save(rctx, channel3, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// Create Group3
|
||||
|
|
@ -3669,7 +3669,7 @@ func testGetGroups(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
channel4, nErr = ss.Channel().Save(channel4, 9999)
|
||||
channel4, nErr = ss.Channel().Save(rctx, channel4, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
testCases := []struct {
|
||||
|
|
@ -4164,7 +4164,7 @@ func testChannelMembersMinusGroupMembers(t *testing.T, rctx request.CTX, ss stor
|
|||
Type: model.ChannelTypePrivate,
|
||||
GroupConstrained: model.NewBool(true),
|
||||
}
|
||||
channel, err := ss.Channel().Save(channel, 9999)
|
||||
channel, err := ss.Channel().Save(rctx, channel, 9999)
|
||||
require.NoError(t, err)
|
||||
|
||||
for i := 0; i < numberOfUsers; i++ {
|
||||
|
|
@ -4391,7 +4391,7 @@ func groupTestAdminRoleGroupsForSyncableMemberChannel(t *testing.T, rctx request
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, nErr := ss.Channel().Save(channel, 9999)
|
||||
channel, nErr := ss.Channel().Save(rctx, channel, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, err = ss.Group().CreateGroupSyncable(&model.GroupSyncable{
|
||||
|
|
@ -4688,7 +4688,7 @@ func groupTestPermittedSyncableAdminsChannel(t *testing.T, rctx request.CTX, ss
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, nErr := ss.Channel().Save(channel, 9999)
|
||||
channel, nErr := ss.Channel().Save(rctx, channel, 9999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, err = ss.Group().CreateGroupSyncable(&model.GroupSyncable{
|
||||
|
|
@ -4850,7 +4850,7 @@ func groupTestpUpdateMembersRoleChannel(t *testing.T, rctx request.CTX, ss store
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen, // Query does not look at type so this shouldn't matter.
|
||||
}
|
||||
channel, err := ss.Channel().Save(channel, 9999)
|
||||
channel, err := ss.Channel().Save(rctx, channel, 9999)
|
||||
require.NoError(t, err)
|
||||
|
||||
user1 := &model.User{
|
||||
|
|
@ -5030,7 +5030,7 @@ func groupTestGroupTeamCount(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}
|
||||
|
||||
func groupTestGroupChannelCount(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: model.NewId(),
|
||||
DisplayName: model.NewId(),
|
||||
Name: model.NewId(),
|
||||
|
|
|
|||
|
|
@ -2081,25 +2081,25 @@ func (_m *ChannelStore) Restore(channelID string, timestamp int64) error {
|
|||
return r0
|
||||
}
|
||||
|
||||
// Save provides a mock function with given fields: channel, maxChannelsPerTeam
|
||||
func (_m *ChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
|
||||
ret := _m.Called(channel, maxChannelsPerTeam)
|
||||
// Save provides a mock function with given fields: rctx, channel, maxChannelsPerTeam
|
||||
func (_m *ChannelStore) Save(rctx request.CTX, channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
|
||||
ret := _m.Called(rctx, channel, maxChannelsPerTeam)
|
||||
|
||||
var r0 *model.Channel
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(*model.Channel, int64) (*model.Channel, error)); ok {
|
||||
return rf(channel, maxChannelsPerTeam)
|
||||
if rf, ok := ret.Get(0).(func(request.CTX, *model.Channel, int64) (*model.Channel, error)); ok {
|
||||
return rf(rctx, channel, maxChannelsPerTeam)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(*model.Channel, int64) *model.Channel); ok {
|
||||
r0 = rf(channel, maxChannelsPerTeam)
|
||||
if rf, ok := ret.Get(0).(func(request.CTX, *model.Channel, int64) *model.Channel); ok {
|
||||
r0 = rf(rctx, channel, maxChannelsPerTeam)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Channel)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(*model.Channel, int64) error); ok {
|
||||
r1 = rf(channel, maxChannelsPerTeam)
|
||||
if rf, ok := ret.Get(1).(func(request.CTX, *model.Channel, int64) error); ok {
|
||||
r1 = rf(rctx, channel, maxChannelsPerTeam)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,13 +351,13 @@ func testPostPersistentNotificationStoreDelete(t *testing.T, rctx request.CTX, s
|
|||
require.NoError(t, err)
|
||||
|
||||
c1 := &model.Channel{TeamId: t1.Id, Name: model.NewId(), DisplayName: "c1", Type: model.ChannelTypeOpen}
|
||||
_, err = ss.Channel().Save(c1, -1)
|
||||
_, err = ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, err)
|
||||
c2 := &model.Channel{TeamId: t1.Id, Name: model.NewId(), DisplayName: "c2", Type: model.ChannelTypeOpen}
|
||||
_, err = ss.Channel().Save(c2, -1)
|
||||
_, err = ss.Channel().Save(rctx, c2, -1)
|
||||
require.NoError(t, err)
|
||||
c3 := &model.Channel{TeamId: t2.Id, Name: model.NewId(), DisplayName: "c1", Type: model.ChannelTypeOpen}
|
||||
_, err = ss.Channel().Save(c3, -1)
|
||||
_, err = ss.Channel().Save(rctx, c3, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
p1 := model.Post{}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Save replies", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -95,7 +95,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
o1.RootId = model.NewId()
|
||||
o1.Message = NewTestId()
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -109,7 +109,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
o2.RootId = o1.RootId
|
||||
o2.Message = NewTestId()
|
||||
|
||||
channel3, err := ss.Channel().Save(&model.Channel{
|
||||
channel3, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName3",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -151,7 +151,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Update reply should update the UpdateAt of the root post", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -191,7 +191,7 @@ func testPostStoreSave(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
channel.DisplayName = NewTestId()
|
||||
channel.Type = model.ChannelTypeOpen
|
||||
|
||||
_, err := ss.Channel().Save(&channel, 100)
|
||||
_, err := ss.Channel().Save(rctx, &channel, 100)
|
||||
require.NoError(t, err)
|
||||
|
||||
post := model.Post{}
|
||||
|
|
@ -303,7 +303,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Save replies", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -311,7 +311,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -319,7 +319,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel3, err := ss.Channel().Save(&model.Channel{
|
||||
channel3, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName3",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -327,7 +327,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel4, err := ss.Channel().Save(&model.Channel{
|
||||
channel4, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName4",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -385,7 +385,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Update reply should update the UpdateAt of the root post", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -440,7 +440,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
channel.DisplayName = NewTestId()
|
||||
channel.Type = model.ChannelTypeOpen
|
||||
|
||||
_, err := ss.Channel().Save(&channel, 100)
|
||||
_, err := ss.Channel().Save(rctx, &channel, 100)
|
||||
require.NoError(t, err)
|
||||
|
||||
post1 := model.Post{}
|
||||
|
|
@ -470,7 +470,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Thread participants", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -486,7 +486,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
root, err := ss.Post().Save(rctx, &o1)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -494,7 +494,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel3, err := ss.Channel().Save(&model.Channel{
|
||||
channel3, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName3",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -502,7 +502,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel4, err := ss.Channel().Save(&model.Channel{
|
||||
channel4, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName4",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -510,7 +510,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel5, err := ss.Channel().Save(&model.Channel{
|
||||
channel5, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName5",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -581,7 +581,7 @@ func testPostStoreSaveMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
func testPostStoreSaveChannelMsgCounts(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
c1 := &model.Channel{Name: model.NewId(), DisplayName: "posttestchannel", Type: model.ChannelTypeOpen, TeamId: model.NewId()}
|
||||
_, err := ss.Channel().Save(c1, 1000000)
|
||||
_, err := ss.Channel().Save(rctx, c1, 1000000)
|
||||
require.NoError(t, err)
|
||||
|
||||
o1 := model.Post{}
|
||||
|
|
@ -627,7 +627,7 @@ func testPostStoreSaveChannelMsgCounts(t *testing.T, rctx request.CTX, ss store.
|
|||
|
||||
func testPostStoreGet(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -662,7 +662,7 @@ func testPostStoreGet(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
t.Run("Post thread is followed", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -692,7 +692,7 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Post thread is explicitly not followed", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -722,7 +722,7 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Post threadmembership does not exist", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -747,7 +747,7 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Pagination", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -899,7 +899,7 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
func testPostStoreGetSingle(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -967,7 +967,7 @@ func testPostStoreGetSingle(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
func testPostStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1046,7 +1046,7 @@ func testPostStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
require.Equal(t, ro3a.Hashtags, o3a.Hashtags, "Failed to update/get")
|
||||
}
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1082,7 +1082,7 @@ func testPostStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
t.Run("single post, no replies", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1131,7 +1131,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("thread with one reply", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1173,7 +1173,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("thread with multiple replies", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1207,7 +1207,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1244,7 +1244,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("thread with multiple replies, update thread last reply at", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1321,7 +1321,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("thread with file attachments", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1404,7 +1404,7 @@ func testPostStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1451,7 +1451,7 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor
|
|||
r3, err = ss.Reaction().Save(r3)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1473,7 +1473,7 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor
|
|||
_, err = ss.Reaction().Save(r4)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel3, err := ss.Channel().Save(&model.Channel{
|
||||
channel3, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName3",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1575,7 +1575,7 @@ func testPostStorePermDelete1Level(t *testing.T, rctx request.CTX, ss store.Stor
|
|||
|
||||
func testPostStorePermDelete1Level2(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1598,7 +1598,7 @@ func testPostStorePermDelete1Level2(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
o2, err = ss.Post().Save(rctx, o2)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1628,7 +1628,7 @@ func testPostStorePermDelete1Level2(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
|
||||
func testPostStoreGetWithChildren(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1683,7 +1683,7 @@ func testPostStoreGetWithChildren(t *testing.T, rctx request.CTX, ss store.Store
|
|||
|
||||
func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1787,7 +1787,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, rctx request.CTX, ss store.S
|
|||
func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
t.Run("without threads", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1891,7 +1891,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S
|
|||
})
|
||||
t.Run("with threads", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -1998,7 +1998,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S
|
|||
})
|
||||
t.Run("with threads (skipFetchThreads)", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -2113,7 +2113,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S
|
|||
})
|
||||
t.Run("with threads (collapsedThreads)", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -2217,7 +2217,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, rctx request.CTX, ss store.S
|
|||
func testPostStoreGetPostsSince(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
t.Run("should return posts created after the given time", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -2299,7 +2299,7 @@ func testPostStoreGetPostsSince(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
|
||||
t.Run("should return empty list when nothing has changed", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -2329,7 +2329,7 @@ func testPostStoreGetPostsSince(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
ss.Post().ClearCaches()
|
||||
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -2366,7 +2366,7 @@ func testPostStoreGetPostsSince(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
|
||||
func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -2554,7 +2554,7 @@ func testPostStoreGetPosts(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
func testPostStoreGetPostBeforeAfter(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -2600,7 +2600,7 @@ func testPostStoreGetPostBeforeAfter(t *testing.T, rctx request.CTX, ss store.St
|
|||
require.NoError(t, err)
|
||||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -2683,7 +2683,7 @@ func testUserCountsWithPostsByDay(t *testing.T, rctx request.CTX, ss store.Store
|
|||
c1.DisplayName = "Channel2"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, nErr := ss.Channel().Save(c1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
o1 := &model.Post{}
|
||||
|
|
@ -2742,7 +2742,7 @@ func testPostCountsByDay(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
c1.DisplayName = "Channel2"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, nErr := ss.Channel().Save(c1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
o1 := &model.Post{}
|
||||
|
|
@ -2859,7 +2859,7 @@ func testPostCounts(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
c1.DisplayName = "Channel2"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, nErr := ss.Channel().Save(c1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
// system post
|
||||
|
|
@ -3009,7 +3009,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor
|
|||
c1.DisplayName = "Channel1"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, err := ss.Channel().Save(c1, -1)
|
||||
c1, err := ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
o1 := &model.Post{}
|
||||
|
|
@ -3045,7 +3045,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor
|
|||
require.NoError(t, err)
|
||||
|
||||
teamId := model.NewId()
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3088,7 +3088,7 @@ func testPostStoreGetFlaggedPostsForTeam(t *testing.T, rctx request.CTX, ss stor
|
|||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
// Post on channel where user is not a member
|
||||
channel3, err := ss.Channel().Save(&model.Channel{
|
||||
channel3, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName3",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3228,7 +3228,7 @@ func testPostStoreGetFlaggedPosts(t *testing.T, rctx request.CTX, ss store.Store
|
|||
c1.DisplayName = "Channel1"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, err := ss.Channel().Save(c1, -1)
|
||||
c1, err := ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
o1 := &model.Post{}
|
||||
|
|
@ -3258,7 +3258,7 @@ func testPostStoreGetFlaggedPosts(t *testing.T, rctx request.CTX, ss store.Store
|
|||
|
||||
// Post on channel where user is not a member
|
||||
teamId := model.NewId()
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3368,7 +3368,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s
|
|||
c1.DisplayName = "Channel1"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, err := ss.Channel().Save(c1, -1)
|
||||
c1, err := ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
c2 := &model.Channel{}
|
||||
|
|
@ -3376,7 +3376,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s
|
|||
c2.DisplayName = "Channel2"
|
||||
c2.Name = NewTestId()
|
||||
c2.Type = model.ChannelTypeOpen
|
||||
c2, err = ss.Channel().Save(c2, -1)
|
||||
c2, err = ss.Channel().Save(rctx, c2, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
o1 := &model.Post{}
|
||||
|
|
@ -3397,7 +3397,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s
|
|||
|
||||
// deleted post
|
||||
teamId := model.NewId()
|
||||
channel3, err := ss.Channel().Save(&model.Channel{
|
||||
channel3, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName3",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3423,7 +3423,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s
|
|||
time.Sleep(2 * time.Millisecond)
|
||||
|
||||
// Post on channel where user is not a member
|
||||
channel4, err := ss.Channel().Save(&model.Channel{
|
||||
channel4, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName4",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3514,7 +3514,7 @@ func testPostStoreGetFlaggedPostsForChannel(t *testing.T, rctx request.CTX, ss s
|
|||
|
||||
func testPostStoreGetPostsCreatedAt(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3549,7 +3549,7 @@ func testPostStoreGetPostsCreatedAt(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
_, err = ss.Post().Save(rctx, o2)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3571,7 +3571,7 @@ func testPostStoreGetPostsCreatedAt(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
|
||||
func testPostStoreOverwriteMultiple(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3601,7 +3601,7 @@ func testPostStoreOverwriteMultiple(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
o3, err = ss.Post().Save(rctx, o3)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3617,7 +3617,7 @@ func testPostStoreOverwriteMultiple(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
channel3, err := ss.Channel().Save(&model.Channel{
|
||||
channel3, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName3",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3721,7 +3721,7 @@ func testPostStoreOverwriteMultiple(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
|
||||
func testPostStoreOverwrite(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3751,7 +3751,7 @@ func testPostStoreOverwrite(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
o3, err = ss.Post().Save(rctx, o3)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3838,7 +3838,7 @@ func testPostStoreOverwrite(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
func testPostStoreGetPostsByIds(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -3903,14 +3903,14 @@ func testPostStoreGetPostsBatchForIndexing(t *testing.T, rctx request.CTX, ss st
|
|||
c1.DisplayName = "Channel1"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, _ = ss.Channel().Save(c1, -1)
|
||||
c1, _ = ss.Channel().Save(rctx, c1, -1)
|
||||
|
||||
c2 := &model.Channel{}
|
||||
c2.TeamId = model.NewId()
|
||||
c2.DisplayName = "Channel2"
|
||||
c2.Name = NewTestId()
|
||||
c2.Type = model.ChannelTypeOpen
|
||||
c2, _ = ss.Channel().Save(c2, -1)
|
||||
c2, _ = ss.Channel().Save(rctx, c2, -1)
|
||||
|
||||
o1 := &model.Post{}
|
||||
o1.ChannelId = c1.Id
|
||||
|
|
@ -3965,7 +3965,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.
|
|||
Type: model.TeamOpen,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -4138,14 +4138,14 @@ func testPostStorePermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.
|
|||
c1.DisplayName = "Channel1"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
c1, _ = ss.Channel().Save(c1, -1)
|
||||
c1, _ = ss.Channel().Save(rctx, c1, -1)
|
||||
|
||||
c2 := &model.Channel{}
|
||||
c2.TeamId = model.NewId()
|
||||
c2.DisplayName = "Channel2"
|
||||
c2.Name = NewTestId()
|
||||
c2.Type = model.ChannelTypeOpen
|
||||
c2, _ = ss.Channel().Save(c2, -1)
|
||||
c2, _ = ss.Channel().Save(rctx, c2, -1)
|
||||
|
||||
channelPolicy, err2 := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
|
||||
RetentionPolicy: model.RetentionPolicy{
|
||||
|
|
@ -4211,7 +4211,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, rctx request.CTX, ss store.
|
|||
|
||||
func testPostStoreGetOldest(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -4268,7 +4268,7 @@ func testPostStoreGetParentsForExportAfter(t *testing.T, rctx request.CTX, ss st
|
|||
c1.DisplayName = "Channel1"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
_, nErr := ss.Channel().Save(&c1, -1)
|
||||
_, nErr := ss.Channel().Save(rctx, &c1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
c2 := model.Channel{}
|
||||
|
|
@ -4276,7 +4276,7 @@ func testPostStoreGetParentsForExportAfter(t *testing.T, rctx request.CTX, ss st
|
|||
c2.DisplayName = "Channel2"
|
||||
c2.Name = NewTestId()
|
||||
c2.Type = model.ChannelTypeOpen
|
||||
_, nErr = ss.Channel().Save(&c2, -1)
|
||||
_, nErr = ss.Channel().Save(rctx, &c2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
u1 := model.User{}
|
||||
|
|
@ -4360,7 +4360,7 @@ func testPostStoreGetRepliesForExport(t *testing.T, rctx request.CTX, ss store.S
|
|||
c1.DisplayName = "Channel1"
|
||||
c1.Name = NewTestId()
|
||||
c1.Type = model.ChannelTypeOpen
|
||||
_, nErr := ss.Channel().Save(&c1, -1)
|
||||
_, nErr := ss.Channel().Save(rctx, &c1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
u1 := model.User{}
|
||||
|
|
@ -4608,7 +4608,7 @@ func testPostStoreGetDirectPostParentsForExportAfterBatched(t *testing.T, rctx r
|
|||
func testHasAutoResponsePostByUserSince(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
t.Run("should return posts created after the given time", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -4964,7 +4964,7 @@ func testGetPostReminderMetadata(t *testing.T, rctx request.CTX, ss store.Store,
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
ch, err = ss.Channel().Save(ch, -1)
|
||||
ch, err = ss.Channel().Save(rctx, ch, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
ch2 := &model.Channel{
|
||||
|
|
@ -4973,7 +4973,7 @@ func testGetPostReminderMetadata(t *testing.T, rctx request.CTX, ss store.Store,
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeGroup,
|
||||
}
|
||||
ch2, err = ss.Channel().Save(ch2, -1)
|
||||
ch2, err = ss.Channel().Save(rctx, ch2, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
u1 := &model.User{
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ func testPreferenceDeleteOrphanedRows(t *testing.T, rctx request.CTX, ss store.S
|
|||
Type: model.TeamOpen,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
|
|||
|
|
@ -658,7 +658,7 @@ func testReactionStorePermanentDeleteBatch(t *testing.T, rctx request.CTX, ss st
|
|||
Type: model.TeamOpen,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ func copyRetentionPolicyWithTeamAndChannelIds(policy *model.RetentionPolicyWithT
|
|||
return cpy
|
||||
}
|
||||
|
||||
func createChannelsForRetentionPolicy(t *testing.T, ss store.Store, teamId string, numChannels int) (channelIDs []string) {
|
||||
func createChannelsForRetentionPolicy(rctx request.CTX, t *testing.T, ss store.Store, teamId string, numChannels int) (channelIDs []string) {
|
||||
channelIDs = make([]string, numChannels)
|
||||
for i := range channelIDs {
|
||||
name := "channel" + model.NewId()
|
||||
|
|
@ -116,7 +116,7 @@ func createChannelsForRetentionPolicy(t *testing.T, ss store.Store, teamId strin
|
|||
Name: name,
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
channel, err := ss.Channel().Save(channel, -1)
|
||||
channel, err := ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, err)
|
||||
channelIDs[i] = channel.Id
|
||||
}
|
||||
|
|
@ -141,8 +141,8 @@ func createTeamsForRetentionPolicy(t *testing.T, ss store.Store, numTeams int) (
|
|||
|
||||
func createTeamsAndChannelsForRetentionPolicy(t *testing.T, rctx request.CTX, ss store.Store) (teamIDs, channelIDs []string) {
|
||||
teamIDs = createTeamsForRetentionPolicy(t, ss, 2)
|
||||
channels1 := createChannelsForRetentionPolicy(t, ss, teamIDs[0], 1)
|
||||
channels2 := createChannelsForRetentionPolicy(t, ss, teamIDs[1], 2)
|
||||
channels1 := createChannelsForRetentionPolicy(rctx, t, ss, teamIDs[0], 1)
|
||||
channels2 := createChannelsForRetentionPolicy(rctx, t, ss, teamIDs[1], 2)
|
||||
channelIDs = append(channels1, channels2...)
|
||||
return
|
||||
}
|
||||
|
|
@ -454,7 +454,7 @@ func testRetentionPolicyStoreAddChannels(t *testing.T, rctx request.CTX, ss stor
|
|||
checkRetentionPolicyLikeThisExists(t, ss, policy)
|
||||
})
|
||||
t.Run("add new channels", func(t *testing.T) {
|
||||
channelIDs := createChannelsForRetentionPolicy(t, ss, teamIDs[0], 2)
|
||||
channelIDs := createChannelsForRetentionPolicy(rctx, t, ss, teamIDs[0], 2)
|
||||
defer deleteTeamsAndChannels(rctx, ss, nil, channelIDs)
|
||||
err := ss.RetentionPolicy().AddChannels(policy.ID, channelIDs)
|
||||
require.NoError(t, err)
|
||||
|
|
@ -469,7 +469,7 @@ func testRetentionPolicyStoreAddChannels(t *testing.T, rctx request.CTX, ss stor
|
|||
require.Error(t, err)
|
||||
})
|
||||
t.Run("add channel to policy which does not exist", func(t *testing.T) {
|
||||
channelIDs := createChannelsForRetentionPolicy(t, ss, teamIDs[0], 1)
|
||||
channelIDs := createChannelsForRetentionPolicy(rctx, t, ss, teamIDs[0], 1)
|
||||
defer deleteTeamsAndChannels(rctx, ss, nil, channelIDs)
|
||||
err := ss.RetentionPolicy().AddChannels("no_such_policy", channelIDs)
|
||||
require.Error(t, err)
|
||||
|
|
@ -665,7 +665,7 @@ func testRetentionPolicyStoreGetPoliciesForUser(t *testing.T, rctx request.CTX,
|
|||
|
||||
func testRetentionPolicyStoreRemoveOrphanedRows(t *testing.T, rctx request.CTX, ss store.Store, s SqlStore) {
|
||||
teamID := createTeamsForRetentionPolicy(t, ss, 1)[0]
|
||||
channelID := createChannelsForRetentionPolicy(t, ss, teamID, 1)[0]
|
||||
channelID := createChannelsForRetentionPolicy(rctx, t, ss, teamID, 1)[0]
|
||||
policy := saveRetentionPolicyWithTeamAndChannelIds(t, ss, "Policy 1",
|
||||
[]string{teamID}, []string{channelID})
|
||||
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ func testRoleStoreLowerScopedChannelSchemeRoles(t *testing.T, rctx request.CTX,
|
|||
Type: model.ChannelTypeOpen,
|
||||
SchemeId: &channelScheme1.Id,
|
||||
}
|
||||
channel1, nErr := ss.Channel().Save(channel1, -1)
|
||||
channel1, nErr := ss.Channel().Save(rctx, channel1, -1)
|
||||
require.NoError(t, nErr)
|
||||
defer ss.Channel().Delete(channel1.Id, 0)
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ func testRoleStoreLowerScopedChannelSchemeRoles(t *testing.T, rctx request.CTX,
|
|||
Type: model.ChannelTypeOpen,
|
||||
SchemeId: &channelScheme2.Id,
|
||||
}
|
||||
channel2, nErr = ss.Channel().Save(channel2, -1)
|
||||
channel2, nErr = ss.Channel().Save(rctx, channel2, -1)
|
||||
require.NoError(t, nErr)
|
||||
defer ss.Channel().Delete(channel2.Id, 0)
|
||||
|
||||
|
|
@ -559,7 +559,7 @@ func testRoleStoreChannelHigherScopedPermissionsBlankTeamSchemeChannelGuest(t *t
|
|||
Type: model.ChannelTypeOpen,
|
||||
SchemeId: &channelScheme.Id,
|
||||
}
|
||||
channel, nErr := ss.Channel().Save(channel, -1)
|
||||
channel, nErr := ss.Channel().Save(rctx, channel, -1)
|
||||
require.NoError(t, nErr)
|
||||
defer ss.Channel().Delete(channel.Id, 0)
|
||||
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ func testSchemeStoreDelete(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Type: model.ChannelTypeOpen,
|
||||
SchemeId: &d5.Id,
|
||||
}
|
||||
c5, nErr := ss.Channel().Save(c5, -1)
|
||||
c5, nErr := ss.Channel().Save(rctx, c5, -1)
|
||||
assert.NoError(t, nErr)
|
||||
|
||||
_, err = ss.Scheme().Delete(d5.Id)
|
||||
|
|
|
|||
|
|
@ -872,7 +872,7 @@ func createSharedTestChannel(ss store.Store, rctx request.CTX, name string, shar
|
|||
CreatorId: model.NewId(),
|
||||
Shared: model.NewBool(shared),
|
||||
}
|
||||
channel, err := ss.Channel().Save(channel, 10000)
|
||||
channel, err := ss.Channel().Save(rctx, channel, 10000)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3122,11 +3122,11 @@ func testGetChannelUnreadsForAllTeams(t *testing.T, rctx request.CTX, ss store.S
|
|||
require.NoError(t, nErr)
|
||||
|
||||
c1 := &model.Channel{TeamId: m1.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.ChannelTypeOpen, TotalMsgCount: 100}
|
||||
_, nErr = ss.Channel().Save(c1, -1)
|
||||
_, nErr = ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
c2 := &model.Channel{TeamId: m2.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.ChannelTypeOpen, TotalMsgCount: 100}
|
||||
_, nErr = ss.Channel().Save(c2, -1)
|
||||
_, nErr = ss.Channel().Save(rctx, c2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
cm1 := &model.ChannelMember{ChannelId: c1.Id, UserId: m1.UserId, NotifyProps: model.GetDefaultChannelNotifyProps(), MsgCount: 90}
|
||||
|
|
@ -3176,11 +3176,11 @@ func testGetChannelUnreadsForTeam(t *testing.T, rctx request.CTX, ss store.Store
|
|||
require.NoError(t, nErr)
|
||||
|
||||
c1 := &model.Channel{TeamId: m1.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.ChannelTypeOpen, TotalMsgCount: 100}
|
||||
_, nErr = ss.Channel().Save(c1, -1)
|
||||
_, nErr = ss.Channel().Save(rctx, c1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
c2 := &model.Channel{TeamId: m1.TeamId, Name: model.NewId(), DisplayName: "Town Square", Type: model.ChannelTypeOpen, TotalMsgCount: 100}
|
||||
_, nErr = ss.Channel().Save(c2, -1)
|
||||
_, nErr = ss.Channel().Save(rctx, c2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
cm1 := &model.ChannelMember{ChannelId: c1.Id, UserId: m1.UserId, NotifyProps: model.GetDefaultChannelNotifyProps(), MsgCount: 90}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
u, err := ss.User().Save(rctx, &u1)
|
||||
require.NoError(t, err)
|
||||
|
||||
c, err2 := ss.Channel().Save(&model.Channel{
|
||||
c, err2 := ss.Channel().Save(rctx, &model.Channel{
|
||||
DisplayName: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
Name: model.NewId(),
|
||||
|
|
@ -118,7 +118,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
require.ElementsMatch(t, model.StringArray{newPosts[0].UserId, newPosts[1].UserId}, thread.Participants)
|
||||
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -162,7 +162,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Update reply should update the UpdateAt of the thread", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -218,7 +218,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Deleting reply should update the thread", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -279,7 +279,7 @@ func testThreadStorePopulation(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
|
||||
t.Run("Deleting root post should delete the thread", func(t *testing.T) {
|
||||
teamId := model.NewId()
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -499,7 +499,7 @@ func testThreadStorePermanentDeleteBatchForRetentionPolicies(t *testing.T, rctx
|
|||
Type: model.TeamOpen,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -588,7 +588,7 @@ func testThreadStorePermanentDeleteBatchThreadMembershipsForRetentionPolicies(t
|
|||
Type: model.TeamOpen,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
channel, err := ss.Channel().Save(&model.Channel{
|
||||
channel, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -683,7 +683,7 @@ func testGetTeamsUnreadForUser(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Type: model.TeamOpen,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team1.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -725,7 +725,7 @@ func testGetTeamsUnreadForUser(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Type: model.TeamOpen,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team2.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -835,7 +835,7 @@ func testVarious(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
team1channel1, err := ss.Channel().Save(&model.Channel{
|
||||
team1channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team1.Id,
|
||||
DisplayName: "Channel1",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -843,7 +843,7 @@ func testVarious(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
team2channel1, err := ss.Channel().Save(&model.Channel{
|
||||
team2channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team2.Id,
|
||||
DisplayName: "Channel2",
|
||||
Name: "channel" + model.NewId(),
|
||||
|
|
@ -854,7 +854,7 @@ func testVarious(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
dm1, err := ss.Channel().CreateDirectChannel(rctx, &model.User{Id: user1ID}, &model.User{Id: user2ID})
|
||||
require.NoError(t, err)
|
||||
|
||||
gm1, err := ss.Channel().Save(&model.Channel{
|
||||
gm1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
DisplayName: "GM",
|
||||
Name: "gm" + model.NewId(),
|
||||
Type: model.ChannelTypeGroup,
|
||||
|
|
@ -1216,7 +1216,7 @@ func testMarkAllAsReadByChannels(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team1.Id,
|
||||
DisplayName: "Channel1",
|
||||
Name: "channel1" + model.NewId(),
|
||||
|
|
@ -1224,7 +1224,7 @@ func testMarkAllAsReadByChannels(t *testing.T, rctx request.CTX, ss store.Store)
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team1.Id,
|
||||
DisplayName: "Channel2",
|
||||
Name: "channel2" + model.NewId(),
|
||||
|
|
@ -1382,7 +1382,7 @@ func testMarkAllAsReadByTeam(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
team1channel1, err := ss.Channel().Save(&model.Channel{
|
||||
team1channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team1.Id,
|
||||
DisplayName: "Team1: Channel1",
|
||||
Name: "team1channel1" + model.NewId(),
|
||||
|
|
@ -1390,7 +1390,7 @@ func testMarkAllAsReadByTeam(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
team1channel2, err := ss.Channel().Save(&model.Channel{
|
||||
team1channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team1.Id,
|
||||
DisplayName: "Team1: Channel2",
|
||||
Name: "team1channel2" + model.NewId(),
|
||||
|
|
@ -1406,7 +1406,7 @@ func testMarkAllAsReadByTeam(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
team2channel1, err := ss.Channel().Save(&model.Channel{
|
||||
team2channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team2.Id,
|
||||
DisplayName: "Team2: Channel1",
|
||||
Name: "team2channel1" + model.NewId(),
|
||||
|
|
@ -1414,7 +1414,7 @@ func testMarkAllAsReadByTeam(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
}, -1)
|
||||
require.NoError(t, err)
|
||||
|
||||
team2channel2, err := ss.Channel().Save(&model.Channel{
|
||||
team2channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team2.Id,
|
||||
DisplayName: "Team2: Channel2",
|
||||
Name: "team2channel2" + model.NewId(),
|
||||
|
|
@ -1482,7 +1482,7 @@ func testMarkAllAsReadByTeam(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
gm1, err := ss.Channel().Save(&model.Channel{
|
||||
gm1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
DisplayName: "GM1",
|
||||
Name: "gm1" + model.NewId(),
|
||||
Type: model.ChannelTypeGroup,
|
||||
|
|
@ -1504,7 +1504,7 @@ func testMarkAllAsReadByTeam(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
gm2, err := ss.Channel().Save(&model.Channel{
|
||||
gm2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
DisplayName: "GM1",
|
||||
Name: "gm1" + model.NewId(),
|
||||
Type: model.ChannelTypeGroup,
|
||||
|
|
@ -1604,14 +1604,14 @@ func testDeleteMembershipsForChannel(t *testing.T, rctx request.CTX, ss store.St
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
channel1, err := ss.Channel().Save(&model.Channel{
|
||||
channel1, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
DisplayName: "DisplayName",
|
||||
Name: "channel1" + model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}, -1)
|
||||
require.NoError(t, err)
|
||||
channel2, err := ss.Channel().Save(&model.Channel{
|
||||
channel2, err := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: team.Id,
|
||||
DisplayName: "DisplayName2",
|
||||
Name: "channel2" + model.NewId(),
|
||||
|
|
|
|||
|
|
@ -898,7 +898,7 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store.
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c1, nErr := ss.Channel().Save(ch1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, ch1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch2 := &model.Channel{
|
||||
|
|
@ -907,7 +907,7 @@ func testUserStoreGetProfilesInChannel(t *testing.T, rctx request.CTX, ss store.
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
c2, nErr := ss.Channel().Save(ch2, -1)
|
||||
c2, nErr := ss.Channel().Save(rctx, ch2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{
|
||||
|
|
@ -1077,7 +1077,7 @@ func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, rctx request.CTX, ss
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c1, nErr := ss.Channel().Save(ch1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, ch1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{
|
||||
|
|
@ -1172,7 +1172,7 @@ func testUserStoreGetProfilesInChannelByStatus(t *testing.T, rctx request.CTX, s
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c1, nErr := ss.Channel().Save(ch1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, ch1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch2 := &model.Channel{
|
||||
|
|
@ -1181,7 +1181,7 @@ func testUserStoreGetProfilesInChannelByStatus(t *testing.T, rctx request.CTX, s
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
c2, nErr := ss.Channel().Save(ch2, -1)
|
||||
c2, nErr := ss.Channel().Save(rctx, ch2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{
|
||||
|
|
@ -1389,7 +1389,7 @@ func testUserStoreGetAllProfilesInChannel(t *testing.T, rctx request.CTX, ss sto
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c1, nErr := ss.Channel().Save(ch1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, ch1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch2 := &model.Channel{
|
||||
|
|
@ -1398,7 +1398,7 @@ func testUserStoreGetAllProfilesInChannel(t *testing.T, rctx request.CTX, ss sto
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
c2, nErr := ss.Channel().Save(ch2, -1)
|
||||
c2, nErr := ss.Channel().Save(rctx, ch2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{
|
||||
|
|
@ -1515,7 +1515,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c1, nErr := ss.Channel().Save(ch1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, ch1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch2 := &model.Channel{
|
||||
|
|
@ -1524,7 +1524,7 @@ func testUserStoreGetProfilesNotInChannel(t *testing.T, rctx request.CTX, ss sto
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
c2, nErr := ss.Channel().Save(ch2, -1)
|
||||
c2, nErr := ss.Channel().Save(rctx, ch2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
t.Run("get team 1, channel 1, offset 0, limit 100", func(t *testing.T) {
|
||||
|
|
@ -1749,7 +1749,7 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request.
|
|||
require.NoError(t, err)
|
||||
defer func() { require.NoError(t, ss.User().PermanentDelete(u4.Id)) }()
|
||||
|
||||
gc1, nErr := ss.Channel().Save(&model.Channel{
|
||||
gc1, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
DisplayName: "Profiles in private",
|
||||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypeGroup,
|
||||
|
|
@ -1765,7 +1765,7 @@ func testUserStoreGetProfileByGroupChannelIdsForUser(t *testing.T, rctx request.
|
|||
require.NoError(t, nErr)
|
||||
}
|
||||
|
||||
gc2, nErr := ss.Channel().Save(&model.Channel{
|
||||
gc2, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
DisplayName: "Profiles in private",
|
||||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypeGroup,
|
||||
|
|
@ -2432,7 +2432,7 @@ func testUserUnreadCount(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
_, nErr = ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: u3.Id}, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, nErr = ss.Channel().Save(&c1, -1)
|
||||
_, nErr = ss.Channel().Save(rctx, &c1, -1)
|
||||
require.NoError(t, nErr, "couldn't save item")
|
||||
|
||||
m1 := model.ChannelMember{}
|
||||
|
|
@ -2937,7 +2937,7 @@ func testUserStoreSearchNotInChannel(t *testing.T, rctx request.CTX, ss store.St
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c1, nErr := ss.Channel().Save(&ch1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, &ch1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch2 := model.Channel{
|
||||
|
|
@ -2946,7 +2946,7 @@ func testUserStoreSearchNotInChannel(t *testing.T, rctx request.CTX, ss store.St
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c2, nErr := ss.Channel().Save(&ch2, -1)
|
||||
c2, nErr := ss.Channel().Save(rctx, &ch2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{
|
||||
|
|
@ -3166,7 +3166,7 @@ func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c1, nErr := ss.Channel().Save(&ch1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, &ch1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch2 := model.Channel{
|
||||
|
|
@ -3175,7 +3175,7 @@ func testUserStoreSearchInChannel(t *testing.T, rctx request.CTX, ss store.Store
|
|||
Name: NewTestId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c2, nErr := ss.Channel().Save(&ch2, -1)
|
||||
c2, nErr := ss.Channel().Save(rctx, &ch2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{
|
||||
|
|
@ -4883,14 +4883,14 @@ func testUserStoreGetUsersBatchForIndexing(t *testing.T, rctx request.CTX, ss st
|
|||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
cPub1, nErr := ss.Channel().Save(ch1, -1)
|
||||
cPub1, nErr := ss.Channel().Save(rctx, ch1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch2 := &model.Channel{
|
||||
Name: model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
cPub2, nErr := ss.Channel().Save(ch2, -1)
|
||||
cPub2, nErr := ss.Channel().Save(rctx, ch2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch3 := &model.Channel{
|
||||
|
|
@ -4898,7 +4898,7 @@ func testUserStoreGetUsersBatchForIndexing(t *testing.T, rctx request.CTX, ss st
|
|||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
|
||||
cPriv, nErr := ss.Channel().Save(ch3, -1)
|
||||
cPriv, nErr := ss.Channel().Save(rctx, ch3, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
u1, err := ss.User().Save(rctx, &model.User{
|
||||
|
|
@ -5133,7 +5133,7 @@ func testUserStoreGetTeamGroupUsers(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
func testUserStoreGetChannelGroupUsers(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
// create channel
|
||||
id := model.NewId()
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
DisplayName: "dn_" + id,
|
||||
Name: "n-" + id,
|
||||
Type: model.ChannelTypePrivate,
|
||||
|
|
@ -5272,7 +5272,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -5318,7 +5318,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -5414,7 +5414,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -5459,7 +5459,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -5504,7 +5504,7 @@ func testUserStorePromoteGuestToUser(t *testing.T, rctx request.CTX, ss store.St
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId1, UserId: user1.Id, SchemeGuest: true, SchemeUser: false}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId1,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -5587,7 +5587,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -5631,7 +5631,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: true, SchemeUser: false}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -5721,7 +5721,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -5764,7 +5764,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId, UserId: user.Id, SchemeGuest: false, SchemeUser: true}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -5807,7 +5807,7 @@ func testUserStoreDemoteUserToGuest(t *testing.T, rctx request.CTX, ss store.Sto
|
|||
_, nErr := ss.Team().SaveMember(rctx, &model.TeamMember{TeamId: teamId1, UserId: user1.Id, SchemeGuest: false, SchemeUser: true}, 999)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
channel, nErr := ss.Channel().Save(&model.Channel{
|
||||
channel, nErr := ss.Channel().Save(rctx, &model.Channel{
|
||||
TeamId: teamId1,
|
||||
DisplayName: "Channel name",
|
||||
Name: "channel-" + model.NewId(),
|
||||
|
|
@ -6033,7 +6033,7 @@ func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypeOpen,
|
||||
}
|
||||
c1, nErr := ss.Channel().Save(ch1, -1)
|
||||
c1, nErr := ss.Channel().Save(rctx, ch1, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch2 := &model.Channel{
|
||||
|
|
@ -6042,7 +6042,7 @@ func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
c2, nErr := ss.Channel().Save(ch2, -1)
|
||||
c2, nErr := ss.Channel().Save(rctx, ch2, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
ch3 := &model.Channel{
|
||||
|
|
@ -6051,7 +6051,7 @@ func testGetKnownUsers(t *testing.T, rctx request.CTX, ss store.Store) {
|
|||
Name: "profiles-" + model.NewId(),
|
||||
Type: model.ChannelTypePrivate,
|
||||
}
|
||||
c3, nErr := ss.Channel().Save(ch3, -1)
|
||||
c3, nErr := ss.Channel().Save(rctx, ch3, -1)
|
||||
require.NoError(t, nErr)
|
||||
|
||||
_, nErr = ss.Channel().SaveMember(rctx, &model.ChannelMember{
|
||||
|
|
|
|||
|
|
@ -2094,10 +2094,10 @@ func (s *TimerLayerChannelStore) Restore(channelID string, timestamp int64) erro
|
|||
return err
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
|
||||
func (s *TimerLayerChannelStore) Save(rctx request.CTX, channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
|
||||
start := time.Now()
|
||||
|
||||
result, err := s.ChannelStore.Save(channel, maxChannelsPerTeam)
|
||||
result, err := s.ChannelStore.Save(rctx, channel, maxChannelsPerTeam)
|
||||
|
||||
elapsed := float64(time.Since(start)) / float64(time.Second)
|
||||
if s.Root.Metrics != nil {
|
||||
|
|
|
|||
|
|
@ -774,7 +774,7 @@ func (si *SlackImporter) oldImportChannel(rctx request.CTX, channel *model.Chann
|
|||
return sc
|
||||
}
|
||||
|
||||
sc, err := si.store.Channel().Save(channel, *si.config.TeamSettings.MaxChannelsPerTeam)
|
||||
sc, err := si.store.Channel().Save(rctx, channel, *si.config.TeamSettings.MaxChannelsPerTeam)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue