fix: repost ui limitation

This commit is contained in:
trisua 2025-05-17 22:12:29 -04:00
parent 657c204a66
commit 4837da0cba
3 changed files with 72 additions and 49 deletions

View file

@ -114,45 +114,14 @@ secondary=false) -%}
{%- endmacro %} {% macro repost(repost, post, owner, secondary=false,
community=false, show_community=true, can_manage_post=false) -%}
<div style="display: contents">
<!-- prettier-ignore -->
<div style="display: none" id="repost-content:{{ post.id }}">
{% if repost %}
{{ self::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false) }}
{% else %}
<div class="card tertiary red flex items-center gap-2">
{{ icon "frown" }}
<span>Could not find original post...</span>
</div>
{% endif %}
</div>
{{ self::post(post=post, owner=owner, secondary=secondary,
community=community, show_community=show_community,
can_manage_post=can_manage_post) }}
<script>
document.getElementById("post-content:{{ post.id }}").innerHTML +=
document.getElementById("repost-content:{{ post.id }}").innerHTML;
document.getElementById("repost-content:{{ post.id }}").remove();
document
.getElementById("post:{{ post.id }}")
.querySelector(".avatar")
.setAttribute("style", "--size: 24px");
document
.getElementById("post:{{ post.id }}")
.querySelector(".name")
.parentElement.prepend(
document
.getElementById("post:{{ post.id }}")
.querySelector(".avatar"),
);
</script>
can_manage_post=can_manage_post, repost=repost, expect_repost=true) }}
</div>
{%- endmacro %} {% macro post(post, owner, question=false, secondary=false,
community=false, show_community=true, can_manage_post=false) -%} {% if community
and show_community and community.id != config.town_square or question %}
community=false, show_community=true, can_manage_post=false, repost=false,
expect_repost=false) -%} {% if community and show_community and community.id !=
config.town_square or question %}
<div class="card-nest">
{% if question %} {{ self::question(question=question[0], owner=question[1])
}} {% else %}
@ -184,13 +153,24 @@ and show_community and community.id != config.town_square or question %}
hook="verify_emojis"
>
<div class="w-full flex gap-2">
{% if not expect_repost %}
<a href="/@{{ owner.username }}">
{{ self::avatar(username=owner.username, size="52px",
selector_type="username") }}
</a>
{% endif %}
<div class="flex flex-col w-full gap-1 post_right">
<div
class="flex flex-col w-full gap-1 post_right {% if expect_repost %}repost{% endif %}"
>
<div class="flex flex-wrap gap-2 items-center">
{% if expect_repost %}
<a href="/@{{ owner.username }}">
{{ self::avatar(username=owner.username, size="24px",
selector_type="username") }}
</a>
{% endif %}
<span class="name"
>{{ self::full_username(user=owner) }}</span
>
@ -239,12 +219,24 @@ and show_community and community.id != config.town_square or question %}
</div>
{% if not post.context.content_warning %}
<!-- prettier-ignore -->
<span
id="post-content:{{ post.id }}"
class="no_p_margin"
hook="long"
>
{{ post.content|markdown|safe }}
{% if expect_repost %}
{% if repost %}
{{ self::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false) }}
{% else %}
<div class="card tertiary red flex items-center gap-2">
{{ icon "frown" }}
<span>Could not find original post...</span>
</div>
{% endif %}
{% endif %}
</span>
{{ self::post_media(upload_ids=post.uploads) }} {% else %}
@ -257,12 +249,24 @@ and show_community and community.id != config.town_square or question %}
</summary>
<div class="flex flex-col gap-2">
<!-- prettier-ignore -->
<span
id="post-content:{{ post.id }}"
class="no_p_margin"
hook="long"
>
{{ post.content|markdown|safe }}
{% if expect_repost %}
{% if repost %}
{{ self::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false) }}
{% else %}
<div class="card tertiary red flex items-center gap-2">
{{ icon "frown" }}
<span>Could not find original post...</span>
</div>
{% endif %}
{% endif %}
</span>
{{ self::post_media(upload_ids=post.uploads) }}