mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 20:31:19 +00:00
stuff
This commit is contained in:
parent
279d4b05e0
commit
35b0613c58
9 changed files with 22 additions and 16 deletions
|
@ -860,6 +860,22 @@ pub async fn purge_user_account(person_id: PersonId, context: &LemmyContext) ->
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn generate_followers_url(actor_id: &DbUrl) -> Result<DbUrl, ParseError> {
|
||||
Ok(Url::parse(&format!("{actor_id}/followers"))?.into())
|
||||
}
|
||||
|
||||
pub fn generate_outbox_url(actor_id: &DbUrl) -> Result<DbUrl, ParseError> {
|
||||
Ok(Url::parse(&format!("{actor_id}/outbox"))?.into())
|
||||
}
|
||||
|
||||
pub fn generate_featured_url(actor_id: &DbUrl) -> Result<DbUrl, ParseError> {
|
||||
Ok(Url::parse(&format!("{actor_id}/featured"))?.into())
|
||||
}
|
||||
|
||||
pub fn generate_moderators_url(community_id: &DbUrl) -> LemmyResult<DbUrl> {
|
||||
Ok(Url::parse(&format!("{community_id}/moderators"))?.into())
|
||||
}
|
||||
|
||||
/// Ensure that ban/block expiry is in valid range. If its in past, throw error. If its more
|
||||
/// than 10 years in future, convert to permanent ban. Otherwise return the same value.
|
||||
pub fn check_expire_time(expires_unix_opt: Option<i64>) -> LemmyResult<Option<DateTime<Utc>>> {
|
||||
|
|
|
@ -13,7 +13,6 @@ use lemmy_api_common::{
|
|||
local_site_to_slur_regex,
|
||||
process_markdown,
|
||||
update_read_comments,
|
||||
EndpointType,
|
||||
},
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
|
|
|
@ -5,15 +5,11 @@ use lemmy_api_common::{
|
|||
community::{CommunityResponse, CreateCommunity},
|
||||
context::LemmyContext,
|
||||
utils::{
|
||||
generate_followers_url,
|
||||
generate_inbox_url,
|
||||
generate_shared_inbox_url,
|
||||
get_url_blocklist,
|
||||
is_admin,
|
||||
local_site_to_slur_regex,
|
||||
process_markdown_opt,
|
||||
proxy_image_link_api,
|
||||
EndpointType,
|
||||
},
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
|
|
|
@ -13,7 +13,6 @@ use lemmy_api_common::{
|
|||
local_site_to_slur_regex,
|
||||
mark_post_as_read,
|
||||
process_markdown_opt,
|
||||
EndpointType,
|
||||
},
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
|
@ -147,7 +146,7 @@ pub async fn create_post(
|
|||
.with_lemmy_type(LemmyErrorType::CouldntCreatePost)?;
|
||||
|
||||
generate_post_link_metadata(
|
||||
updated_post.clone(),
|
||||
inserted_post.clone(),
|
||||
custom_thumbnail.map(Into::into),
|
||||
|post| Some(SendActivityData::CreatePost(post)),
|
||||
Some(local_site),
|
||||
|
|
|
@ -11,7 +11,6 @@ use lemmy_api_common::{
|
|||
local_site_to_slur_regex,
|
||||
process_markdown,
|
||||
send_email_to_user,
|
||||
EndpointType,
|
||||
},
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
|
|
|
@ -5,7 +5,6 @@ use lemmy_api_common::{
|
|||
context::LemmyContext,
|
||||
site::{CreateSite, SiteResponse},
|
||||
utils::{
|
||||
generate_shared_inbox_url,
|
||||
get_url_blocklist,
|
||||
is_admin,
|
||||
local_site_rate_limit_to_rate_limit_config,
|
||||
|
|
|
@ -5,14 +5,11 @@ use lemmy_api_common::{
|
|||
context::LemmyContext,
|
||||
person::{LoginResponse, Register},
|
||||
utils::{
|
||||
generate_inbox_url,
|
||||
generate_shared_inbox_url,
|
||||
honeypot_check,
|
||||
local_site_to_slur_regex,
|
||||
password_length_check,
|
||||
send_new_applicant_email_to_admins,
|
||||
send_verification_email,
|
||||
EndpointType,
|
||||
},
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
|
|
|
@ -552,7 +552,8 @@ CREATE TRIGGER delete_follow
|
|||
FOR EACH ROW
|
||||
EXECUTE FUNCTION r.delete_follow_before_person ();
|
||||
|
||||
-- Triggers that change values before insert or update
|
||||
-- Triggers that change values before insert or update (they can't be for insert only, because regenerating
|
||||
-- the values using update must be possible)
|
||||
CREATE FUNCTION r.comment_change_values ()
|
||||
RETURNS TRIGGER
|
||||
LANGUAGE plpgsql
|
||||
|
|
|
@ -22,7 +22,7 @@ use diesel_async::{
|
|||
AsyncDieselConnectionManager,
|
||||
ManagerConfig,
|
||||
},
|
||||
SimpleAsyncConnection,
|
||||
RunQueryDsl,
|
||||
};
|
||||
use futures_util::{future::BoxFuture, Future, FutureExt};
|
||||
use i_love_jesus::CursorKey;
|
||||
|
@ -348,7 +348,7 @@ fn establish_connection(config: &str) -> BoxFuture<ConnectionResult<AsyncPgConne
|
|||
// for more complicated queries
|
||||
functions::set_config("from_collapse_limit", "11", false),
|
||||
functions::set_config("join_collapse_limit", "11", false),
|
||||
// * Set `lemmy.protocol_and_hostname` so triggers can use it
|
||||
// Set `lemmy.protocol_and_hostname` so triggers can use it
|
||||
functions::set_config("lemmy.protocol_and_hostname", SETTINGS.get_protocol_and_hostname(), false),
|
||||
))
|
||||
.execute(&mut conn)
|
||||
|
@ -503,7 +503,7 @@ pub mod functions {
|
|||
// really this function is variadic, this just adds the two-argument version
|
||||
sql_function!(fn coalesce<T: diesel::sql_types::SqlType + diesel::sql_types::SingleValue>(x: diesel::sql_types::Nullable<T>, y: T) -> T);
|
||||
|
||||
sql_function(fn set_config(setting_name: Text, new_value: Text, is_local: Bool) -> Text);
|
||||
sql_function!(fn set_config(setting_name: Text, new_value: Text, is_local: Bool) -> Text);
|
||||
}
|
||||
|
||||
pub const DELETED_REPLACEMENT_TEXT: &str = "*Permanently Deleted*";
|
||||
|
|
Loading…
Reference in a new issue