Merge remote-tracking branch 'origin/main' into enable_private_messages_setting

This commit is contained in:
Dessalines 2024-11-05 09:49:43 -05:00
commit 5fb642ed34
26 changed files with 36 additions and 27 deletions

View file

@ -5,10 +5,7 @@ use lemmy_api_common::{
request::fetch_link_metadata,
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{
error::{LemmyErrorExt, LemmyResult},
LemmyErrorType,
};
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
use url::Url;
#[tracing::instrument(skip(context))]

View file

@ -31,7 +31,10 @@ use lemmy_db_schema::{
RegistrationMode,
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyResult, LemmyErrorType, CACHE_DURATION_API};
use lemmy_utils::{
error::{LemmyErrorType, LemmyResult},
CACHE_DURATION_API,
};
use serial_test::serial;
async fn create_test_site(context: &Data<LemmyContext>) -> LemmyResult<(Instance, LocalUserView)> {

View file

@ -26,7 +26,7 @@ pub extern crate lemmy_db_views_actor;
pub extern crate lemmy_db_views_moderator;
pub extern crate lemmy_utils;
pub use lemmy_utils::LemmyErrorType;
pub use lemmy_utils::error::LemmyErrorType;
use serde::{Deserialize, Serialize};
use std::{cmp::min, time::Duration};

View file

@ -2,7 +2,7 @@ use chrono::{DateTime, TimeZone, Utc};
use lemmy_api_common::context::LemmyContext;
use lemmy_db_schema::source::post::Post;
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
pub mod create;
pub mod delete;

View file

@ -26,7 +26,7 @@ use crate::{
};
use activitypub_federation::{config::Data, traits::ActivityHandler};
use lemmy_api_common::context::LemmyContext;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use serde::{Deserialize, Serialize};
use url::Url;

View file

@ -86,7 +86,7 @@ mod tests {
traits::Crud,
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use serial_test::serial;
#[tokio::test]

View file

@ -15,7 +15,7 @@ use activitypub_federation::{
use actix_web::{web, HttpResponse};
use lemmy_api_common::context::LemmyContext;
use lemmy_db_schema::{source::community::Community, traits::ApubActor};
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use serde::Deserialize;
#[derive(Deserialize, Clone)]

View file

@ -7,7 +7,7 @@ use activitypub_federation::{config::Data, traits::Object};
use actix_web::{web, HttpResponse};
use lemmy_api_common::{context::LemmyContext, utils::generate_outbox_url};
use lemmy_db_schema::{source::person::Person, traits::ApubActor};
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use serde::Deserialize;
#[derive(Deserialize)]

View file

@ -24,7 +24,10 @@ use lemmy_db_schema::{
source::{community::Community, post::Post},
traits::Crud,
};
use lemmy_utils::{error::LemmyResult, LemmyErrorType, MAX_COMMENT_DEPTH_LIMIT};
use lemmy_utils::{
error::{LemmyErrorType, LemmyResult},
MAX_COMMENT_DEPTH_LIMIT,
};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use url::Url;

View file

@ -13,7 +13,7 @@ use diesel::{
QueryDsl,
};
use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl CaptchaAnswer {
pub async fn insert(pool: &mut DbPool<'_>, captcha: &CaptchaAnswerForm) -> Result<Self, Error> {

View file

@ -16,7 +16,7 @@ use diesel::{
QueryDsl,
};
use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl CommunityBlock {
pub async fn read(

View file

@ -16,7 +16,7 @@ use diesel::{
QueryDsl,
};
use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl InstanceBlock {
pub async fn read(

View file

@ -7,7 +7,7 @@ use crate::{
};
use diesel::{delete, dsl::exists, insert_into, result::Error, select};
use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl LoginToken {
pub async fn create(pool: &mut DbPool<'_>, form: LoginTokenCreateForm) -> Result<Self, Error> {

View file

@ -21,7 +21,7 @@ use diesel::{
QueryDsl,
};
use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
#[async_trait]
impl Crud for Person {

View file

@ -17,7 +17,7 @@ use diesel::{
QueryDsl,
};
use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl PersonBlock {
pub async fn read(

View file

@ -10,7 +10,7 @@ use crate::{
};
use diesel::{dsl::insert_into, result::Error, ExpressionMethods, OptionalExtension, QueryDsl};
use diesel_async::RunQueryDsl;
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
use url::Url;
#[async_trait]

View file

@ -5,7 +5,7 @@ use lemmy_db_schema::{
schema::{local_site, local_site_rate_limit, site, site_aggregates},
utils::{get_conn, DbPool},
};
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl SiteView {
pub async fn read_local(pool: &mut DbPool<'_>) -> LemmyResult<Self> {

View file

@ -8,7 +8,7 @@ use lemmy_db_schema::{
source::local_user::LocalUser,
utils::{get_conn, DbPool},
};
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl CommunityModeratorView {
pub async fn check_is_community_moderator(

View file

@ -11,7 +11,7 @@ use lemmy_db_schema::{
schema::community_person_ban,
utils::{get_conn, DbPool},
};
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
impl CommunityPersonBanView {
pub async fn check(

View file

@ -35,7 +35,7 @@ use lemmy_db_schema::{
ListingType,
PostSortType,
};
use lemmy_utils::{error::LemmyResult, LemmyErrorType};
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
fn queries<'a>() -> Queries<
impl ReadFn<'a, CommunityView, (CommunityId, Option<&'a LocalUser>, bool)>,

View file

@ -13,7 +13,6 @@ cfg_if! {
}
pub mod error;
pub use error::LemmyErrorType;
use std::time::Duration;
pub type ConnectionId = usize;

View file

@ -1,4 +1,4 @@
use crate::{error::LemmyResult, LemmyErrorType};
use crate::error::{LemmyErrorType, LemmyResult};
use markdown_it::MarkdownIt;
use regex::RegexSet;
use std::sync::LazyLock;

View file

@ -1,4 +1,4 @@
use lemmy_utils::LemmyErrorType;
use lemmy_utils::error::LemmyErrorType;
use std::{env::current_dir, process::Command};
use strum::IntoEnumIterator;

View file

@ -1,3 +1,5 @@
ALTER TABLE post
ALTER COLUMN url TYPE varchar(512);
ANALYZE post (url);

View file

@ -3,3 +3,5 @@
ALTER TABLE post
ALTER COLUMN url TYPE varchar(2000);
ANALYZE post (url);

View file

@ -609,7 +609,10 @@ mod tests {
use crate::scheduled_tasks::build_update_instance_form;
use lemmy_api_common::request::client_builder;
use lemmy_utils::{error::LemmyResult, settings::structs::Settings, LemmyErrorType};
use lemmy_utils::{
error::{LemmyErrorType, LemmyResult},
settings::structs::Settings,
};
use pretty_assertions::assert_eq;
use reqwest_middleware::ClientBuilder;
use serial_test::serial;