From 11a809a065f3083a30f5751e3d44469420d52397 Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Wed, 16 Mar 2022 23:24:22 -0300 Subject: [PATCH] Chore: Migrate REST API - getThreadsList to Typescript (#3895) * chore: add rest api return * chore: removing sort param --- app/definitions/rest/v1/chat.ts | 2 +- app/lib/rocketchat/services/restApi.ts | 7 +++---- app/views/ThreadMessagesView/index.tsx | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/definitions/rest/v1/chat.ts b/app/definitions/rest/v1/chat.ts index 81d3ebe57..16f568756 100644 --- a/app/definitions/rest/v1/chat.ts +++ b/app/definitions/rest/v1/chat.ts @@ -38,7 +38,7 @@ export type ChatEndpoints = { 'chat.getThreadsList': { GET: (params: { rid: IServerRoom['_id']; - type: 'unread' | 'following' | 'all'; + type?: 'unread' | 'following' | 'all'; text?: string; offset: number; count: number; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 7e36b7b31..73502fc79 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -656,12 +656,11 @@ export const toggleFollowMessage = (mid: string, follow: boolean) => { }; export const getThreadsList = ({ rid, count, offset, text }: { rid: string; count: number; offset: number; text?: string }) => { - const params: any = { + const params = { rid, count, - offset, - sort: { ts: -1 } - }; + offset + } as { rid: string; count: number; offset: number; text?: string }; if (text) { params.text = text; } diff --git a/app/views/ThreadMessagesView/index.tsx b/app/views/ThreadMessagesView/index.tsx index cf40dab82..5d17729df 100644 --- a/app/views/ThreadMessagesView/index.tsx +++ b/app/views/ThreadMessagesView/index.tsx @@ -335,7 +335,7 @@ class ThreadMessagesView extends React.Component