From 4837da0cba7a93dbb6ed8e26ff3d2faa1aeffcc2 Mon Sep 17 00:00:00 2001 From: trisua Date: Sat, 17 May 2025 22:12:29 -0400 Subject: [PATCH] fix: repost ui limitation --- crates/app/src/public/css/style.css | 23 +++++-- crates/app/src/public/html/components.html | 76 ++++++++++++---------- crates/core/src/database/posts.rs | 22 ++++--- 3 files changed, 72 insertions(+), 49 deletions(-) diff --git a/crates/app/src/public/css/style.css b/crates/app/src/public/css/style.css index c9d77b7..c4d67f6 100644 --- a/crates/app/src/public/css/style.css +++ b/crates/app/src/public/css/style.css @@ -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; + } +} diff --git a/crates/app/src/public/html/components.html b/crates/app/src/public/html/components.html index 472f1f6..6c3755b 100644 --- a/crates/app/src/public/html/components.html +++ b/crates/app/src/public/html/components.html @@ -114,45 +114,14 @@ secondary=false) -%} {%- endmacro %} {% macro repost(repost, post, owner, secondary=false, community=false, show_community=true, can_manage_post=false) -%}
- - - {{ self::post(post=post, owner=owner, secondary=secondary, community=community, show_community=show_community, - can_manage_post=can_manage_post) }} - - + can_manage_post=can_manage_post, repost=repost, expect_repost=true) }}
{%- 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 %}
{% 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" >
+ {% if not expect_repost %} {{ self::avatar(username=owner.username, size="52px", selector_type="username") }} + {% endif %} -
+
+ {% if expect_repost %} + + {{ self::avatar(username=owner.username, size="24px", + selector_type="username") }} + + {% endif %} + {{ self::full_username(user=owner) }} @@ -239,12 +219,24 @@ and show_community and community.id != config.town_square or question %}
{% if not post.context.content_warning %} + {{ 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 %} +
+ {{ icon "frown" }} + Could not find original post... +
+ {% endif %} + {% endif %}
{{ self::post_media(upload_ids=post.uploads) }} {% else %} @@ -257,12 +249,24 @@ and show_community and community.id != config.town_square or question %}
+ {{ 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 %} +
+ {{ icon "frown" }} + Could not find original post... +
+ {% endif %} + {% endif %}
{{ self::post_media(upload_ids=post.uploads) }} diff --git a/crates/core/src/database/posts.rs b/crates/core/src/database/posts.rs index 592a373..ad82159 100644 --- a/crates/core/src/database/posts.rs +++ b/crates/core/src/database/posts.rs @@ -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 {