From b63df2cb31c2decb87e4b24588753be2b42e05b9 Mon Sep 17 00:00:00 2001 From: trisua Date: Wed, 14 May 2025 19:54:53 -0400 Subject: [PATCH] add: post likes page fix: requests pkey --- crates/app/src/assets.rs | 2 + crates/app/src/langs/en-US.toml | 1 + crates/app/src/public/html/post/likes.html | 74 ++++++++++++ crates/app/src/public/html/post/post.html | 15 ++- crates/app/src/public/html/post/quotes.html | 15 ++- crates/app/src/public/html/post/reposts.html | 15 ++- crates/app/src/routes/pages/communities.rs | 114 ++++++++++++++++++ crates/app/src/routes/pages/mod.rs | 1 + .../database/drivers/sql/create_requests.sql | 3 +- crates/core/src/database/reactions.rs | 47 +++++++- sql_changes/requests_pkeys.sql | 1 + 11 files changed, 274 insertions(+), 14 deletions(-) create mode 100644 crates/app/src/public/html/post/likes.html create mode 100644 sql_changes/requests_pkeys.sql diff --git a/crates/app/src/assets.rs b/crates/app/src/assets.rs index b4e5e0d..df26836 100644 --- a/crates/app/src/assets.rs +++ b/crates/app/src/assets.rs @@ -72,6 +72,7 @@ pub const COMMUNITIES_QUESTIONS: &str = include_str!("./public/html/communities/ pub const POST_POST: &str = include_str!("./public/html/post/post.html"); pub const POST_REPOSTS: &str = include_str!("./public/html/post/reposts.html"); pub const POST_QUOTES: &str = include_str!("./public/html/post/quotes.html"); +pub const POST_LIKES: &str = include_str!("./public/html/post/likes.html"); pub const TIMELINES_HOME: &str = include_str!("./public/html/timelines/home.html"); pub const TIMELINES_POPULAR: &str = include_str!("./public/html/timelines/popular.html"); @@ -270,6 +271,7 @@ pub(crate) async fn write_assets(config: &Config) -> PathBufD { write_template!(html_path->"post/post.html"(crate::assets::POST_POST) -d "post" --config=config); write_template!(html_path->"post/reposts.html"(crate::assets::POST_REPOSTS) --config=config); write_template!(html_path->"post/quotes.html"(crate::assets::POST_QUOTES) --config=config); + write_template!(html_path->"post/likes.html"(crate::assets::POST_LIKES) --config=config); write_template!(html_path->"timelines/home.html"(crate::assets::TIMELINES_HOME) -d "timelines" --config=config); write_template!(html_path->"timelines/popular.html"(crate::assets::TIMELINES_POPULAR) --config=config); diff --git a/crates/app/src/langs/en-US.toml b/crates/app/src/langs/en-US.toml index 5cd2089..4d5e9ab 100644 --- a/crates/app/src/langs/en-US.toml +++ b/crates/app/src/langs/en-US.toml @@ -90,6 +90,7 @@ version = "1.0.0" "communities:label.replies" = "Replies" "communities:label.reposts" = "Reposts" "communities:label.quotes" = "Quotes" +"communities:label.likes" = "Likes" "communities:action.continue_thread" = "Continue thread" "communities:tab.members" = "Members" "communities:label.select_member" = "Select member" diff --git a/crates/app/src/public/html/post/likes.html b/crates/app/src/public/html/post/likes.html new file mode 100644 index 0000000..90f132d --- /dev/null +++ b/crates/app/src/public/html/post/likes.html @@ -0,0 +1,74 @@ +{% extends "root.html" %} {% block head %} +Post quotes - {{ config.name }} +{% endblock %} {% block body %} {{ macros::nav() }} +
+ {% if post.replying_to %} + + {{ icon "arrow-up" }} + {{ text "communities:action.continue_thread" }} + + {% endif %} + + +
+ {% if post.context.repost and post.context.repost.reposting %} + {{ components::repost(repost=reposting, post=post, owner=owner, community=community, show_community=true, can_manage_post=can_manage_posts) }} + {% else %} + {{ components::post(post=post, owner=owner, question=question, community=community, show_community=true, can_manage_post=can_manage_posts) }} + {% endif %} +
+ + + + {% if (user and user.id == post.owner) or can_manage_posts %} {% if user and + user.id == post.owner %} + + {% endif %} + +
+
+ {{ icon "heart" }} + {{ text "communities:label.likes" }} +
+ +
+ + {% for user in list %} + {{ components::user_plate(user=user, secondary=true) }} + {% endfor %} + + {{ components::pagination(page=page, items=list|length) }} +
+
+
+{% endblock %} diff --git a/crates/app/src/public/html/post/post.html b/crates/app/src/public/html/post/post.html index 2137ae9..0da0fee 100644 --- a/crates/app/src/public/html/post/post.html +++ b/crates/app/src/public/html/post/post.html @@ -74,19 +74,26 @@ {{ text "communities:label.quotes" }} - {% if user and user.id == post.owner %} + + {{ icon "heart" }} + {{ text "communities:label.likes" }} + + + + {% if (user and user.id == post.owner) or can_manage_posts %} {% if user and + user.id == post.owner %} +
{{ icon "pen" }} {{ text "communities:label.edit_content" }} - {% endif %} {% if (user and user.id == post.owner) or can_manage_posts - %} + {% endif %} {{ icon "settings" }} {{ text "communities:action.configure" }} - {% endif %}
+ {% endif %}