Merge pull request #1645 from bookwyrm-social/status-previews
Use book preview card for social media on status page
This commit is contained in:
commit
749c902070
|
@ -2,6 +2,18 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
|
|
||||||
|
{% block opengraph_images %}
|
||||||
|
|
||||||
|
{% firstof status.book status.mention_books.first as book %}
|
||||||
|
{% if book %}
|
||||||
|
{% include 'snippets/opengraph_images.html' with image=preview %}
|
||||||
|
{% else %}
|
||||||
|
{% include 'snippets/opengraph_images.html' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block panel %}
|
{% block panel %}
|
||||||
<header class="block">
|
<header class="block">
|
||||||
<a href="/#feed" class="button" data-back>
|
<a href="/#feed" class="button" data-back>
|
||||||
|
|
|
@ -177,12 +177,19 @@ class Status(View):
|
||||||
params=[status.id, visible_thread, visible_thread],
|
params=[status.id, visible_thread, visible_thread],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
preview = None
|
||||||
|
if hasattr(status, "book"):
|
||||||
|
preview = status.book.preview_image
|
||||||
|
elif status.mention_books.exists():
|
||||||
|
preview = status.mention_books.first().preview_image
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
**feed_page_data(request.user),
|
**feed_page_data(request.user),
|
||||||
**{
|
**{
|
||||||
"status": status,
|
"status": status,
|
||||||
"children": children,
|
"children": children,
|
||||||
"ancestors": ancestors,
|
"ancestors": ancestors,
|
||||||
|
"preview": preview,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "feed/status.html", data)
|
return TemplateResponse(request, "feed/status.html", data)
|
||||||
|
|
Loading…
Reference in New Issue