[GH-13105] Migrate channelPinnedPostCountsCache cache from store/sqlstore/channel_store.go to the new store/localcachelayer (#13164)
* Migrate channelPinnedPostCountsCache cache from store/sqlstore/channel_store.go to the new store/localcachelayer * Remove GetPinnedPostCountFromCache * Rearrange test to avoid undeclared variable
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
070ec77ee3
Коммит
d2e78e28a9
@@ -3200,12 +3200,6 @@ func testChannelStoreGetPinnedPostCount(t *testing.T, ss store.Store) {
|
||||
require.Nil(t, errGet, errGet)
|
||||
require.EqualValues(t, 2, count, "didn't return right count")
|
||||
|
||||
require.EqualValues(
|
||||
t,
|
||||
2,
|
||||
ss.Channel().GetPinnedPostCountFromCache(o1.Id),
|
||||
"should have saved 2 pinned post count")
|
||||
|
||||
ch2 := &model.Channel{
|
||||
TeamId: model.NewId(),
|
||||
DisplayName: "Name",
|
||||
@@ -3233,12 +3227,6 @@ func testChannelStoreGetPinnedPostCount(t *testing.T, ss store.Store) {
|
||||
count, errGet = ss.Channel().GetPinnedPostCount(o2.Id, true)
|
||||
require.Nil(t, errGet, errGet)
|
||||
require.EqualValues(t, 0, count, "should return 0")
|
||||
|
||||
require.EqualValues(
|
||||
t,
|
||||
0,
|
||||
ss.Channel().GetPinnedPostCountFromCache(o2.Id),
|
||||
"should have saved 0 pinned post count")
|
||||
}
|
||||
|
||||
func testChannelStoreMaxChannelsPerTeam(t *testing.T, ss store.Store) {
|
||||
|
||||
@@ -646,13 +646,13 @@ func (_m *ChannelStore) GetChannelsByScheme(schemeId string, offset int, limit i
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetDeleted provides a mock function with given fields: team_id, offset, limit
|
||||
// GetDeleted provides a mock function with given fields: team_id, offset, limit, userId
|
||||
func (_m *ChannelStore) GetDeleted(team_id string, offset int, limit int, userId string) (*model.ChannelList, *model.AppError) {
|
||||
ret := _m.Called(team_id, offset, limit)
|
||||
ret := _m.Called(team_id, offset, limit, userId)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, int, int) *model.ChannelList); ok {
|
||||
r0 = rf(team_id, offset, limit)
|
||||
if rf, ok := ret.Get(0).(func(string, int, int, string) *model.ChannelList); ok {
|
||||
r0 = rf(team_id, offset, limit, userId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
@@ -660,8 +660,8 @@ func (_m *ChannelStore) GetDeleted(team_id string, offset int, limit int, userId
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
|
||||
r1 = rf(team_id, offset, limit)
|
||||
if rf, ok := ret.Get(1).(func(string, int, int, string) *model.AppError); ok {
|
||||
r1 = rf(team_id, offset, limit, userId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
@@ -1018,20 +1018,6 @@ func (_m *ChannelStore) GetPinnedPostCount(channelId string, allowFromCache bool
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetPinnedPostCountFromCache provides a mock function with given fields: channelId
|
||||
func (_m *ChannelStore) GetPinnedPostCountFromCache(channelId string) int64 {
|
||||
ret := _m.Called(channelId)
|
||||
|
||||
var r0 int64
|
||||
if rf, ok := ret.Get(0).(func(string) int64); ok {
|
||||
r0 = rf(channelId)
|
||||
} else {
|
||||
r0 = ret.Get(0).(int64)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// GetPinnedPosts provides a mock function with given fields: channelId
|
||||
func (_m *ChannelStore) GetPinnedPosts(channelId string) (*model.PostList, *model.AppError) {
|
||||
ret := _m.Called(channelId)
|
||||
@@ -1452,16 +1438,48 @@ func (_m *ChannelStore) SearchAllChannels(term string, opts store.ChannelSearchO
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, store.ChannelSearchOpts) *model.AppError); ok {
|
||||
var r1 int64
|
||||
if rf, ok := ret.Get(1).(func(string, store.ChannelSearchOpts) int64); ok {
|
||||
r1 = rf(term, opts)
|
||||
} else {
|
||||
r1 = ret.Get(1).(int64)
|
||||
}
|
||||
|
||||
var r2 *model.AppError
|
||||
if rf, ok := ret.Get(2).(func(string, store.ChannelSearchOpts) *model.AppError); ok {
|
||||
r2 = rf(term, opts)
|
||||
} else {
|
||||
if ret.Get(2) != nil {
|
||||
r2 = ret.Get(2).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1, r2
|
||||
}
|
||||
|
||||
// SearchArchivedInTeam provides a mock function with given fields: teamId, term, userId
|
||||
func (_m *ChannelStore) SearchArchivedInTeam(teamId string, term string, userId string) (*model.ChannelList, *model.AppError) {
|
||||
ret := _m.Called(teamId, term, userId)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) *model.ChannelList); ok {
|
||||
r0 = rf(teamId, term, userId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, string, string) *model.AppError); ok {
|
||||
r1 = rf(teamId, term, userId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, 0, r1
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// SearchForUserInTeam provides a mock function with given fields: userId, teamId, term, includeDeleted
|
||||
@@ -1539,31 +1557,6 @@ func (_m *ChannelStore) SearchInTeam(teamId string, term string, includeDeleted
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// SearchArchivedInTeam provides a mock function with given fields: teamId, term, userId
|
||||
func (_m *ChannelStore) SearchArchivedInTeam(teamId string, term string, userId string) (*model.ChannelList, *model.AppError) {
|
||||
ret := _m.Called(teamId, term, userId)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) *model.ChannelList); ok {
|
||||
r0 = rf(teamId, term, userId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, string, string) *model.AppError); ok {
|
||||
r1 = rf(teamId, term, userId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// SearchMore provides a mock function with given fields: userId, teamId, term
|
||||
func (_m *ChannelStore) SearchMore(userId string, teamId string, term string) (*model.ChannelList, *model.AppError) {
|
||||
ret := _m.Called(userId, teamId, term)
|
||||
|
||||
Ссылка в новой задаче
Block a user