[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>
Этот коммит содержится в:
alexcekay
2024-08-09 22:44:22 +02:00
коммит произвёл GitHub
родитель 1cf6cf4f5c
Коммит 7232b5f002
35 изменённых файлов: 515 добавлений и 97 удалений

Просмотреть файл

@@ -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) {