[GH-26715] Added Pagination Support for IncomingWebHooks (#27502)
* Added Pagination Support for IncomingWebHooks * Incorporated feedback from reviews * Removed trailing spaces * Restored deleted server en.json entries, fixed order in webapp en.json --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -14,9 +14,9 @@ type WebhookStore struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// AnalyticsIncomingCount provides a mock function with given fields: teamID
|
||||
func (_m *WebhookStore) AnalyticsIncomingCount(teamID string) (int64, error) {
|
||||
ret := _m.Called(teamID)
|
||||
// AnalyticsIncomingCount provides a mock function with given fields: teamID, userID
|
||||
func (_m *WebhookStore) AnalyticsIncomingCount(teamID string, userID string) (int64, error) {
|
||||
ret := _m.Called(teamID, userID)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for AnalyticsIncomingCount")
|
||||
@@ -24,17 +24,17 @@ func (_m *WebhookStore) AnalyticsIncomingCount(teamID string) (int64, error) {
|
||||
|
||||
var r0 int64
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(string) (int64, error)); ok {
|
||||
return rf(teamID)
|
||||
if rf, ok := ret.Get(0).(func(string, string) (int64, error)); ok {
|
||||
return rf(teamID, userID)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string) int64); ok {
|
||||
r0 = rf(teamID)
|
||||
if rf, ok := ret.Get(0).(func(string, string) int64); ok {
|
||||
r0 = rf(teamID, userID)
|
||||
} else {
|
||||
r0 = ret.Get(0).(int64)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||
r1 = rf(teamID)
|
||||
if rf, ok := ret.Get(1).(func(string, string) error); ok {
|
||||
r1 = rf(teamID, userID)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
@@ -577,10 +577,28 @@ func testWebhookStoreCountIncoming(t *testing.T, rctx request.CTX, ss store.Stor
|
||||
|
||||
_, _ = ss.Webhook().SaveIncoming(o1)
|
||||
|
||||
c, err := ss.Webhook().AnalyticsIncomingCount("")
|
||||
c, err := ss.Webhook().AnalyticsIncomingCount("", "")
|
||||
require.NoError(t, err)
|
||||
|
||||
require.NotEqual(t, 0, c, "should have at least 1 incoming hook")
|
||||
|
||||
o2 := &model.IncomingWebhook{}
|
||||
o2.ChannelId = model.NewId()
|
||||
o2.UserId = model.NewId()
|
||||
o2.TeamId = model.NewId()
|
||||
|
||||
_, _ = ss.Webhook().SaveIncoming(o2)
|
||||
|
||||
c, err = ss.Webhook().AnalyticsIncomingCount("", "")
|
||||
require.NoError(t, err)
|
||||
require.NotEqual(t, 1, c, "should have at least 2 incoming hooks")
|
||||
|
||||
c, err = ss.Webhook().AnalyticsIncomingCount(o1.TeamId, "")
|
||||
require.NoError(t, err)
|
||||
require.NotEqual(t, 0, c, "should have at least 1 incoming hook when filtering by TeamID")
|
||||
|
||||
c, err = ss.Webhook().AnalyticsIncomingCount("", o2.UserId)
|
||||
require.NoError(t, err)
|
||||
require.NotEqual(t, 0, c, "should have at least 1 incoming hook when filtering by UserID")
|
||||
}
|
||||
|
||||
func testWebhookStoreCountOutgoing(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
|
||||
Ссылка в новой задаче
Block a user