Message Requests improvements

This commit is contained in:
Scott Nonnenberg 2020-08-06 17:50:54 -07:00 committed by GitHub
parent b63291507a
commit 81cb7730a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 302 additions and 263 deletions

View file

@ -156,6 +156,8 @@ const dataInterface: ClientInterface = {
getTapToViewMessagesNeedingErase,
getOlderMessagesByConversation,
getNewerMessagesByConversation,
getLastConversationActivity,
getLastConversationPreview,
getMessageMetricsForConversation,
migrateConversationMessages,
@ -1022,6 +1024,32 @@ async function getNewerMessagesByConversation(
return new MessageCollection(handleMessageJSON(messages));
}
async function getLastConversationActivity(
conversationId: string,
options: {
Message: typeof MessageModelType;
}
): Promise<MessageModelType | undefined> {
const { Message } = options;
const result = await channels.getLastConversationActivity(conversationId);
if (result) {
return new Message(result);
}
return;
}
async function getLastConversationPreview(
conversationId: string,
options: {
Message: typeof MessageModelType;
}
): Promise<MessageModelType | undefined> {
const { Message } = options;
const result = await channels.getLastConversationPreview(conversationId);
if (result) {
return new Message(result);
}
return;
}
async function getMessageMetricsForConversation(conversationId: string) {
const result = await channels.getMessageMetricsForConversation(
conversationId