chore: migrate services room to ts
This commit is contained in:
parent
a6146bd02b
commit
8239c4489a
|
@ -2,7 +2,7 @@ import { getMessageById } from '../../../lib/database/services/Message';
|
||||||
import { getThreadMessageById } from '../../../lib/database/services/ThreadMessage';
|
import { getThreadMessageById } from '../../../lib/database/services/ThreadMessage';
|
||||||
import getSingleMessage from '../../../lib/methods/getSingleMessage';
|
import getSingleMessage from '../../../lib/methods/getSingleMessage';
|
||||||
|
|
||||||
const getMessageInfo = async messageId => {
|
const getMessageInfo = async (messageId: string) => {
|
||||||
let result;
|
let result;
|
||||||
result = await getMessageById(messageId);
|
result = await getMessageById(messageId);
|
||||||
if (result) {
|
if (result) {
|
|
@ -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;
|
|
|
@ -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<any> => {
|
||||||
|
if (room.lastOpen) {
|
||||||
|
return RocketChat.loadMissedMessages(room);
|
||||||
|
}
|
||||||
|
return RocketChat.loadMessagesForRoom(room);
|
||||||
|
};
|
||||||
|
export default getMessages;
|
|
@ -5,7 +5,8 @@ import {
|
||||||
} from '../../../constants/messageTypeLoad';
|
} from '../../../constants/messageTypeLoad';
|
||||||
import RocketChat from '../../../lib/rocketchat';
|
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)) {
|
if ([MESSAGE_TYPE_LOAD_MORE, MESSAGE_TYPE_LOAD_PREVIOUS_CHUNK].includes(loaderItem.t)) {
|
||||||
return RocketChat.loadMessagesForRoom({
|
return RocketChat.loadMessagesForRoom({
|
||||||
rid,
|
rid,
|
|
@ -1,6 +1,6 @@
|
||||||
import RocketChat from '../../../lib/rocketchat';
|
import RocketChat from '../../../lib/rocketchat';
|
||||||
|
|
||||||
// unlike getMessages, sync isn't required for threads, because loadMissedMessages does it already
|
// 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;
|
export default getThreadMessages;
|
|
@ -1,5 +0,0 @@
|
||||||
import RocketChat from '../../../lib/rocketchat';
|
|
||||||
|
|
||||||
const readMessages = (rid, newLastOpen) => RocketChat.readMessages(rid, newLastOpen, true);
|
|
||||||
|
|
||||||
export default readMessages;
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
import RocketChat from '../../../lib/rocketchat';
|
||||||
|
|
||||||
|
const readMessages = (rid: string, newLastOpen: string): Promise<void> => RocketChat.readMessages(rid, newLastOpen, true);
|
||||||
|
|
||||||
|
export default readMessages;
|
Loading…
Reference in New Issue