Chore: Migrate REST API - getReadReceipts to Typescript (#3877)
This commit is contained in:
parent
cfb10ada60
commit
7bf0de5825
|
@ -147,3 +147,13 @@ export type TMessageModel = IMessage & Model;
|
||||||
|
|
||||||
export type TAnyMessageModel = TMessageModel | TThreadModel | TThreadMessageModel;
|
export type TAnyMessageModel = TMessageModel | TThreadModel | TThreadMessageModel;
|
||||||
export type TTypeMessages = IMessageFromServer | ILoadMoreMessage | IMessage;
|
export type TTypeMessages = IMessageFromServer | ILoadMoreMessage | IMessage;
|
||||||
|
|
||||||
|
// Read receipts to ReadReceiptView and chat.getMessageReadReceipts
|
||||||
|
export interface IReadReceipts {
|
||||||
|
_id: string;
|
||||||
|
roomId: string;
|
||||||
|
userId: string;
|
||||||
|
messageId: string;
|
||||||
|
ts: string;
|
||||||
|
user?: IUserMessage;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IMessage, IMessageFromServer } from '../../IMessage';
|
import type { IMessage, IMessageFromServer, IReadReceipts } from '../../IMessage';
|
||||||
import type { IServerRoom } from '../../IRoom';
|
import type { IServerRoom } from '../../IRoom';
|
||||||
import { PaginatedResult } from '../helpers/PaginatedResult';
|
import { PaginatedResult } from '../helpers/PaginatedResult';
|
||||||
|
|
||||||
|
@ -65,4 +65,7 @@ export type ChatEndpoints = {
|
||||||
messages: IMessageFromServer[];
|
messages: IMessageFromServer[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
'chat.getMessageReadReceipts': {
|
||||||
|
GET: (params: { messageId: string }) => { receipts: IReadReceipts[] };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -617,10 +617,8 @@ export const getMessages = (
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getReadReceipts = (messageId: string): any =>
|
export const getReadReceipts = (messageId: string) =>
|
||||||
// RC 0.63.0
|
// RC 0.63.0
|
||||||
// TODO: missing definitions from server
|
|
||||||
// @ts-ignore
|
|
||||||
sdk.get('chat.getMessageReadReceipts', {
|
sdk.get('chat.getMessageReadReceipts', {
|
||||||
messageId
|
messageId
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,23 +17,11 @@ import { themes } from '../../constants/colors';
|
||||||
import SafeAreaView from '../../containers/SafeAreaView';
|
import SafeAreaView from '../../containers/SafeAreaView';
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
import { ChatsStackParamList } from '../../stacks/types';
|
import { ChatsStackParamList } from '../../stacks/types';
|
||||||
|
import { IReadReceipts } from '../../definitions';
|
||||||
interface IReceipts {
|
|
||||||
_id: string;
|
|
||||||
roomId: string;
|
|
||||||
userId: string;
|
|
||||||
messageId: string;
|
|
||||||
ts: string;
|
|
||||||
user?: {
|
|
||||||
_id: string;
|
|
||||||
name: string;
|
|
||||||
username: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IReadReceiptViewState {
|
interface IReadReceiptViewState {
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
receipts: IReceipts[];
|
receipts: IReadReceipts[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface INavigationOption {
|
interface INavigationOption {
|
||||||
|
@ -125,7 +113,7 @@ class ReadReceiptView extends React.Component<IReadReceiptViewProps, IReadReceip
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderItem = ({ item }: { item: IReceipts }) => {
|
renderItem = ({ item }: { item: IReadReceipts }) => {
|
||||||
const { theme, Message_TimeAndDateFormat } = this.props;
|
const { theme, Message_TimeAndDateFormat } = this.props;
|
||||||
const time = moment(item.ts).format(Message_TimeAndDateFormat);
|
const time = moment(item.ts).format(Message_TimeAndDateFormat);
|
||||||
if (!item?.user?.username) {
|
if (!item?.user?.username) {
|
||||||
|
|
Loading…
Reference in New Issue