mirror of
				https://git.sr.ht/~tsileo/microblog.pub
				synced 2025-06-05 21:59:23 +02:00 
			
		
		
		
	Fix empty tag page
This commit is contained in:
		@@ -685,10 +685,10 @@ async def tag_by_name(
 | 
			
		||||
        .join(models.TaggedOutboxObject)
 | 
			
		||||
        .where(*where)
 | 
			
		||||
    )
 | 
			
		||||
    if not tagged_count:
 | 
			
		||||
        raise HTTPException(status_code=404)
 | 
			
		||||
 | 
			
		||||
    if is_activitypub_requested(request):
 | 
			
		||||
        if not tagged_count:
 | 
			
		||||
            raise HTTPException(status_code=404)
 | 
			
		||||
 | 
			
		||||
        outbox_object_ids = await db_session.execute(
 | 
			
		||||
            select(models.OutboxObject.ap_id)
 | 
			
		||||
            .join(
 | 
			
		||||
@@ -736,6 +736,7 @@ async def tag_by_name(
 | 
			
		||||
            "request": request,
 | 
			
		||||
            "objects": outbox_objects,
 | 
			
		||||
        },
 | 
			
		||||
        status_code=200 if len(outbox_objects) else 404,
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -21,26 +21,34 @@
 | 
			
		||||
{% block content %}
 | 
			
		||||
{% include "header.html" %}
 | 
			
		||||
 | 
			
		||||
<div class="h-feed">
 | 
			
		||||
<data class="p-name" value="{{ local_actor.display_name}}'s notes"></data>
 | 
			
		||||
{% for outbox_object in objects %}
 | 
			
		||||
{% if outbox_object.ap_type in ["Note", "Article", "Video", "Question"] %}
 | 
			
		||||
{{ utils.display_object(outbox_object) }}
 | 
			
		||||
{% elif outbox_object.ap_type == "Announce" %}
 | 
			
		||||
<div class="shared-header"><strong>{{ local_actor.display_name }}</strong> shared</div>
 | 
			
		||||
{{ utils.display_object(outbox_object.relates_to_anybox_object) }}
 | 
			
		||||
{% if objects %}
 | 
			
		||||
 | 
			
		||||
    <div class="h-feed">
 | 
			
		||||
    <data class="p-name" value="{{ local_actor.display_name}}'s notes"></data>
 | 
			
		||||
    {% for outbox_object in objects %}
 | 
			
		||||
    {% if outbox_object.ap_type in ["Note", "Article", "Video", "Question"] %}
 | 
			
		||||
    {{ utils.display_object(outbox_object) }}
 | 
			
		||||
    {% elif outbox_object.ap_type == "Announce" %}
 | 
			
		||||
    <div class="shared-header"><strong>{{ local_actor.display_name }}</strong> shared</div>
 | 
			
		||||
    {{ utils.display_object(outbox_object.relates_to_anybox_object) }}
 | 
			
		||||
    {% endif %}
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <div class="box">
 | 
			
		||||
        {% if has_previous_page %}
 | 
			
		||||
        <a href="{{ url_for("index") }}?page={{ current_page - 1 }}">Previous</a>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
 | 
			
		||||
        {% if has_next_page %}
 | 
			
		||||
        <a href="{{ url_for("index") }}?page={{ current_page + 1 }}">Next</a>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
    <div style="padding: 20px;">
 | 
			
		||||
        <p>Nothing to see here yet!</p>
 | 
			
		||||
    </div>
 | 
			
		||||
{% endif %}
 | 
			
		||||
{% endfor %}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="box">
 | 
			
		||||
    {% if has_previous_page %}
 | 
			
		||||
    <a href="{{ url_for("index") }}?page={{ current_page - 1 }}">Previous</a>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    {% if has_next_page %}
 | 
			
		||||
    <a href="{{ url_for("index") }}?page={{ current_page + 1 }}">Next</a>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user