From db3196df5a23d51eb1daa29f653e4f39dc9c0f02 Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Mon, 27 Dec 2021 19:40:35 -0800 Subject: [PATCH] Use Reveddit to show removed posts/comments. Closes #299 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/post.rs | 21 ++++++++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index edf3082..25c23dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -572,7 +572,7 @@ checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libreddit" -version = "0.20.5" +version = "0.21.0" dependencies = [ "askama", "async-recursion", diff --git a/Cargo.toml b/Cargo.toml index 72c71cd..59278e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "libreddit" description = " Alternative private front-end to Reddit" license = "AGPL-3.0" repository = "https://github.com/spikecodes/libreddit" -version = "0.20.5" +version = "0.21.0" authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"] edition = "2021" diff --git a/src/post.rs b/src/post.rs index ff430fc..d176f7d 100644 --- a/src/post.rs +++ b/src/post.rs @@ -97,12 +97,22 @@ async fn parse_post(json: &serde_json::Value) -> Post { let awards: Awards = Awards::parse(&post["data"]["all_awardings"]); + let permalink = val(post, "permalink"); + + let body = if val(post, "removed_by_category") == "moderator" { + format!("
[removed] — view removed post
[removed] — view removed comment