fix local icon url
This commit is contained in:
parent
9cbc812bc0
commit
065c4fc0f8
5 changed files with 23 additions and 4 deletions
|
@ -165,7 +165,7 @@ class DiscoverGenerator(BaseJob):
|
||||||
tags = TagManager.popular_tags(days=14, local_only=local)[:40]
|
tags = TagManager.popular_tags(days=14, local_only=local)[:40]
|
||||||
excluding_identities = Takahe.get_no_discover_identities()
|
excluding_identities = Takahe.get_no_discover_identities()
|
||||||
|
|
||||||
if settings.NEODB_DISCOVER_SHOW_POPULAR_POSTS:
|
if settings.DISCOVER_SHOW_POPULAR_POSTS:
|
||||||
reviews = (
|
reviews = (
|
||||||
Review.objects.filter(visibility=0)
|
Review.objects.filter(visibility=0)
|
||||||
.exclude(owner_id__in=excluding_identities)
|
.exclude(owner_id__in=excluding_identities)
|
||||||
|
|
|
@ -20,7 +20,10 @@
|
||||||
<form method="post" action="{% url 'journal:mark' item.uuid %}">
|
<form method="post" action="{% url 'journal:mark' item.uuid %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% if shelf_statuses %}
|
{% if shelf_statuses %}
|
||||||
<input type="hidden" id="mark-status" name="status" value="{{ shelf_type }}">
|
<input type="hidden"
|
||||||
|
id="mark-status"
|
||||||
|
name="status"
|
||||||
|
value="{{ shelf_type |default:'wishlist' }}">
|
||||||
<div class="grid mark-line">
|
<div class="grid mark-line">
|
||||||
<div>
|
<div>
|
||||||
<div role="group">
|
<div role="group">
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
<div style="display:flex;">
|
<div style="display:flex;">
|
||||||
<div>
|
<div>
|
||||||
<div class="avatar" style="margin:0.6em 0.6em 0.6em 0;">
|
<div class="avatar" style="margin:0.6em 0.6em 0.6em 0;">
|
||||||
<img src="{{ post.author.icon_uri }}" alt="@{{ post.author.handle }}" />
|
<img src="{{ post.author.local_icon_url }}"
|
||||||
|
alt="@{{ post.author.handle }}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="flex-grow:1;">
|
<div style="flex-grow:1;">
|
||||||
|
|
|
@ -66,7 +66,12 @@ def mark(request: AuthedHttpRequest, item_uuid):
|
||||||
visibility = int(request.POST.get("visibility", default=0))
|
visibility = int(request.POST.get("visibility", default=0))
|
||||||
rating_grade = request.POST.get("rating_grade", default=0)
|
rating_grade = request.POST.get("rating_grade", default=0)
|
||||||
rating_grade = int(rating_grade) if rating_grade else None
|
rating_grade = int(rating_grade) if rating_grade else None
|
||||||
status = ShelfType(request.POST.get("status", "wishlist"))
|
_status = request.POST.get("status", "wishlist")
|
||||||
|
try:
|
||||||
|
status = ShelfType(_status)
|
||||||
|
except Exception:
|
||||||
|
logger.error(f"unknown shelf: {_status}")
|
||||||
|
status = ShelfType.WISHLIST
|
||||||
text = request.POST.get("text")
|
text = request.POST.get("text")
|
||||||
tags = request.POST.get("tags")
|
tags = request.POST.get("tags")
|
||||||
tags = tags.split(",") if tags else []
|
tags = tags.split(",") if tags else []
|
||||||
|
|
|
@ -753,6 +753,16 @@ class Identity(models.Model):
|
||||||
identity=target, subject_identity=self, type=type, **kwargs
|
identity=target, subject_identity=self, type=type, **kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def local_icon_url(self):
|
||||||
|
if self.local:
|
||||||
|
return (
|
||||||
|
self.icon.url
|
||||||
|
if self.icon
|
||||||
|
else self.icon_uri or settings.SITE_INFO["user_icon"]
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return f"/proxy/identity_icon/{self.pk}/"
|
||||||
|
|
||||||
|
|
||||||
class Follow(models.Model):
|
class Follow(models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue