[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>
Этот коммит содержится в:
@@ -184,6 +184,8 @@ func getIncomingHooks(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
hooks []*model.IncomingWebhook
|
||||
appErr *model.AppError
|
||||
js []byte
|
||||
err error
|
||||
)
|
||||
|
||||
if teamID != "" {
|
||||
@@ -217,7 +219,20 @@ func getIncomingHooks(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
js, err := json.Marshal(hooks)
|
||||
if c.Params.IncludeTotalCount {
|
||||
totalCount, appErr := c.App.GetIncomingWebhooksCount(teamID, userID)
|
||||
|
||||
if appErr != nil {
|
||||
c.Err = appErr
|
||||
return
|
||||
}
|
||||
|
||||
hooksWithCount := model.IncomingWebhooksWithCount{Webhooks: hooks, TotalCount: totalCount}
|
||||
js, err = json.Marshal(hooksWithCount)
|
||||
} else {
|
||||
js, err = json.Marshal(hooks)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
c.Err = model.NewAppError("getIncomingHooks", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
return
|
||||
|
||||
Ссылка в новой задаче
Block a user