Allow send with edited link preview
This commit is contained in:
parent
1e57db6aa4
commit
2dc8a5a7e3
3 changed files with 31 additions and 0 deletions
|
@ -17,3 +17,28 @@ type GenericLinkPreviewType<Image> = {
|
|||
export type LinkPreviewType = GenericLinkPreviewType<AttachmentType>;
|
||||
export type LinkPreviewWithHydratedData =
|
||||
GenericLinkPreviewType<AttachmentWithHydratedData>;
|
||||
|
||||
export function isSameLinkPreview(
|
||||
prev: LinkPreviewType | undefined | null,
|
||||
next: LinkPreviewType | undefined | null
|
||||
): boolean {
|
||||
// Both has to be absent or present
|
||||
if (prev == null || next == null) {
|
||||
return prev == null && next == null;
|
||||
}
|
||||
|
||||
if (prev.url !== next.url) {
|
||||
return false;
|
||||
}
|
||||
if (prev.title !== next.title) {
|
||||
return false;
|
||||
}
|
||||
if (prev.description !== next.description) {
|
||||
return false;
|
||||
}
|
||||
if (prev.image?.plaintextHash !== next.image?.plaintextHash) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue