diff --git a/app/views/RoomView/services/getMessageInfo.js b/app/views/RoomView/services/getMessageInfo.ts similarity index 93% rename from app/views/RoomView/services/getMessageInfo.js rename to app/views/RoomView/services/getMessageInfo.ts index e922f4e10..5c9f203cb 100644 --- a/app/views/RoomView/services/getMessageInfo.js +++ b/app/views/RoomView/services/getMessageInfo.ts @@ -2,7 +2,7 @@ import { getMessageById } from '../../../lib/database/services/Message'; import { getThreadMessageById } from '../../../lib/database/services/ThreadMessage'; import getSingleMessage from '../../../lib/methods/getSingleMessage'; -const getMessageInfo = async messageId => { +const getMessageInfo = async (messageId: string) => { let result; result = await getMessageById(messageId); if (result) { diff --git a/app/views/RoomView/services/getMessages.js b/app/views/RoomView/services/getMessages.js deleted file mode 100644 index 516f68845..000000000 --- a/app/views/RoomView/services/getMessages.js +++ /dev/null @@ -1,10 +0,0 @@ -import RocketChat from '../../../lib/rocketchat'; - -const getMessages = room => { - if (room.lastOpen) { - return RocketChat.loadMissedMessages(room); - } else { - return RocketChat.loadMessagesForRoom(room); - } -}; -export default getMessages; diff --git a/app/views/RoomView/services/getMessages.ts b/app/views/RoomView/services/getMessages.ts new file mode 100644 index 000000000..837b26bc4 --- /dev/null +++ b/app/views/RoomView/services/getMessages.ts @@ -0,0 +1,10 @@ +import RocketChat from '../../../lib/rocketchat'; + +// TODO - after merge navigation ts, change the room and the promisse return +const getMessages = (room: any): Promise => { + if (room.lastOpen) { + return RocketChat.loadMissedMessages(room); + } + return RocketChat.loadMessagesForRoom(room); +}; +export default getMessages; diff --git a/app/views/RoomView/services/getMoreMessages.js b/app/views/RoomView/services/getMoreMessages.ts similarity index 85% rename from app/views/RoomView/services/getMoreMessages.js rename to app/views/RoomView/services/getMoreMessages.ts index eaa1d3d90..c8e56da77 100644 --- a/app/views/RoomView/services/getMoreMessages.js +++ b/app/views/RoomView/services/getMoreMessages.ts @@ -5,7 +5,8 @@ import { } from '../../../constants/messageTypeLoad'; import RocketChat from '../../../lib/rocketchat'; -const getMoreMessages = ({ rid, t, tmid, loaderItem }) => { +// TODO - after merge navigation ts +const getMoreMessages = ({ rid, t, tmid, loaderItem }: any) => { if ([MESSAGE_TYPE_LOAD_MORE, MESSAGE_TYPE_LOAD_PREVIOUS_CHUNK].includes(loaderItem.t)) { return RocketChat.loadMessagesForRoom({ rid, diff --git a/app/views/RoomView/services/getThreadMessages.js b/app/views/RoomView/services/getThreadMessages.ts similarity index 64% rename from app/views/RoomView/services/getThreadMessages.js rename to app/views/RoomView/services/getThreadMessages.ts index 0f9529cfc..2e63f689d 100644 --- a/app/views/RoomView/services/getThreadMessages.js +++ b/app/views/RoomView/services/getThreadMessages.ts @@ -1,6 +1,6 @@ import RocketChat from '../../../lib/rocketchat'; // unlike getMessages, sync isn't required for threads, because loadMissedMessages does it already -const getThreadMessages = (tmid, rid) => RocketChat.loadThreadMessages({ tmid, rid }); +const getThreadMessages = (tmid: string, rid: string) => RocketChat.loadThreadMessages({ tmid, rid }); export default getThreadMessages; diff --git a/app/views/RoomView/services/index.js b/app/views/RoomView/services/index.ts similarity index 100% rename from app/views/RoomView/services/index.js rename to app/views/RoomView/services/index.ts diff --git a/app/views/RoomView/services/readMessages.js b/app/views/RoomView/services/readMessages.js deleted file mode 100644 index 060d9aa7e..000000000 --- a/app/views/RoomView/services/readMessages.js +++ /dev/null @@ -1,5 +0,0 @@ -import RocketChat from '../../../lib/rocketchat'; - -const readMessages = (rid, newLastOpen) => RocketChat.readMessages(rid, newLastOpen, true); - -export default readMessages; diff --git a/app/views/RoomView/services/readMessages.ts b/app/views/RoomView/services/readMessages.ts new file mode 100644 index 000000000..b327d6d44 --- /dev/null +++ b/app/views/RoomView/services/readMessages.ts @@ -0,0 +1,5 @@ +import RocketChat from '../../../lib/rocketchat'; + +const readMessages = (rid: string, newLastOpen: string): Promise => RocketChat.readMessages(rid, newLastOpen, true); + +export default readMessages;