From 388eb42b994420ca67f025f82ae742bafa732ac3 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 26 Oct 2023 11:38:37 +0200 Subject: [PATCH] undo post.url rewriting, move http route definition --- crates/api_crud/src/post/create.rs | 4 ++-- crates/api_crud/src/post/update.rs | 3 +-- crates/apub/src/objects/post.rs | 14 +++++++------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/crates/api_crud/src/post/create.rs b/crates/api_crud/src/post/create.rs index b45f3c8dc..3ffa54685 100644 --- a/crates/api_crud/src/post/create.rs +++ b/crates/api_crud/src/post/create.rs @@ -12,6 +12,7 @@ use lemmy_api_common::{ honeypot_check, local_site_to_slur_regex, mark_post_as_read, + process_markdown_opt, EndpointType, }, }; @@ -31,14 +32,13 @@ use lemmy_utils::{ error::{LemmyError, LemmyErrorExt, LemmyErrorType}, spawn_try_task, utils::{ - slurs::{check_slurs}, + slurs::check_slurs, validation::{check_url_scheme, clean_url_params, is_valid_body_field, is_valid_post_title}, }, }; use tracing::Instrument; use url::Url; use webmention::{Webmention, WebmentionError}; -use lemmy_api_common::utils::process_markdown_opt; #[tracing::instrument(skip(context))] pub async fn create_post( diff --git a/crates/api_crud/src/post/update.rs b/crates/api_crud/src/post/update.rs index ac275fe00..73a4962f9 100644 --- a/crates/api_crud/src/post/update.rs +++ b/crates/api_crud/src/post/update.rs @@ -6,7 +6,7 @@ use lemmy_api_common::{ post::{EditPost, PostResponse}, request::fetch_site_data, send_activity::{ActivityChannel, SendActivityData}, - utils::{check_community_user_action, local_site_to_slur_regex}, + utils::{check_community_user_action, local_site_to_slur_regex, process_markdown_opt}, }; use lemmy_db_schema::{ source::{ @@ -26,7 +26,6 @@ use lemmy_utils::{ }, }; use std::ops::Deref; -use lemmy_api_common::utils::process_markdown_opt; #[tracing::instrument(skip(context))] pub async fn update_post( diff --git a/crates/apub/src/objects/post.rs b/crates/apub/src/objects/post.rs index c59ab74f8..f7c799e97 100644 --- a/crates/apub/src/objects/post.rs +++ b/crates/apub/src/objects/post.rs @@ -25,7 +25,12 @@ use html2text::{from_read_with_decorator, render::text_renderer::TrivialDecorato use lemmy_api_common::{ context::LemmyContext, request::fetch_site_data, - utils::{is_mod_or_admin, local_site_opt_to_sensitive, local_site_opt_to_slur_regex}, + utils::{ + is_mod_or_admin, + local_site_opt_to_sensitive, + local_site_opt_to_slur_regex, + process_markdown_opt, + }, }; use lemmy_db_schema::{ self, @@ -40,16 +45,11 @@ use lemmy_db_schema::{ }; use lemmy_utils::{ error::LemmyError, - utils::{ - markdown::markdown_to_html, - slurs::{check_slurs_opt}, - validation::check_url_scheme, - }, + utils::{markdown::markdown_to_html, slurs::check_slurs_opt, validation::check_url_scheme}, }; use std::ops::Deref; use stringreader::StringReader; use url::Url; -use lemmy_api_common::utils::process_markdown_opt; const MAX_TITLE_LENGTH: usize = 200;