Skip to content

Commit

Permalink
fix local icon url
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name authored and alphatownsman committed Jul 17, 2024
1 parent 9cbc812 commit 065c4fc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion catalog/jobs/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def run(self):
tags = TagManager.popular_tags(days=14, local_only=local)[:40]
excluding_identities = Takahe.get_no_discover_identities()

if settings.NEODB_DISCOVER_SHOW_POPULAR_POSTS:
if settings.DISCOVER_SHOW_POPULAR_POSTS:
reviews = (
Review.objects.filter(visibility=0)
.exclude(owner_id__in=excluding_identities)
Expand Down
5 changes: 4 additions & 1 deletion journal/templates/mark.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
<form method="post" action="{% url 'journal:mark' item.uuid %}">
{% csrf_token %}
{% 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>
<div role="group">
Expand Down
3 changes: 2 additions & 1 deletion journal/templates/posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<div style="display:flex;">
<div>
<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 style="flex-grow:1;">
Expand Down
7 changes: 6 additions & 1 deletion journal/views/mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ def mark(request: AuthedHttpRequest, item_uuid):
visibility = int(request.POST.get("visibility", default=0))
rating_grade = request.POST.get("rating_grade", default=0)
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")
tags = request.POST.get("tags")
tags = tags.split(",") if tags else []
Expand Down
10 changes: 10 additions & 0 deletions takahe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,16 @@ def fanout(self, type: str, **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):
"""
Expand Down

0 comments on commit 065c4fc

Please sign in to comment.