fix: repost ui limitation
This commit is contained in:
parent
657c204a66
commit
4837da0cba
3 changed files with 72 additions and 49 deletions
|
@ -162,8 +162,12 @@ p {
|
|||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.post_right {
|
||||
max-width: calc(84% + 4px);
|
||||
.post_right:not(.repost) {
|
||||
max-width: calc(100% - 52px);
|
||||
}
|
||||
|
||||
.rhs {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.name {
|
||||
|
@ -183,8 +187,8 @@ p {
|
|||
max-width: unset;
|
||||
}
|
||||
|
||||
.post_right {
|
||||
max-width: calc(91% + 4px);
|
||||
.rhs {
|
||||
width: calc(100% - 23rem) !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1488,3 +1492,14 @@ align.center {
|
|||
align.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* lhs, rhs */
|
||||
.rhs {
|
||||
width: calc(100% - 23rem) !important;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 900px) {
|
||||
.rhs {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) }}
|
||||
|
|
|
@ -1007,21 +1007,25 @@ impl DataManager {
|
|||
};
|
||||
|
||||
if let Some(ref rt) = reposting {
|
||||
data.context.reposts_enabled = false; // cannot repost reposts
|
||||
if data.content.is_empty() {
|
||||
// reposting but NOT quoting... we shouldn't be able to repost a direct repost
|
||||
data.context.reposts_enabled = false;
|
||||
data.context.reactions_enabled = false;
|
||||
}
|
||||
|
||||
// mirror nsfw status
|
||||
if rt.context.is_nsfw {
|
||||
data.context.is_nsfw = true;
|
||||
}
|
||||
|
||||
// make sure we aren't trying to repost a repost
|
||||
if if let Some(ref repost) = rt.context.repost {
|
||||
repost.reposting.is_some()
|
||||
} else {
|
||||
false
|
||||
} {
|
||||
return Err(Error::MiscError("Cannot repost a repost".to_string()));
|
||||
}
|
||||
// // make sure we aren't trying to repost a repost
|
||||
// if if let Some(ref repost) = rt.context.repost {
|
||||
// repost.reposting.is_some()
|
||||
// } else {
|
||||
// false
|
||||
// } {
|
||||
// return Err(Error::MiscError("Cannot repost a repost".to_string()));
|
||||
// }
|
||||
|
||||
// ...
|
||||
if !rt.context.reposts_enabled {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue