My first thought was to do this as a new PreviewCard stator model that a Post can FK to, but maybe a more generic Link model with a Post M2M would be better. Or maybe a links JSONField that's parsed similar to hashtags? In any case, the important bit is that the preview card should only exist (and be updated) in one place, no matter how many posts include the same link.
Some relevant links:
https://docs.joinmastodon.org/entities/PreviewCard/
https://github.com/mastodon/mastodon/blob/main/app/services/fetch_link_card_service.rb
https://oembed.com
My first thought was to do this as a new
PreviewCardstator model that aPostcan FK to, but maybe a more genericLinkmodel with aPostM2M would be better. Or maybe alinksJSONFieldthat's parsed similar tohashtags? In any case, the important bit is that the preview card should only exist (and be updated) in one place, no matter how many posts include the same link.Some relevant links:
https://docs.joinmastodon.org/entities/PreviewCard/
https://github.com/mastodon/mastodon/blob/main/app/services/fetch_link_card_service.rb
https://oembed.com