Preview mentions (#5571)

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Apoorv Mishra
2023-07-22 21:43:09 +05:30
committed by GitHub
parent dbd85d62cb
commit 5d71398ea6
27 changed files with 923 additions and 361 deletions

View File

@@ -0,0 +1,23 @@
import { Unfurl, UnfurlType } from "@shared/types";
import { Document, User } from "@server/models";
import { presentLastOnlineInfoFor, presentLastViewedInfoFor } from "./common";
function presentMention(
user: User,
document: Document
): Unfurl<UnfurlType.Mention> {
return {
type: UnfurlType.Mention,
title: user.name,
description: `${presentLastOnlineInfoFor(
user
)}${presentLastViewedInfoFor(user, document)}`,
thumbnailUrl: user.avatarUrl,
meta: {
id: user.id,
color: user.color,
},
};
}
export default presentMention;