Display correct info in hover preview (#5597)

This commit is contained in:
Apoorv Mishra
2023-07-23 21:31:46 +05:30
committed by GitHub
parent 479b805613
commit 0db6f39f43
3 changed files with 19 additions and 10 deletions

View File

@@ -2,16 +2,17 @@ import { Unfurl, UnfurlType } from "@shared/types";
import { Document, User } from "@server/models";
import { presentLastOnlineInfoFor, presentLastViewedInfoFor } from "./common";
function presentMention(
async function presentMention(
user: User,
document: Document
): Unfurl<UnfurlType.Mention> {
): Promise<Unfurl<UnfurlType.Mention>> {
const lastOnlineInfo = presentLastOnlineInfoFor(user);
const lastViewedInfo = await presentLastViewedInfoFor(user, document);
return {
type: UnfurlType.Mention,
title: user.name,
description: `${presentLastOnlineInfoFor(
user
)}${presentLastViewedInfoFor(user, document)}`,
description: `${lastOnlineInfo}${lastViewedInfo}`,
thumbnailUrl: user.avatarUrl,
meta: {
id: user.id,