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;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post_right {
|
.post_right:not(.repost) {
|
||||||
max-width: calc(84% + 4px);
|
max-width: calc(100% - 52px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhs {
|
||||||
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
|
@ -183,8 +187,8 @@ p {
|
||||||
max-width: unset;
|
max-width: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post_right {
|
.rhs {
|
||||||
max-width: calc(91% + 4px);
|
width: calc(100% - 23rem) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1488,3 +1492,14 @@ align.center {
|
||||||
align.right {
|
align.right {
|
||||||
text-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,
|
{%- endmacro %} {% macro repost(repost, post, owner, secondary=false,
|
||||||
community=false, show_community=true, can_manage_post=false) -%}
|
community=false, show_community=true, can_manage_post=false) -%}
|
||||||
<div style="display: contents">
|
<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,
|
{{ self::post(post=post, owner=owner, secondary=secondary,
|
||||||
community=community, show_community=show_community,
|
community=community, show_community=show_community,
|
||||||
can_manage_post=can_manage_post) }}
|
can_manage_post=can_manage_post, repost=repost, expect_repost=true) }}
|
||||||
|
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
{%- endmacro %} {% macro post(post, owner, question=false, secondary=false,
|
{%- endmacro %} {% macro post(post, owner, question=false, secondary=false,
|
||||||
community=false, show_community=true, can_manage_post=false) -%} {% if community
|
community=false, show_community=true, can_manage_post=false, repost=false,
|
||||||
and show_community and community.id != config.town_square or question %}
|
expect_repost=false) -%} {% if community and show_community and community.id !=
|
||||||
|
config.town_square or question %}
|
||||||
<div class="card-nest">
|
<div class="card-nest">
|
||||||
{% if question %} {{ self::question(question=question[0], owner=question[1])
|
{% if question %} {{ self::question(question=question[0], owner=question[1])
|
||||||
}} {% else %}
|
}} {% else %}
|
||||||
|
@ -184,13 +153,24 @@ and show_community and community.id != config.town_square or question %}
|
||||||
hook="verify_emojis"
|
hook="verify_emojis"
|
||||||
>
|
>
|
||||||
<div class="w-full flex gap-2">
|
<div class="w-full flex gap-2">
|
||||||
|
{% if not expect_repost %}
|
||||||
<a href="/@{{ owner.username }}">
|
<a href="/@{{ owner.username }}">
|
||||||
{{ self::avatar(username=owner.username, size="52px",
|
{{ self::avatar(username=owner.username, size="52px",
|
||||||
selector_type="username") }}
|
selector_type="username") }}
|
||||||
</a>
|
</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">
|
<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"
|
<span class="name"
|
||||||
>{{ self::full_username(user=owner) }}</span
|
>{{ self::full_username(user=owner) }}</span
|
||||||
>
|
>
|
||||||
|
@ -239,12 +219,24 @@ and show_community and community.id != config.town_square or question %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if not post.context.content_warning %}
|
{% if not post.context.content_warning %}
|
||||||
|
<!-- prettier-ignore -->
|
||||||
<span
|
<span
|
||||||
id="post-content:{{ post.id }}"
|
id="post-content:{{ post.id }}"
|
||||||
class="no_p_margin"
|
class="no_p_margin"
|
||||||
hook="long"
|
hook="long"
|
||||||
>
|
>
|
||||||
{{ post.content|markdown|safe }}
|
{{ 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>
|
</span>
|
||||||
|
|
||||||
{{ self::post_media(upload_ids=post.uploads) }} {% else %}
|
{{ self::post_media(upload_ids=post.uploads) }} {% else %}
|
||||||
|
@ -257,12 +249,24 @@ and show_community and community.id != config.town_square or question %}
|
||||||
</summary>
|
</summary>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
|
<!-- prettier-ignore -->
|
||||||
<span
|
<span
|
||||||
id="post-content:{{ post.id }}"
|
id="post-content:{{ post.id }}"
|
||||||
class="no_p_margin"
|
class="no_p_margin"
|
||||||
hook="long"
|
hook="long"
|
||||||
>
|
>
|
||||||
{{ post.content|markdown|safe }}
|
{{ 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>
|
</span>
|
||||||
|
|
||||||
{{ self::post_media(upload_ids=post.uploads) }}
|
{{ self::post_media(upload_ids=post.uploads) }}
|
||||||
|
|
|
@ -1007,21 +1007,25 @@ impl DataManager {
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(ref rt) = reposting {
|
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
|
// mirror nsfw status
|
||||||
if rt.context.is_nsfw {
|
if rt.context.is_nsfw {
|
||||||
data.context.is_nsfw = true;
|
data.context.is_nsfw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure we aren't trying to repost a repost
|
// // make sure we aren't trying to repost a repost
|
||||||
if if let Some(ref repost) = rt.context.repost {
|
// if if let Some(ref repost) = rt.context.repost {
|
||||||
repost.reposting.is_some()
|
// repost.reposting.is_some()
|
||||||
} else {
|
// } else {
|
||||||
false
|
// false
|
||||||
} {
|
// } {
|
||||||
return Err(Error::MiscError("Cannot repost a repost".to_string()));
|
// return Err(Error::MiscError("Cannot repost a repost".to_string()));
|
||||||
}
|
// }
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
if !rt.context.reposts_enabled {
|
if !rt.context.reposts_enabled {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue