From a5289dd4cf0860c1605b72591191757b56e3c94e Mon Sep 17 00:00:00 2001 From: ALEX11BR <49609151+ALEX11BR@users.noreply.github.com> Date: Thu, 4 Jan 2024 11:47:18 +0200 Subject: [PATCH 01/19] Use `pretty_assertions` for assertions (#4347) * Use `pretty_assertions` for assertions * fixed ordering of `use`s * ci --------- Co-authored-by: Felix Ableitner --- Cargo.lock | 30 +++++++++++++++++++ Cargo.toml | 4 +++ crates/api/Cargo.toml | 1 + crates/api/src/sitemap.rs | 1 + crates/api_common/Cargo.toml | 1 + crates/api_common/src/claims.rs | 1 + crates/api_common/src/request.rs | 1 + crates/api_common/src/utils.rs | 1 + crates/apub/Cargo.toml | 1 + crates/apub/src/api/user_settings_backup.rs | 1 + .../src/collections/community_moderators.rs | 1 + crates/apub/src/objects/comment.rs | 1 + crates/apub/src/objects/community.rs | 1 + crates/apub/src/objects/instance.rs | 1 + crates/apub/src/objects/person.rs | 1 + crates/apub/src/objects/post.rs | 1 + crates/apub/src/objects/private_message.rs | 1 + crates/apub/src/protocol/collections/mod.rs | 1 + crates/db_schema/Cargo.toml | 1 + .../src/aggregates/comment_aggregates.rs | 1 + .../src/aggregates/community_aggregates.rs | 1 + .../src/aggregates/person_aggregates.rs | 1 + .../src/aggregates/post_aggregates.rs | 1 + .../src/aggregates/site_aggregates.rs | 1 + crates/db_schema/src/impls/activity.rs | 1 + crates/db_schema/src/impls/actor_language.rs | 1 + crates/db_schema/src/impls/comment.rs | 1 + crates/db_schema/src/impls/comment_reply.rs | 1 + crates/db_schema/src/impls/community.rs | 1 + .../src/impls/federation_allowlist.rs | 1 + crates/db_schema/src/impls/language.rs | 1 + crates/db_schema/src/impls/moderator.rs | 1 + .../src/impls/password_reset_request.rs | 1 + crates/db_schema/src/impls/person.rs | 1 + crates/db_schema/src/impls/person_mention.rs | 1 + crates/db_schema/src/impls/post.rs | 1 + crates/db_schema/src/impls/post_report.rs | 1 + crates/db_schema/src/impls/private_message.rs | 1 + crates/db_schema/src/utils.rs | 1 + crates/db_views/Cargo.toml | 1 + crates/db_views/src/comment_report_view.rs | 1 + crates/db_views/src/comment_view.rs | 1 + crates/db_views/src/post_report_view.rs | 1 + crates/db_views/src/post_view.rs | 1 + .../src/private_message_report_view.rs | 1 + crates/db_views/src/private_message_view.rs | 1 + .../src/registration_application_view.rs | 1 + crates/db_views/src/vote_view.rs | 1 + crates/db_views_actor/Cargo.toml | 1 + crates/db_views_actor/src/person_view.rs | 1 + crates/utils/Cargo.toml | 1 + crates/utils/src/error.rs | 1 + crates/utils/src/rate_limit/rate_limiter.rs | 1 + crates/utils/src/response.rs | 1 + crates/utils/src/utils/markdown.rs | 1 + .../utils/src/utils/markdown/spoiler_rule.rs | 1 + crates/utils/src/utils/mention.rs | 1 + crates/utils/src/utils/slurs.rs | 1 + crates/utils/src/utils/validation.rs | 1 + src/scheduled_tasks.rs | 1 + src/session_middleware.rs | 1 + 61 files changed, 93 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 86342b923..c5a490b50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1510,6 +1510,12 @@ dependencies = [ "syn 2.0.40", ] +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + [[package]] name = "digest" version = "0.10.7" @@ -2540,6 +2546,7 @@ dependencies = [ "lemmy_db_views_actor", "lemmy_db_views_moderator", "lemmy_utils", + "pretty_assertions", "serial_test", "sitemap-rs", "tokio", @@ -2568,6 +2575,7 @@ dependencies = [ "lemmy_utils", "once_cell", "percent-encoding", + "pretty_assertions", "regex", "reqwest", "reqwest-middleware", @@ -2629,6 +2637,7 @@ dependencies = [ "lemmy_utils", "moka", "once_cell", + "pretty_assertions", "reqwest", "reqwest-middleware", "serde", @@ -2662,6 +2671,7 @@ dependencies = [ "futures-util", "lemmy_utils", "once_cell", + "pretty_assertions", "regex", "rustls 0.21.10", "serde", @@ -2691,6 +2701,7 @@ dependencies = [ "diesel_ltree", "lemmy_db_schema", "lemmy_utils", + "pretty_assertions", "serde", "serde_with", "serial_test", @@ -2707,6 +2718,7 @@ dependencies = [ "diesel", "diesel-async", "lemmy_db_schema", + "pretty_assertions", "serde", "serde_with", "serial_test", @@ -2801,6 +2813,7 @@ dependencies = [ "opentelemetry 0.19.0", "opentelemetry-otlp 0.12.0", "pict-rs", + "pretty_assertions", "prometheus", "reqwest", "reqwest-middleware", @@ -2836,6 +2849,7 @@ dependencies = [ "once_cell", "openssl", "percent-encoding", + "pretty_assertions", "regex", "reqwest", "reqwest-middleware", @@ -3942,6 +3956,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "pretty_assertions" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +dependencies = [ + "diff", + "yansi", +] + [[package]] name = "proc-macro2" version = "1.0.70" @@ -6443,6 +6467,12 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + [[package]] name = "zerocopy" version = "0.7.30" diff --git a/Cargo.toml b/Cargo.toml index a2cb87ff9..53e673540 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -156,6 +156,7 @@ tokio-postgres = "0.7.10" tokio-postgres-rustls = "0.10.0" enum-map = "2.7" moka = { version = "0.12.1", features = ["future"] } +pretty_assertions = "1.4.0" [dependencies] lemmy_api = { workspace = true } @@ -194,3 +195,6 @@ prometheus = { version = "0.13.3", features = ["process"] } serial_test = { workspace = true } clap = { version = "4.4.11", features = ["derive"] } actix-web-prom = "0.7.0" + +[dev-dependencies] +pretty_assertions = { workspace = true } diff --git a/crates/api/Cargo.toml b/crates/api/Cargo.toml index f22c9192a..2f39166c7 100644 --- a/crates/api/Cargo.toml +++ b/crates/api/Cargo.toml @@ -42,3 +42,4 @@ actix-web-httpauth = "0.8.1" serial_test = { workspace = true } tokio = { workspace = true } elementtree = "1.2.3" +pretty_assertions = { workspace = true } diff --git a/crates/api/src/sitemap.rs b/crates/api/src/sitemap.rs index b1b961350..ec32f837f 100644 --- a/crates/api/src/sitemap.rs +++ b/crates/api/src/sitemap.rs @@ -49,6 +49,7 @@ pub(crate) mod tests { use chrono::{DateTime, NaiveDate, Utc}; use elementtree::Element; use lemmy_db_schema::newtypes::DbUrl; + use pretty_assertions::assert_eq; use url::Url; #[tokio::test] diff --git a/crates/api_common/Cargo.toml b/crates/api_common/Cargo.toml index 1d310e749..0e1ea6fb4 100644 --- a/crates/api_common/Cargo.toml +++ b/crates/api_common/Cargo.toml @@ -77,3 +77,4 @@ ignored = ["getrandom"] [dev-dependencies] serial_test = { workspace = true } reqwest-middleware = { workspace = true } +pretty_assertions = { workspace = true } diff --git a/crates/api_common/src/claims.rs b/crates/api_common/src/claims.rs index 4e55f44aa..58541af43 100644 --- a/crates/api_common/src/claims.rs +++ b/crates/api_common/src/claims.rs @@ -88,6 +88,7 @@ mod tests { utils::build_db_pool_for_tests, }; use lemmy_utils::rate_limit::RateLimitCell; + use pretty_assertions::assert_eq; use reqwest::Client; use reqwest_middleware::ClientBuilder; use serial_test::serial; diff --git a/crates/api_common/src/request.rs b/crates/api_common/src/request.rs index e4de2e751..741efee38 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_common/src/request.rs @@ -309,6 +309,7 @@ mod tests { use crate::request::{client_builder, fetch_site_metadata, html_to_site_metadata, SiteMetadata}; use lemmy_utils::settings::SETTINGS; + use pretty_assertions::assert_eq; use url::Url; // These helped with testing diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index 0ea27f794..1f72a4fd4 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -842,6 +842,7 @@ mod tests { use crate::utils::{honeypot_check, limit_expire_time, password_length_check}; use chrono::{Days, Utc}; + use pretty_assertions::assert_eq; #[test] #[rustfmt::skip] diff --git a/crates/apub/Cargo.toml b/crates/apub/Cargo.toml index 82f9812e6..7a38074f0 100644 --- a/crates/apub/Cargo.toml +++ b/crates/apub/Cargo.toml @@ -53,3 +53,4 @@ serial_test = { workspace = true } reqwest-middleware = { workspace = true } task-local-extensions = "0.1.4" assert-json-diff = "2.0.2" +pretty_assertions = { workspace = true } diff --git a/crates/apub/src/api/user_settings_backup.rs b/crates/apub/src/api/user_settings_backup.rs index 835a793fa..6b7f2b2d6 100644 --- a/crates/apub/src/api/user_settings_backup.rs +++ b/crates/apub/src/api/user_settings_backup.rs @@ -316,6 +316,7 @@ mod tests { use lemmy_db_views::structs::LocalUserView; use lemmy_db_views_actor::structs::CommunityFollowerView; use lemmy_utils::error::{LemmyErrorType, LemmyResult}; + use pretty_assertions::assert_eq; use serial_test::serial; use std::time::Duration; use tokio::time::sleep; diff --git a/crates/apub/src/collections/community_moderators.rs b/crates/apub/src/collections/community_moderators.rs index d7f232cf8..fc4d09a02 100644 --- a/crates/apub/src/collections/community_moderators.rs +++ b/crates/apub/src/collections/community_moderators.rs @@ -123,6 +123,7 @@ mod tests { traits::Crud, }; use lemmy_utils::error::LemmyResult; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/apub/src/objects/comment.rs b/crates/apub/src/objects/comment.rs index ab98fd7b1..b32b7ba57 100644 --- a/crates/apub/src/objects/comment.rs +++ b/crates/apub/src/objects/comment.rs @@ -198,6 +198,7 @@ pub(crate) mod tests { use html2md::parse_html; use lemmy_db_schema::source::site::Site; use lemmy_utils::error::LemmyResult; + use pretty_assertions::assert_eq; use serial_test::serial; async fn prepare_comment_test( diff --git a/crates/apub/src/objects/community.rs b/crates/apub/src/objects/community.rs index e4b097622..ced4b85d7 100644 --- a/crates/apub/src/objects/community.rs +++ b/crates/apub/src/objects/community.rs @@ -224,6 +224,7 @@ pub(crate) mod tests { use activitypub_federation::fetch::collection_id::CollectionId; use lemmy_db_schema::{source::site::Site, traits::Crud}; use lemmy_utils::error::LemmyResult; + use pretty_assertions::assert_eq; use serial_test::serial; pub(crate) async fn parse_lemmy_community( diff --git a/crates/apub/src/objects/instance.rs b/crates/apub/src/objects/instance.rs index 1bd3e2945..392b86bd9 100644 --- a/crates/apub/src/objects/instance.rs +++ b/crates/apub/src/objects/instance.rs @@ -208,6 +208,7 @@ pub(crate) mod tests { use crate::{objects::tests::init_context, protocol::tests::file_to_json_object}; use lemmy_db_schema::traits::Crud; use lemmy_utils::error::LemmyResult; + use pretty_assertions::assert_eq; use serial_test::serial; pub(crate) async fn parse_lemmy_instance(context: &Data) -> LemmyResult { diff --git a/crates/apub/src/objects/person.rs b/crates/apub/src/objects/person.rs index 7386609a5..e6ce52205 100644 --- a/crates/apub/src/objects/person.rs +++ b/crates/apub/src/objects/person.rs @@ -219,6 +219,7 @@ pub(crate) mod tests { use activitypub_federation::fetch::object_id::ObjectId; use lemmy_db_schema::{source::site::Site, traits::Crud}; use lemmy_utils::error::LemmyResult; + use pretty_assertions::assert_eq; use serial_test::serial; pub(crate) async fn parse_lemmy_person( diff --git a/crates/apub/src/objects/post.rs b/crates/apub/src/objects/post.rs index 44aa8ee08..14ec8a245 100644 --- a/crates/apub/src/objects/post.rs +++ b/crates/apub/src/objects/post.rs @@ -305,6 +305,7 @@ mod tests { }; use lemmy_db_schema::source::site::Site; use lemmy_utils::error::LemmyResult; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/apub/src/objects/private_message.rs b/crates/apub/src/objects/private_message.rs index b201de2f6..6608d8616 100644 --- a/crates/apub/src/objects/private_message.rs +++ b/crates/apub/src/objects/private_message.rs @@ -153,6 +153,7 @@ mod tests { use assert_json_diff::assert_json_include; use lemmy_db_schema::source::site::Site; use lemmy_utils::error::LemmyResult; + use pretty_assertions::assert_eq; use serial_test::serial; async fn prepare_comment_test( diff --git a/crates/apub/src/protocol/collections/mod.rs b/crates/apub/src/protocol/collections/mod.rs index 7e27d7e06..0fb24349c 100644 --- a/crates/apub/src/protocol/collections/mod.rs +++ b/crates/apub/src/protocol/collections/mod.rs @@ -17,6 +17,7 @@ mod tests { tests::{test_json, test_parse_lemmy_item}, }; use lemmy_utils::error::LemmyResult; + use pretty_assertions::assert_eq; #[test] fn test_parse_lemmy_collections() -> LemmyResult<()> { diff --git a/crates/db_schema/Cargo.toml b/crates/db_schema/Cargo.toml index f3ebc0b66..377af58b9 100644 --- a/crates/db_schema/Cargo.toml +++ b/crates/db_schema/Cargo.toml @@ -79,6 +79,7 @@ uuid = { workspace = true, features = ["v4"] } [dev-dependencies] serial_test = { workspace = true } +pretty_assertions = { workspace = true } [package.metadata.cargo-machete] ignored = ["strum"] diff --git a/crates/db_schema/src/aggregates/comment_aggregates.rs b/crates/db_schema/src/aggregates/comment_aggregates.rs index 110532c5a..78ceaa0c6 100644 --- a/crates/db_schema/src/aggregates/comment_aggregates.rs +++ b/crates/db_schema/src/aggregates/comment_aggregates.rs @@ -49,6 +49,7 @@ mod tests { traits::{Crud, Likeable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/aggregates/community_aggregates.rs b/crates/db_schema/src/aggregates/community_aggregates.rs index f61a95c7d..f4202738d 100644 --- a/crates/db_schema/src/aggregates/community_aggregates.rs +++ b/crates/db_schema/src/aggregates/community_aggregates.rs @@ -47,6 +47,7 @@ mod tests { traits::{Crud, Followable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/aggregates/person_aggregates.rs b/crates/db_schema/src/aggregates/person_aggregates.rs index d3065daf3..b48b37641 100644 --- a/crates/db_schema/src/aggregates/person_aggregates.rs +++ b/crates/db_schema/src/aggregates/person_aggregates.rs @@ -34,6 +34,7 @@ mod tests { traits::{Crud, Likeable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/aggregates/post_aggregates.rs b/crates/db_schema/src/aggregates/post_aggregates.rs index a8efe9581..9415f8971 100644 --- a/crates/db_schema/src/aggregates/post_aggregates.rs +++ b/crates/db_schema/src/aggregates/post_aggregates.rs @@ -68,6 +68,7 @@ mod tests { traits::{Crud, Likeable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/aggregates/site_aggregates.rs b/crates/db_schema/src/aggregates/site_aggregates.rs index 4fe57720a..453430841 100644 --- a/crates/db_schema/src/aggregates/site_aggregates.rs +++ b/crates/db_schema/src/aggregates/site_aggregates.rs @@ -31,6 +31,7 @@ mod tests { traits::Crud, utils::{build_db_pool_for_tests, DbPool}, }; + use pretty_assertions::assert_eq; use serial_test::serial; async fn prepare_site_with_community( diff --git a/crates/db_schema/src/impls/activity.rs b/crates/db_schema/src/impls/activity.rs index fe1a521a9..bb17c83e7 100644 --- a/crates/db_schema/src/impls/activity.rs +++ b/crates/db_schema/src/impls/activity.rs @@ -67,6 +67,7 @@ mod tests { use super::*; use crate::{source::activity::ActorType, utils::build_db_pool_for_tests}; + use pretty_assertions::assert_eq; use serde_json::json; use serial_test::serial; use url::Url; diff --git a/crates/db_schema/src/impls/actor_language.rs b/crates/db_schema/src/impls/actor_language.rs index 5c4e252d4..08ebcbd05 100644 --- a/crates/db_schema/src/impls/actor_language.rs +++ b/crates/db_schema/src/impls/actor_language.rs @@ -412,6 +412,7 @@ mod tests { traits::Crud, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; async fn test_langs1(pool: &mut DbPool<'_>) -> Vec { diff --git a/crates/db_schema/src/impls/comment.rs b/crates/db_schema/src/impls/comment.rs index 7173b79d2..c8a389475 100644 --- a/crates/db_schema/src/impls/comment.rs +++ b/crates/db_schema/src/impls/comment.rs @@ -263,6 +263,7 @@ mod tests { utils::build_db_pool_for_tests, }; use diesel_ltree::Ltree; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/impls/comment_reply.rs b/crates/db_schema/src/impls/comment_reply.rs index c5b5a3c6a..d76b46b8a 100644 --- a/crates/db_schema/src/impls/comment_reply.rs +++ b/crates/db_schema/src/impls/comment_reply.rs @@ -89,6 +89,7 @@ mod tests { traits::Crud, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/impls/community.rs b/crates/db_schema/src/impls/community.rs index 0d2cc88ba..80b9e2496 100644 --- a/crates/db_schema/src/impls/community.rs +++ b/crates/db_schema/src/impls/community.rs @@ -366,6 +366,7 @@ mod tests { traits::{Bannable, Crud, Followable, Joinable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/impls/federation_allowlist.rs b/crates/db_schema/src/impls/federation_allowlist.rs index eb67acce8..0664a8a4f 100644 --- a/crates/db_schema/src/impls/federation_allowlist.rs +++ b/crates/db_schema/src/impls/federation_allowlist.rs @@ -56,6 +56,7 @@ mod tests { source::{federation_allowlist::FederationAllowList, instance::Instance}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/impls/language.rs b/crates/db_schema/src/impls/language.rs index db72b837f..66fc05729 100644 --- a/crates/db_schema/src/impls/language.rs +++ b/crates/db_schema/src/impls/language.rs @@ -46,6 +46,7 @@ mod tests { #![allow(clippy::indexing_slicing)] use crate::{source::language::Language, utils::build_db_pool_for_tests}; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/impls/moderator.rs b/crates/db_schema/src/impls/moderator.rs index 012e05394..cfb64d883 100644 --- a/crates/db_schema/src/impls/moderator.rs +++ b/crates/db_schema/src/impls/moderator.rs @@ -500,6 +500,7 @@ mod tests { traits::Crud, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/impls/password_reset_request.rs b/crates/db_schema/src/impls/password_reset_request.rs index 5600ffc66..6fcf86014 100644 --- a/crates/db_schema/src/impls/password_reset_request.rs +++ b/crates/db_schema/src/impls/password_reset_request.rs @@ -95,6 +95,7 @@ mod tests { traits::Crud, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/impls/person.rs b/crates/db_schema/src/impls/person.rs index e36e7b35e..32ce6c97a 100644 --- a/crates/db_schema/src/impls/person.rs +++ b/crates/db_schema/src/impls/person.rs @@ -191,6 +191,7 @@ mod tests { traits::{Crud, Followable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/impls/person_mention.rs b/crates/db_schema/src/impls/person_mention.rs index f2441f00c..75950e7e9 100644 --- a/crates/db_schema/src/impls/person_mention.rs +++ b/crates/db_schema/src/impls/person_mention.rs @@ -90,6 +90,7 @@ mod tests { traits::Crud, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/impls/post.rs b/crates/db_schema/src/impls/post.rs index 4f2f88cb2..daa5e71dc 100644 --- a/crates/db_schema/src/impls/post.rs +++ b/crates/db_schema/src/impls/post.rs @@ -366,6 +366,7 @@ mod tests { traits::{Crud, Likeable, Saveable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; use std::collections::HashSet; diff --git a/crates/db_schema/src/impls/post_report.rs b/crates/db_schema/src/impls/post_report.rs index b4078d950..b0071f965 100644 --- a/crates/db_schema/src/impls/post_report.rs +++ b/crates/db_schema/src/impls/post_report.rs @@ -75,6 +75,7 @@ mod tests { traits::Crud, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; async fn init(pool: &mut DbPool<'_>) -> (Person, PostReport) { diff --git a/crates/db_schema/src/impls/private_message.rs b/crates/db_schema/src/impls/private_message.rs index 81a4b1850..961e36518 100644 --- a/crates/db_schema/src/impls/private_message.rs +++ b/crates/db_schema/src/impls/private_message.rs @@ -87,6 +87,7 @@ mod tests { traits::Crud, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_schema/src/utils.rs b/crates/db_schema/src/utils.rs index 2b1179bee..cb3d5d1ea 100644 --- a/crates/db_schema/src/utils.rs +++ b/crates/db_schema/src/utils.rs @@ -468,6 +468,7 @@ mod tests { use super::{fuzzy_search, *}; use crate::utils::is_email_regex; + use pretty_assertions::assert_eq; #[test] fn test_fuzzy_search() { diff --git a/crates/db_views/Cargo.toml b/crates/db_views/Cargo.toml index 5c8fd21eb..e5bebed36 100644 --- a/crates/db_views/Cargo.toml +++ b/crates/db_views/Cargo.toml @@ -42,3 +42,4 @@ actix-web = { workspace = true, optional = true } serial_test = { workspace = true } tokio = { workspace = true } chrono = { workspace = true } +pretty_assertions = { workspace = true } diff --git a/crates/db_views/src/comment_report_view.rs b/crates/db_views/src/comment_report_view.rs index a26b984b2..83ab5c063 100644 --- a/crates/db_views/src/comment_report_view.rs +++ b/crates/db_views/src/comment_report_view.rs @@ -234,6 +234,7 @@ mod tests { traits::{Crud, Joinable, Reportable}, utils::{build_db_pool_for_tests, RANK_DEFAULT}, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 9e87d902e..eb57a5e48 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -416,6 +416,7 @@ mod tests { utils::{build_db_pool_for_tests, RANK_DEFAULT}, SubscribedType, }; + use pretty_assertions::assert_eq; use serial_test::serial; struct Data { diff --git a/crates/db_views/src/post_report_view.rs b/crates/db_views/src/post_report_view.rs index 843b1ee54..00918970d 100644 --- a/crates/db_views/src/post_report_view.rs +++ b/crates/db_views/src/post_report_view.rs @@ -208,6 +208,7 @@ mod tests { traits::{Crud, Joinable, Reportable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index 857e7f644..ab1d87b67 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -749,6 +749,7 @@ mod tests { SortType, SubscribedType, }; + use pretty_assertions::{assert_eq, assert_ne}; use serial_test::serial; use std::{collections::HashSet, time::Duration}; diff --git a/crates/db_views/src/private_message_report_view.rs b/crates/db_views/src/private_message_report_view.rs index 134efc05b..712e53eb9 100644 --- a/crates/db_views/src/private_message_report_view.rs +++ b/crates/db_views/src/private_message_report_view.rs @@ -121,6 +121,7 @@ mod tests { traits::{Crud, Reportable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_views/src/private_message_view.rs b/crates/db_views/src/private_message_view.rs index 26d97038c..6aa87f670 100644 --- a/crates/db_views/src/private_message_view.rs +++ b/crates/db_views/src/private_message_view.rs @@ -168,6 +168,7 @@ mod tests { traits::{Blockable, Crud}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_views/src/registration_application_view.rs b/crates/db_views/src/registration_application_view.rs index 9a298eb77..a59158318 100644 --- a/crates/db_views/src/registration_application_view.rs +++ b/crates/db_views/src/registration_application_view.rs @@ -149,6 +149,7 @@ mod tests { traits::Crud, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_views/src/vote_view.rs b/crates/db_views/src/vote_view.rs index e8f5429e4..723c188f5 100644 --- a/crates/db_views/src/vote_view.rs +++ b/crates/db_views/src/vote_view.rs @@ -66,6 +66,7 @@ mod tests { traits::{Crud, Likeable}, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; #[tokio::test] diff --git a/crates/db_views_actor/Cargo.toml b/crates/db_views_actor/Cargo.toml index 347b25671..066b6bfd3 100644 --- a/crates/db_views_actor/Cargo.toml +++ b/crates/db_views_actor/Cargo.toml @@ -38,6 +38,7 @@ strum_macros = { workspace = true } [dev-dependencies] serial_test = { workspace = true } tokio = { workspace = true } +pretty_assertions = { workspace = true } [package.metadata.cargo-machete] ignored = ["strum"] diff --git a/crates/db_views_actor/src/person_view.rs b/crates/db_views_actor/src/person_view.rs index 16e9b3bc6..2fff7cc76 100644 --- a/crates/db_views_actor/src/person_view.rs +++ b/crates/db_views_actor/src/person_view.rs @@ -167,6 +167,7 @@ mod tests { traits::Crud, utils::build_db_pool_for_tests, }; + use pretty_assertions::assert_eq; use serial_test::serial; struct Data { diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index 1e697e77c..b6120026e 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -52,6 +52,7 @@ enum-map = { workspace = true } [dev-dependencies] reqwest = { workspace = true } +pretty_assertions = { workspace = true } [build-dependencies] rosetta-build = { version = "0.1.3", default-features = false } diff --git a/crates/utils/src/error.rs b/crates/utils/src/error.rs index 7d84dcbf6..2d19e85b5 100644 --- a/crates/utils/src/error.rs +++ b/crates/utils/src/error.rs @@ -279,6 +279,7 @@ mod tests { #![allow(clippy::indexing_slicing)] use super::*; use actix_web::{body::MessageBody, ResponseError}; + use pretty_assertions::assert_eq; use std::fs::read_to_string; use strum::IntoEnumIterator; diff --git a/crates/utils/src/rate_limit/rate_limiter.rs b/crates/utils/src/rate_limit/rate_limiter.rs index d0dad5df2..93ef1beec 100644 --- a/crates/utils/src/rate_limit/rate_limiter.rs +++ b/crates/utils/src/rate_limit/rate_limiter.rs @@ -310,6 +310,7 @@ mod tests { #![allow(clippy::indexing_slicing)] use super::{ActionType, BucketConfig, InstantSecs, RateLimitState, RateLimitedGroup}; + use pretty_assertions::assert_eq; #[test] fn test_split_ipv6() { diff --git a/crates/utils/src/response.rs b/crates/utils/src/response.rs index b521c0963..82b1e70ed 100644 --- a/crates/utils/src/response.rs +++ b/crates/utils/src/response.rs @@ -46,6 +46,7 @@ mod tests { Responder, }; use http::StatusCode; + use pretty_assertions::assert_eq; #[actix_web::test] async fn test_non_error_responses_are_not_modified() { diff --git a/crates/utils/src/utils/markdown.rs b/crates/utils/src/utils/markdown.rs index a051310ca..1f2884e1f 100644 --- a/crates/utils/src/utils/markdown.rs +++ b/crates/utils/src/utils/markdown.rs @@ -36,6 +36,7 @@ mod tests { #![allow(clippy::indexing_slicing)] use super::*; + use pretty_assertions::assert_eq; #[test] fn test_basic_markdown() { diff --git a/crates/utils/src/utils/markdown/spoiler_rule.rs b/crates/utils/src/utils/markdown/spoiler_rule.rs index bae858bfd..e41ea436f 100644 --- a/crates/utils/src/utils/markdown/spoiler_rule.rs +++ b/crates/utils/src/utils/markdown/spoiler_rule.rs @@ -140,6 +140,7 @@ mod tests { use crate::utils::markdown::spoiler_rule::add; use markdown_it::MarkdownIt; + use pretty_assertions::assert_eq; #[test] fn test_spoiler_markdown() { diff --git a/crates/utils/src/utils/mention.rs b/crates/utils/src/utils/mention.rs index a2958e499..9e9ee64a2 100644 --- a/crates/utils/src/utils/mention.rs +++ b/crates/utils/src/utils/mention.rs @@ -39,6 +39,7 @@ mod test { #![allow(clippy::indexing_slicing)] use crate::utils::mention::scrape_text_for_mentions; + use pretty_assertions::assert_eq; #[test] fn test_mentions_regex() { diff --git a/crates/utils/src/utils/slurs.rs b/crates/utils/src/utils/slurs.rs index cc2d6a3e6..fba43d706 100644 --- a/crates/utils/src/utils/slurs.rs +++ b/crates/utils/src/utils/slurs.rs @@ -69,6 +69,7 @@ mod test { #![allow(clippy::indexing_slicing)] use crate::utils::slurs::{remove_slurs, slur_check, slurs_vec_to_str}; + use pretty_assertions::assert_eq; use regex::RegexBuilder; #[test] diff --git a/crates/utils/src/utils/validation.rs b/crates/utils/src/utils/validation.rs index e762ec1d3..bb4592fc5 100644 --- a/crates/utils/src/utils/validation.rs +++ b/crates/utils/src/utils/validation.rs @@ -310,6 +310,7 @@ mod tests { SITE_NAME_MAX_LENGTH, }, }; + use pretty_assertions::assert_eq; use url::Url; #[test] diff --git a/src/scheduled_tasks.rs b/src/scheduled_tasks.rs index b669836e5..05ff4b9e2 100644 --- a/src/scheduled_tasks.rs +++ b/src/scheduled_tasks.rs @@ -516,6 +516,7 @@ mod tests { #![allow(clippy::indexing_slicing)] use lemmy_routes::nodeinfo::NodeInfo; + use pretty_assertions::assert_eq; use reqwest::Client; #[tokio::test] diff --git a/src/session_middleware.rs b/src/session_middleware.rs index 429c47636..d81251453 100644 --- a/src/session_middleware.rs +++ b/src/session_middleware.rs @@ -119,6 +119,7 @@ mod tests { utils::build_db_pool_for_tests, }; use lemmy_utils::rate_limit::RateLimitCell; + use pretty_assertions::assert_eq; use reqwest::Client; use reqwest_middleware::ClientBuilder; use serial_test::serial; From 952c162dacd8d9ee8f1b593e05fcbfda3168f73c Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 4 Jan 2024 17:40:41 +0100 Subject: [PATCH 02/19] Fix CI cache (#4276) * Minor CI improvements (second attempt) * test slow check condition * remove rebuild cache condition for testing * trigger quick ci check * mkdir * ls, remove steps * exclude cargo home from prettier * ci * increase timeout * more timeout * even higher just for testing * disable compression * also increase restore timeout * cleanup * try again * Update .woodpecker.yml * Update .woodpecker.yml * cleanup * rerun ci * cleanup --- .woodpecker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1ae2df457..d65c90a3a 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -100,6 +100,9 @@ steps: region: us-east-1 cache_key: "rust-cache" path-style: true + backend_operation_timeout: 15m + compression_level: 0 + exit_code: true mount: - ".cargo_home" - "target" @@ -226,6 +229,9 @@ steps: cache_key: "rust-cache" region: us-east-1 path-style: true + backend_operation_timeout: 60m + compression_level: 0 + exit_code: true mount: - ".cargo_home" - "target" From 023c9f4fcdc4af195eabcd8f07f1d789fdaf9bb8 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 4 Jan 2024 17:42:18 +0100 Subject: [PATCH 03/19] Fix fetching of community posts (fixes #4283) (#4293) * Fix fetching of community posts (fixes #4283) Also use spawn_try_task to fetch community outbox, mods etc to avoid delay/timeout when fetching new community. * prettier * fix test * fix api test * prettier * add delay * Update run-federation-test.sh * fix test --- api_tests/src/community.spec.ts | 43 ++++++++++++++++--- api_tests/src/shared.ts | 2 + .../apub/src/collections/community_outbox.rs | 14 +++--- crates/apub/src/objects/community.rs | 30 +++++-------- 4 files changed, 59 insertions(+), 30 deletions(-) diff --git a/api_tests/src/community.spec.ts b/api_tests/src/community.spec.ts index b4a58bb7b..03c941abe 100644 --- a/api_tests/src/community.spec.ts +++ b/api_tests/src/community.spec.ts @@ -31,6 +31,7 @@ import { searchPostLocal, resolveBetaCommunity, longDelay, + delay, } from "./shared"; import { EditSite } from "lemmy-js-client"; @@ -377,7 +378,9 @@ test("User blocks instance, communities are hidden", async () => { test("Community follower count is federated", async () => { // Follow the beta community from alpha - let resolved = await resolveBetaCommunity(alpha); + let community = await createCommunity(beta); + let community_id = community.community_view.community.actor_id; + let resolved = await resolveCommunity(alpha, community_id); if (!resolved.community) { throw "Missing beta community"; } @@ -385,7 +388,7 @@ test("Community follower count is federated", async () => { await followCommunity(alpha, true, resolved.community.community.id); let followed = ( await waitUntil( - () => resolveBetaCommunity(alpha), + () => resolveCommunity(alpha, community_id), c => c.community?.subscribed === "Subscribed", ) ).community; @@ -394,7 +397,7 @@ test("Community follower count is federated", async () => { expect(followed?.counts.subscribers).toBe(1); // Follow the community from gamma - resolved = await resolveBetaCommunity(gamma); + resolved = await resolveCommunity(gamma, community_id); if (!resolved.community) { throw "Missing beta community"; } @@ -402,7 +405,7 @@ test("Community follower count is federated", async () => { await followCommunity(gamma, true, resolved.community.community.id); followed = ( await waitUntil( - () => resolveBetaCommunity(gamma), + () => resolveCommunity(gamma, community_id), c => c.community?.subscribed === "Subscribed", ) ).community; @@ -411,7 +414,7 @@ test("Community follower count is federated", async () => { expect(followed?.counts?.subscribers).toBe(2); // Follow the community from delta - resolved = await resolveBetaCommunity(delta); + resolved = await resolveCommunity(delta, community_id); if (!resolved.community) { throw "Missing beta community"; } @@ -419,7 +422,7 @@ test("Community follower count is federated", async () => { await followCommunity(delta, true, resolved.community.community.id); followed = ( await waitUntil( - () => resolveBetaCommunity(delta), + () => resolveCommunity(delta, community_id), c => c.community?.subscribed === "Subscribed", ) ).community; @@ -480,3 +483,31 @@ test("Dont receive community activities after unsubscribe", async () => { let postResBeta = searchPostLocal(beta, postRes.post_view.post); expect((await postResBeta).posts.length).toBe(0); }); + +test("Fetch community, includes posts", async () => { + let communityRes = await createCommunity(alpha); + expect(communityRes.community_view.community.name).toBeDefined(); + expect(communityRes.community_view.counts.subscribers).toBe(1); + + let postRes = await createPost( + alpha, + communityRes.community_view.community.id, + ); + expect(postRes.post_view.post).toBeDefined(); + + let resolvedCommunity = await waitUntil( + () => + resolveCommunity(beta, communityRes.community_view.community.actor_id), + c => c.community?.community.id != undefined, + ); + let betaCommunity = resolvedCommunity.community; + expect(betaCommunity?.community.actor_id).toBe( + communityRes.community_view.community.actor_id, + ); + + await longDelay(); + + let post_listing = await getPosts(beta, "All", betaCommunity?.community.id); + expect(post_listing.posts.length).toBe(1); + expect(post_listing.posts[0].post.ap_id).toBe(postRes.post_view.post.ap_id); +}); diff --git a/api_tests/src/shared.ts b/api_tests/src/shared.ts index fe51fb046..9a2d45075 100644 --- a/api_tests/src/shared.ts +++ b/api_tests/src/shared.ts @@ -805,10 +805,12 @@ export async function listCommentReports( export function getPosts( api: LemmyHttp, listingType?: ListingType, + community_id?: number, ): Promise { let form: GetPosts = { type_: listingType, limit: 50, + community_id, }; return api.getPosts(form); } diff --git a/crates/apub/src/collections/community_outbox.rs b/crates/apub/src/collections/community_outbox.rs index 854db9349..8e319403d 100644 --- a/crates/apub/src/collections/community_outbox.rs +++ b/crates/apub/src/collections/community_outbox.rs @@ -96,11 +96,15 @@ impl Collection for ApubCommunityOutbox { // process items in parallel, to avoid long delay from fetch_site_metadata() and other processing join_all(outbox_activities.into_iter().map(|activity| { async { - // use separate request counter for each item, otherwise there will be problems with - // parallel processing - let verify = activity.verify(data).await; - if verify.is_ok() { - activity.receive(data).await.ok(); + // Receiving announce requires at least one local community follower for anti spam purposes. + // This won't be the case for newly fetched communities, so we extract the inner activity + // and handle it directly to bypass this check. + let inner = activity.object.object(data).await.map(TryInto::try_into); + if let Ok(Ok(AnnouncableActivities::CreateOrUpdatePost(inner))) = inner { + let verify = inner.verify(data).await; + if verify.is_ok() { + inner.receive(data).await.ok(); + } } } })) diff --git a/crates/apub/src/objects/community.rs b/crates/apub/src/objects/community.rs index ced4b85d7..3cbf352cd 100644 --- a/crates/apub/src/objects/community.rs +++ b/crates/apub/src/objects/community.rs @@ -28,9 +28,8 @@ use lemmy_db_schema::{ traits::{ApubActor, Crud}, }; use lemmy_db_views_actor::structs::CommunityFollowerView; -use lemmy_utils::{error::LemmyError, utils::markdown::markdown_to_html}; +use lemmy_utils::{error::LemmyError, spawn_try_task, utils::markdown::markdown_to_html}; use std::ops::Deref; -use tracing::debug; use url::Url; #[derive(Clone, Debug)] @@ -142,21 +141,16 @@ impl Object for ApubCommunity { // Fetching mods and outbox is not necessary for Lemmy to work, so ignore errors. Besides, // we need to ignore these errors so that tests can work entirely offline. - let fetch_outbox = group.outbox.dereference(&community, context); - let fetch_followers = group.followers.dereference(&community, context); - - if let Some(moderators) = group.attributed_to { - let fetch_moderators = moderators.dereference(&community, context); - // Fetch mods, outbox and followers in parallel - let res = tokio::join!(fetch_outbox, fetch_moderators, fetch_followers); - res.0.map_err(|e| debug!("{}", e)).ok(); - res.1.map_err(|e| debug!("{}", e)).ok(); - res.2.map_err(|e| debug!("{}", e)).ok(); - } else { - let res = tokio::join!(fetch_outbox, fetch_followers); - res.0.map_err(|e| debug!("{}", e)).ok(); - res.1.map_err(|e| debug!("{}", e)).ok(); - } + let community_ = community.clone(); + let context_ = context.reset_request_count(); + spawn_try_task(async move { + group.outbox.dereference(&community_, &context_).await?; + group.followers.dereference(&community_, &context_).await?; + if let Some(moderators) = group.attributed_to { + moderators.dereference(&community_, &context_).await?; + } + Ok(()) + }); Ok(community) } @@ -241,8 +235,6 @@ pub(crate) mod tests { let url = Url::parse("https://enterprise.lemmy.ml/c/tenforward")?; ApubCommunity::verify(&json, &url, &context2).await?; let community = ApubCommunity::from_json(json, &context2).await?; - // this makes requests to the (intentionally broken) outbox and followers collections - assert_eq!(context2.request_count(), 2); Ok(community) } From 3cad3b211958a116e50bba82b154dd06ea916541 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 4 Jan 2024 17:44:36 +0100 Subject: [PATCH 04/19] Dont overwrite cache-control header in session middleware (#4337) --- crates/utils/translations | 2 +- src/session_middleware.rs | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/crates/utils/translations b/crates/utils/translations index 15815aea7..a36865ee8 160000 --- a/crates/utils/translations +++ b/crates/utils/translations @@ -1 +1 @@ -Subproject commit 15815aea74fe97360afc03496b3ad62588649af0 +Subproject commit a36865ee8ca3658fea31ba948b67b75a812e84fc diff --git a/src/session_middleware.rs b/src/session_middleware.rs index d81251453..ab7eb3d62 100644 --- a/src/session_middleware.rs +++ b/src/session_middleware.rs @@ -85,16 +85,19 @@ where let mut res = svc.call(req).await?; - // Add cache-control header. If user is authenticated, mark as private. Otherwise cache - // up to one minute. - let cache_value = if jwt.is_some() { - "private" - } else { - "public, max-age=60" - }; - res - .headers_mut() - .insert(CACHE_CONTROL, HeaderValue::from_static(cache_value)); + // Add cache-control header if none is present + if !res.headers().contains_key(CACHE_CONTROL) { + // If user is authenticated, mark as private. Otherwise cache + // up to one minute. + let cache_value = if jwt.is_some() { + "private" + } else { + "public, max-age=60" + }; + res + .headers_mut() + .insert(CACHE_CONTROL, HeaderValue::from_static(cache_value)); + } Ok(res) }) } From 38e64825e6f38d36787eeeb91c8256dbc950c60b Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 4 Jan 2024 17:51:55 +0100 Subject: [PATCH 05/19] Add macro assert_length!() for tests (#4348) * Add macro assert_length!() for tests * fix * number --- crates/db_schema/src/lib.rs | 9 +++++++ crates/db_views/src/comment_view.rs | 19 ++++++------- crates/db_views/src/post_report_view.rs | 3 ++- crates/db_views/src/post_view.rs | 27 ++++++++++--------- .../src/private_message_report_view.rs | 5 ++-- crates/db_views/src/private_message_view.rs | 11 ++++---- crates/db_views_actor/src/person_view.rs | 7 ++--- 7 files changed, 48 insertions(+), 33 deletions(-) diff --git a/crates/db_schema/src/lib.rs b/crates/db_schema/src/lib.rs index a53a1733c..de1069f9f 100644 --- a/crates/db_schema/src/lib.rs +++ b/crates/db_schema/src/lib.rs @@ -216,3 +216,12 @@ pub enum PostFeatureType { /// Features to the top of the community. Community, } + +/// Wrapper for assert_eq! macro. Checks that vec matches the given length, and prints the +/// vec on failure. +#[macro_export] +macro_rules! assert_length { + ($len:expr, $vec:expr) => {{ + assert_eq!($len, $vec.len(), "Vec has wrong length: {:?}", $vec) + }}; +} diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index eb57a5e48..62f6634c1 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -399,6 +399,7 @@ mod tests { }; use lemmy_db_schema::{ aggregates::structs::CommentAggregates, + assert_length, impls::actor_language::UNDETERMINED_ID, newtypes::LanguageId, source::{ @@ -637,7 +638,7 @@ mod tests { ); // Make sure its 1, not showing the blocked comment - assert_eq!(5, read_comment_views_with_person.len()); + assert_length!(5, read_comment_views_with_person); let read_comment_from_blocked_person = CommentView::read( pool, @@ -664,7 +665,7 @@ mod tests { read_liked_comment_views[0] ); - assert_eq!(1, read_liked_comment_views.len()); + assert_length!(1, read_liked_comment_views); let read_disliked_comment_views: Vec = CommentQuery { local_user: (Some(&data.timmy_local_user_view)), @@ -708,8 +709,8 @@ mod tests { .unwrap(); // Make sure the comment parent-limited fetch is correct - assert_eq!(6, read_comment_views_top_path.len()); - assert_eq!(4, read_comment_views_child_path.len()); + assert_length!(6, read_comment_views_top_path); + assert_length!(4, read_comment_views_child_path); // Make sure it contains the parent, but not the comment from the other tree let child_comments = read_comment_views_child_path @@ -733,7 +734,7 @@ mod tests { expected_comment_view(&data, pool).await, read_comment_views_top_max_depth[0] ); - assert_eq!(1, read_comment_views_top_max_depth.len()); + assert_length!(1, read_comment_views_top_max_depth); let child_path = data.inserted_comment_1.path.clone(); let read_comment_views_parent_max_depth = CommentQuery { @@ -752,7 +753,7 @@ mod tests { .comment .content .eq("Comment 3")); - assert_eq!(3, read_comment_views_parent_max_depth.len()); + assert_length!(3, read_comment_views_parent_max_depth); cleanup(data, pool).await; } @@ -773,7 +774,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(5, all_languages.len()); + assert_length!(5, all_languages); // change user lang to finnish, should only show one post in finnish and one undetermined let finnish_id = Language::read_id_from_code(pool, Some("fi")) @@ -794,7 +795,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(2, finnish_comments.len()); + assert_length!(2, finnish_comments); let finnish_comment = finnish_comments .iter() .find(|c| c.comment.language_id == finnish_id); @@ -819,7 +820,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(1, undetermined_comment.len()); + assert_length!(1, undetermined_comment); cleanup(data, pool).await; } diff --git a/crates/db_views/src/post_report_view.rs b/crates/db_views/src/post_report_view.rs index 00918970d..c503ae81a 100644 --- a/crates/db_views/src/post_report_view.rs +++ b/crates/db_views/src/post_report_view.rs @@ -196,6 +196,7 @@ mod tests { structs::LocalUserView, }; use lemmy_db_schema::{ + assert_length, source::{ community::{Community, CommunityInsertForm, CommunityModerator, CommunityModeratorForm}, instance::Instance, @@ -383,7 +384,7 @@ mod tests { .list(pool, &timmy_view) .await .unwrap(); - assert_eq!(reports_after_resolve.len(), 1); + assert_length!(1, reports_after_resolve); assert_eq!(reports_after_resolve[0].creator.id, inserted_sara.id); // Make sure the counts are correct diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index ab1d87b67..f5acc3804 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -729,6 +729,7 @@ mod tests { use chrono::Utc; use lemmy_db_schema::{ aggregates::structs::PostAggregates, + assert_length, impls::actor_language::UNDETERMINED_ID, newtypes::LanguageId, source::{ @@ -915,7 +916,7 @@ mod tests { let mut expected_post_listing_with_user = expected_post_view(&data, pool).await; // Should be only one person, IE the bot post, and blocked should be missing - assert_eq!(1, read_post_listing.len()); + assert_length!(1, read_post_listing); assert_eq!(expected_post_listing_with_user, read_post_listing[0]); expected_post_listing_with_user.my_vote = None; @@ -944,7 +945,7 @@ mod tests { .await .unwrap(); // should include bot post which has "undetermined" language - assert_eq!(2, post_listings_with_bots.len()); + assert_length!(2, post_listings_with_bots); cleanup(data, pool).await; } @@ -973,7 +974,7 @@ mod tests { let expected_post_listing_no_person = expected_post_view(&data, pool).await; // Should be 2 posts, with the bot post, and the blocked - assert_eq!(3, read_post_listing_multiple_no_person.len()); + assert_length!(3, read_post_listing_multiple_no_person); assert_eq!( expected_post_listing_no_person, @@ -1010,7 +1011,7 @@ mod tests { .await .unwrap(); // Should be 0 posts after the community block - assert_eq!(0, read_post_listings_with_person_after_block.len()); + assert_length!(0, read_post_listings_with_person_after_block); CommunityBlock::unblock(pool, &community_block) .await @@ -1075,7 +1076,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(1, read_post_listing.len()); + assert_length!(1, read_post_listing); assert_eq!(expected_post_with_upvote, read_post_listing[0]); @@ -1200,7 +1201,7 @@ mod tests { .unwrap(); // no language filters specified, all posts should be returned - assert_eq!(3, post_listings_all.len()); + assert_length!(3, post_listings_all); let french_id = Language::read_id_from_code(pool, Some("fr")) .await @@ -1220,7 +1221,7 @@ mod tests { .unwrap(); // only one post in french and one undetermined should be returned - assert_eq!(2, post_listing_french.len()); + assert_length!(2, post_listing_french); assert!(post_listing_french .iter() .any(|p| p.post.language_id == french_id)); @@ -1242,7 +1243,7 @@ mod tests { .unwrap(); // french post and undetermined language post should be returned - assert_eq!(2, post_listings_french_und.len()); + assert_length!(2, post_listings_french_und); assert_eq!( UNDETERMINED_ID, post_listings_french_und[0].post.language_id @@ -1280,7 +1281,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(1, post_listings_no_admin.len()); + assert_length!(1, post_listings_no_admin); // Removed bot post is shown to admins on its profile page data.local_user_view.local_user.admin = true; @@ -1379,7 +1380,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(post_listings_all.len(), 3); + assert_length!(3, post_listings_all); // block the instance let block_form = InstanceBlockForm { @@ -1396,7 +1397,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(post_listings_blocked.len(), 2); + assert_length!(2, post_listings_blocked); assert_ne!( post_listings_blocked[0].post.id, post_from_blocked_instance.id @@ -1415,7 +1416,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(post_listings_blocked.len(), 3); + assert_length!(3, post_listings_blocked); Instance::delete(pool, blocked_instance.id).await.unwrap(); cleanup(data, pool).await; @@ -1535,7 +1536,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(1, post_listings_hide_read.len()); + assert_length!(1, post_listings_hide_read); cleanup(data, pool).await; } diff --git a/crates/db_views/src/private_message_report_view.rs b/crates/db_views/src/private_message_report_view.rs index 712e53eb9..2c6919542 100644 --- a/crates/db_views/src/private_message_report_view.rs +++ b/crates/db_views/src/private_message_report_view.rs @@ -112,6 +112,7 @@ mod tests { use crate::private_message_report_view::PrivateMessageReportQuery; use lemmy_db_schema::{ + assert_length, source::{ instance::Instance, person::{Person, PersonInsertForm}, @@ -171,7 +172,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(1, reports.len()); + assert_length!(1, reports); assert!(!reports[0].private_message_report.resolved); assert_eq!(inserted_timmy.name, reports[0].private_message_creator.name); assert_eq!(inserted_jessica.name, reports[0].creator.name); @@ -197,7 +198,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(1, reports.len()); + assert_length!(1, reports); assert!(reports[0].private_message_report.resolved); assert!(reports[0].resolver.is_some()); assert_eq!( diff --git a/crates/db_views/src/private_message_view.rs b/crates/db_views/src/private_message_view.rs index 6aa87f670..d04ff7b49 100644 --- a/crates/db_views/src/private_message_view.rs +++ b/crates/db_views/src/private_message_view.rs @@ -159,6 +159,7 @@ mod tests { use crate::{private_message_view::PrivateMessageQuery, structs::PrivateMessageView}; use lemmy_db_schema::{ + assert_length, source::{ instance::Instance, person::{Person, PersonInsertForm}, @@ -251,7 +252,7 @@ mod tests { .await .unwrap(); - assert_eq!(timmy_messages.len(), 3); + assert_length!(3, &timmy_messages); assert_eq!(timmy_messages[0].creator.id, jess.id); assert_eq!(timmy_messages[0].recipient.id, timmy.id); assert_eq!(timmy_messages[1].creator.id, timmy.id); @@ -268,7 +269,7 @@ mod tests { .await .unwrap(); - assert_eq!(timmy_unread_messages.len(), 2); + assert_length!(2, &timmy_unread_messages); assert_eq!(timmy_unread_messages[0].creator.id, jess.id); assert_eq!(timmy_unread_messages[0].recipient.id, timmy.id); assert_eq!(timmy_unread_messages[1].creator.id, sara.id); @@ -283,7 +284,7 @@ mod tests { .await .unwrap(); - assert_eq!(timmy_sara_messages.len(), 2); + assert_length!(2, &timmy_sara_messages); assert_eq!(timmy_sara_messages[0].creator.id, timmy.id); assert_eq!(timmy_sara_messages[0].recipient.id, sara.id); assert_eq!(timmy_sara_messages[1].creator.id, sara.id); @@ -298,7 +299,7 @@ mod tests { .await .unwrap(); - assert_eq!(timmy_sara_unread_messages.len(), 1); + assert_length!(1, &timmy_sara_unread_messages); assert_eq!(timmy_sara_unread_messages[0].creator.id, sara.id); assert_eq!(timmy_sara_unread_messages[0].recipient.id, timmy.id); @@ -328,7 +329,7 @@ mod tests { .await .unwrap(); - assert_eq!(timmy_messages.len(), 1); + assert_length!(1, &timmy_messages); let timmy_unread_messages = PrivateMessageView::get_unread_messages(pool, timmy.id) .await diff --git a/crates/db_views_actor/src/person_view.rs b/crates/db_views_actor/src/person_view.rs index 2fff7cc76..08ad2880f 100644 --- a/crates/db_views_actor/src/person_view.rs +++ b/crates/db_views_actor/src/person_view.rs @@ -159,6 +159,7 @@ mod tests { use super::*; use diesel::NotFound; use lemmy_db_schema::{ + assert_length, source::{ instance::Instance, local_user::{LocalUser, LocalUserInsertForm, LocalUserUpdateForm}, @@ -257,7 +258,7 @@ mod tests { .list(pool) .await .unwrap(); - assert_eq!(list.len(), 1); + assert_length!(1, list); assert_eq!(list[0].person.id, data.bob.id); cleanup(data, pool).await; @@ -282,7 +283,7 @@ mod tests { .unwrap(); let list = PersonView::banned(pool).await.unwrap(); - assert_eq!(list.len(), 1); + assert_length!(1, list); assert_eq!(list[0].person.id, data.alice.id); cleanup(data, pool).await; @@ -307,7 +308,7 @@ mod tests { .unwrap(); let list = PersonView::admins(pool).await.unwrap(); - assert_eq!(list.len(), 1); + assert_length!(1, list); assert_eq!(list[0].person.id, data.alice.id); let is_admin = PersonView::read(pool, data.alice.id) From 7d9b59c4675fb0a5c3825daeae635549edfcb2fe Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 4 Jan 2024 18:16:51 +0100 Subject: [PATCH 06/19] Reduce default db pool size to 30, remove db timeout (ref #4282) (#4301) * Reduce default db pool size to 30 (ref #4282) * remove db timeout --- config/defaults.hjson | 2 +- crates/db_schema/src/utils.rs | 6 +----- crates/utils/src/settings/structs.rs | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/config/defaults.hjson b/config/defaults.hjson index 880af802c..b1c6d9ba5 100644 --- a/config/defaults.hjson +++ b/config/defaults.hjson @@ -34,7 +34,7 @@ # Name of the postgres database for lemmy database: "string" # Maximum number of active sql connections - pool_size: 95 + pool_size: 30 } # Settings related to activitypub federation # Pictrs image server configuration. diff --git a/crates/db_schema/src/utils.rs b/crates/db_schema/src/utils.rs index cb3d5d1ea..d7af17544 100644 --- a/crates/db_schema/src/utils.rs +++ b/crates/db_schema/src/utils.rs @@ -42,7 +42,7 @@ use rustls::{ use std::{ ops::{Deref, DerefMut}, sync::Arc, - time::{Duration, SystemTime}, + time::SystemTime, }; use tracing::{error, info}; use url::Url; @@ -51,7 +51,6 @@ const FETCH_LIMIT_DEFAULT: i64 = 10; pub const FETCH_LIMIT_MAX: i64 = 50; pub const SITEMAP_LIMIT: i64 = 50000; pub const SITEMAP_DAYS: i64 = 31; -const POOL_TIMEOUT: Option = Some(Duration::from_secs(5)); pub const RANK_DEFAULT: f64 = 0.0001; pub type ActualDbPool = Pool; @@ -302,9 +301,6 @@ pub async fn build_db_pool() -> Result { }; let pool = Pool::builder(manager) .max_size(SETTINGS.database.pool_size) - .wait_timeout(POOL_TIMEOUT) - .create_timeout(POOL_TIMEOUT) - .recycle_timeout(POOL_TIMEOUT) .runtime(Runtime::Tokio1) .build()?; diff --git a/crates/utils/src/settings/structs.rs b/crates/utils/src/settings/structs.rs index 886cd71b6..c4ff315ae 100644 --- a/crates/utils/src/settings/structs.rs +++ b/crates/utils/src/settings/structs.rs @@ -102,7 +102,7 @@ pub struct DatabaseConfig { pub(crate) connection: DatabaseConnection, /// Maximum number of active sql connections - #[default(95)] + #[default(30)] pub pool_size: usize, } From 4a740ee80afe47306b32935af31e673a72904d27 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 20 Dec 2023 09:28:14 -0500 Subject: [PATCH 07/19] Version 0.19.1 --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 24 ++++++++++++------------ docker/docker-compose.yml | 4 ++-- docker/federation/docker-compose.yml | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5a490b50..726330dc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2529,7 +2529,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lemmy_api" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2558,7 +2558,7 @@ dependencies = [ [[package]] name = "lemmy_api_common" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2593,7 +2593,7 @@ dependencies = [ [[package]] name = "lemmy_api_crud" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2615,7 +2615,7 @@ dependencies = [ [[package]] name = "lemmy_apub" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2655,7 +2655,7 @@ dependencies = [ [[package]] name = "lemmy_db_schema" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "activitypub_federation", "async-trait", @@ -2692,7 +2692,7 @@ dependencies = [ [[package]] name = "lemmy_db_views" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "actix-web", "chrono", @@ -2712,7 +2712,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_actor" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "chrono", "diesel", @@ -2730,7 +2730,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_moderator" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "diesel", "diesel-async", @@ -2742,7 +2742,7 @@ dependencies = [ [[package]] name = "lemmy_federate" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "activitypub_federation", "anyhow", @@ -2765,7 +2765,7 @@ dependencies = [ [[package]] name = "lemmy_routes" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2789,7 +2789,7 @@ dependencies = [ [[package]] name = "lemmy_server" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "activitypub_federation", "actix-cors", @@ -2832,7 +2832,7 @@ dependencies = [ [[package]] name = "lemmy_utils" -version = "0.19.1-rc.2" +version = "0.19.1" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 53e673540..f3428bafb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.19.1-rc.2" +version = "0.19.1" publish = false edition = "2021" description = "A link aggregator for the fediverse" @@ -85,16 +85,16 @@ unused_self = "deny" unwrap_used = "deny" [workspace.dependencies] -lemmy_api = { version = "=0.19.1-rc.2", path = "./crates/api" } -lemmy_api_crud = { version = "=0.19.1-rc.2", path = "./crates/api_crud" } -lemmy_apub = { version = "=0.19.1-rc.2", path = "./crates/apub" } -lemmy_utils = { version = "=0.19.1-rc.2", path = "./crates/utils" } -lemmy_db_schema = { version = "=0.19.1-rc.2", path = "./crates/db_schema" } -lemmy_api_common = { version = "=0.19.1-rc.2", path = "./crates/api_common" } -lemmy_routes = { version = "=0.19.1-rc.2", path = "./crates/routes" } -lemmy_db_views = { version = "=0.19.1-rc.2", path = "./crates/db_views" } -lemmy_db_views_actor = { version = "=0.19.1-rc.2", path = "./crates/db_views_actor" } -lemmy_db_views_moderator = { version = "=0.19.1-rc.2", path = "./crates/db_views_moderator" } +lemmy_api = { version = "=0.19.1", path = "./crates/api" } +lemmy_api_crud = { version = "=0.19.1", path = "./crates/api_crud" } +lemmy_apub = { version = "=0.19.1", path = "./crates/apub" } +lemmy_utils = { version = "=0.19.1", path = "./crates/utils" } +lemmy_db_schema = { version = "=0.19.1", path = "./crates/db_schema" } +lemmy_api_common = { version = "=0.19.1", path = "./crates/api_common" } +lemmy_routes = { version = "=0.19.1", path = "./crates/routes" } +lemmy_db_views = { version = "=0.19.1", path = "./crates/db_views" } +lemmy_db_views_actor = { version = "=0.19.1", path = "./crates/db_views_actor" } +lemmy_db_views_moderator = { version = "=0.19.1", path = "./crates/db_views_moderator" } activitypub_federation = { version = "0.5.0-beta.6", default-features = false, features = [ "actix-web", ] } @@ -166,7 +166,7 @@ lemmy_utils = { workspace = true } lemmy_db_schema = { workspace = true } lemmy_api_common = { workspace = true } lemmy_routes = { workspace = true } -lemmy_federate = { version = "0.19.1-rc.2", path = "crates/federate" } +lemmy_federate = { version = "0.19.1", path = "crates/federate" } activitypub_federation = { workspace = true } diesel = { workspace = true } diesel-async = { workspace = true } diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index eb81766cc..36b5e5500 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -25,7 +25,7 @@ services: lemmy: # use "image" to pull down an already compiled lemmy. make sure to comment out "build". - # image: dessalines/lemmy:0.19.0 + # image: dessalines/lemmy:0.19.1 # platform: linux/x86_64 # no arm64 support. uncomment platform if using m1. # use "build" to build your local lemmy server image for development. make sure to comment out "image". # run: docker compose up --build @@ -55,7 +55,7 @@ services: lemmy-ui: # use "image" to pull down an already compiled lemmy-ui. make sure to comment out "build". - image: dessalines/lemmy-ui:0.19.0 + image: dessalines/lemmy-ui:0.19.1 # platform: linux/x86_64 # no arm64 support. uncomment platform if using m1. # use "build" to build your local lemmy ui image for development. make sure to comment out "image". # run: docker compose up --build diff --git a/docker/federation/docker-compose.yml b/docker/federation/docker-compose.yml index a8c6160df..faef2675f 100644 --- a/docker/federation/docker-compose.yml +++ b/docker/federation/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" x-ui-default: &ui-default init: true - image: dessalines/lemmy-ui:0.19.0 + image: dessalines/lemmy-ui:0.19.1 # assuming lemmy-ui is cloned besides lemmy directory # build: # context: ../../../lemmy-ui From 0e6669f6170c4e244b9b3b951d12c1155a6f9be0 Mon Sep 17 00:00:00 2001 From: phiresky Date: Thu, 4 Jan 2024 19:28:26 +0100 Subject: [PATCH 08/19] no endless loop if queue too recent (#4349) --- crates/federate/src/worker.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index 6dff325b6..e9e5fb708 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -152,7 +152,15 @@ impl InstanceWorker { self.save_and_send_state(pool).await?; latest_id }; - if id == latest_id { + if id >= latest_id { + if id > latest_id { + tracing::error!( + "{}: last successful id {} is higher than latest id {} in database (did the db get cleared?)", + self.instance.domain, + id.0, + latest_id.0 + ); + } // no more work to be done, wait before rechecking tokio::select! { () = sleep(*WORK_FINISHED_RECHECK_DELAY) => {}, From 1856e7c0cac02641d7969b98381519091531b6d9 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 5 Jan 2024 04:43:30 -0500 Subject: [PATCH 09/19] Increasing max items for user settings import. (#4352) - Fixes #4307 --- crates/apub/src/api/user_settings_backup.rs | 2 +- crates/utils/src/error.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/apub/src/api/user_settings_backup.rs b/crates/apub/src/api/user_settings_backup.rs index 6b7f2b2d6..bbc71b52a 100644 --- a/crates/apub/src/api/user_settings_backup.rs +++ b/crates/apub/src/api/user_settings_backup.rs @@ -404,7 +404,7 @@ mod tests { let mut backup = export_settings(export_user.clone(), context.reset_request_count()).await?; - for _ in 0..251 { + for _ in 0..2501 { backup .followed_communities .push("http://example.com".parse()?); diff --git a/crates/utils/src/error.rs b/crates/utils/src/error.rs index 2d19e85b5..d05b8c3a7 100644 --- a/crates/utils/src/error.rs +++ b/crates/utils/src/error.rs @@ -16,7 +16,7 @@ pub struct LemmyError { } /// Maximum number of items in an array passed as API parameter. See [[LemmyErrorType::TooManyItems]] -pub const MAX_API_PARAM_ELEMENTS: usize = 1000; +pub const MAX_API_PARAM_ELEMENTS: usize = 10_000; impl From for LemmyError where From d3efebfa4e472c6b005b727dc67eafb1ca7351f7 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 5 Jan 2024 11:33:37 +0100 Subject: [PATCH 10/19] Version 0.19.2-rc.1 --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 24 ++++++++++++------------ crates/utils/translations | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 726330dc2..fa81eb04f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2529,7 +2529,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lemmy_api" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2558,7 +2558,7 @@ dependencies = [ [[package]] name = "lemmy_api_common" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2593,7 +2593,7 @@ dependencies = [ [[package]] name = "lemmy_api_crud" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2615,7 +2615,7 @@ dependencies = [ [[package]] name = "lemmy_apub" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2655,7 +2655,7 @@ dependencies = [ [[package]] name = "lemmy_db_schema" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "activitypub_federation", "async-trait", @@ -2692,7 +2692,7 @@ dependencies = [ [[package]] name = "lemmy_db_views" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "actix-web", "chrono", @@ -2712,7 +2712,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_actor" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "chrono", "diesel", @@ -2730,7 +2730,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_moderator" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "diesel", "diesel-async", @@ -2742,7 +2742,7 @@ dependencies = [ [[package]] name = "lemmy_federate" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "activitypub_federation", "anyhow", @@ -2765,7 +2765,7 @@ dependencies = [ [[package]] name = "lemmy_routes" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "activitypub_federation", "actix-web", @@ -2789,7 +2789,7 @@ dependencies = [ [[package]] name = "lemmy_server" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "activitypub_federation", "actix-cors", @@ -2832,7 +2832,7 @@ dependencies = [ [[package]] name = "lemmy_utils" -version = "0.19.1" +version = "0.19.2-rc.1" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index f3428bafb..43ee5bbed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.19.1" +version = "0.19.2-rc.1" publish = false edition = "2021" description = "A link aggregator for the fediverse" @@ -85,16 +85,16 @@ unused_self = "deny" unwrap_used = "deny" [workspace.dependencies] -lemmy_api = { version = "=0.19.1", path = "./crates/api" } -lemmy_api_crud = { version = "=0.19.1", path = "./crates/api_crud" } -lemmy_apub = { version = "=0.19.1", path = "./crates/apub" } -lemmy_utils = { version = "=0.19.1", path = "./crates/utils" } -lemmy_db_schema = { version = "=0.19.1", path = "./crates/db_schema" } -lemmy_api_common = { version = "=0.19.1", path = "./crates/api_common" } -lemmy_routes = { version = "=0.19.1", path = "./crates/routes" } -lemmy_db_views = { version = "=0.19.1", path = "./crates/db_views" } -lemmy_db_views_actor = { version = "=0.19.1", path = "./crates/db_views_actor" } -lemmy_db_views_moderator = { version = "=0.19.1", path = "./crates/db_views_moderator" } +lemmy_api = { version = "=0.19.2-rc.1", path = "./crates/api" } +lemmy_api_crud = { version = "=0.19.2-rc.1", path = "./crates/api_crud" } +lemmy_apub = { version = "=0.19.2-rc.1", path = "./crates/apub" } +lemmy_utils = { version = "=0.19.2-rc.1", path = "./crates/utils" } +lemmy_db_schema = { version = "=0.19.2-rc.1", path = "./crates/db_schema" } +lemmy_api_common = { version = "=0.19.2-rc.1", path = "./crates/api_common" } +lemmy_routes = { version = "=0.19.2-rc.1", path = "./crates/routes" } +lemmy_db_views = { version = "=0.19.2-rc.1", path = "./crates/db_views" } +lemmy_db_views_actor = { version = "=0.19.2-rc.1", path = "./crates/db_views_actor" } +lemmy_db_views_moderator = { version = "=0.19.2-rc.1", path = "./crates/db_views_moderator" } activitypub_federation = { version = "0.5.0-beta.6", default-features = false, features = [ "actix-web", ] } @@ -166,7 +166,7 @@ lemmy_utils = { workspace = true } lemmy_db_schema = { workspace = true } lemmy_api_common = { workspace = true } lemmy_routes = { workspace = true } -lemmy_federate = { version = "0.19.1", path = "crates/federate" } +lemmy_federate = { version = "0.19.2-rc.1", path = "crates/federate" } activitypub_federation = { workspace = true } diesel = { workspace = true } diesel-async = { workspace = true } diff --git a/crates/utils/translations b/crates/utils/translations index a36865ee8..06a610696 160000 --- a/crates/utils/translations +++ b/crates/utils/translations @@ -1 +1 @@ -Subproject commit a36865ee8ca3658fea31ba948b67b75a812e84fc +Subproject commit 06a610696af829248954e411ebe2cf3906092244 From 747ab89e87e512dae8d2ab327b8369af212ce75b Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 5 Jan 2024 12:32:06 +0100 Subject: [PATCH 11/19] Upgrade docker rust version to 1.75 (#4353) --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6ba506961..b04332118 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.6 -ARG RUST_VERSION=1.72.1 +ARG RUST_VERSION=1.75 ARG CARGO_BUILD_FEATURES=default ARG RUST_RELEASE_MODE=debug From 346ff11795af68cc29682a1a26fa973518d956ba Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 5 Jan 2024 12:33:20 +0100 Subject: [PATCH 12/19] Version 0.19.2-rc.2 --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa81eb04f..cf9570529 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2529,7 +2529,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lemmy_api" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2558,7 +2558,7 @@ dependencies = [ [[package]] name = "lemmy_api_common" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2593,7 +2593,7 @@ dependencies = [ [[package]] name = "lemmy_api_crud" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2615,7 +2615,7 @@ dependencies = [ [[package]] name = "lemmy_apub" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2655,7 +2655,7 @@ dependencies = [ [[package]] name = "lemmy_db_schema" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "activitypub_federation", "async-trait", @@ -2692,7 +2692,7 @@ dependencies = [ [[package]] name = "lemmy_db_views" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "actix-web", "chrono", @@ -2712,7 +2712,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_actor" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "chrono", "diesel", @@ -2730,7 +2730,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_moderator" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "diesel", "diesel-async", @@ -2742,7 +2742,7 @@ dependencies = [ [[package]] name = "lemmy_federate" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "activitypub_federation", "anyhow", @@ -2765,7 +2765,7 @@ dependencies = [ [[package]] name = "lemmy_routes" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2789,7 +2789,7 @@ dependencies = [ [[package]] name = "lemmy_server" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "activitypub_federation", "actix-cors", @@ -2832,7 +2832,7 @@ dependencies = [ [[package]] name = "lemmy_utils" -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 43ee5bbed..3834daeb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.19.2-rc.1" +version = "0.19.2-rc.2" publish = false edition = "2021" description = "A link aggregator for the fediverse" @@ -85,16 +85,16 @@ unused_self = "deny" unwrap_used = "deny" [workspace.dependencies] -lemmy_api = { version = "=0.19.2-rc.1", path = "./crates/api" } -lemmy_api_crud = { version = "=0.19.2-rc.1", path = "./crates/api_crud" } -lemmy_apub = { version = "=0.19.2-rc.1", path = "./crates/apub" } -lemmy_utils = { version = "=0.19.2-rc.1", path = "./crates/utils" } -lemmy_db_schema = { version = "=0.19.2-rc.1", path = "./crates/db_schema" } -lemmy_api_common = { version = "=0.19.2-rc.1", path = "./crates/api_common" } -lemmy_routes = { version = "=0.19.2-rc.1", path = "./crates/routes" } -lemmy_db_views = { version = "=0.19.2-rc.1", path = "./crates/db_views" } -lemmy_db_views_actor = { version = "=0.19.2-rc.1", path = "./crates/db_views_actor" } -lemmy_db_views_moderator = { version = "=0.19.2-rc.1", path = "./crates/db_views_moderator" } +lemmy_api = { version = "=0.19.2-rc.2", path = "./crates/api" } +lemmy_api_crud = { version = "=0.19.2-rc.2", path = "./crates/api_crud" } +lemmy_apub = { version = "=0.19.2-rc.2", path = "./crates/apub" } +lemmy_utils = { version = "=0.19.2-rc.2", path = "./crates/utils" } +lemmy_db_schema = { version = "=0.19.2-rc.2", path = "./crates/db_schema" } +lemmy_api_common = { version = "=0.19.2-rc.2", path = "./crates/api_common" } +lemmy_routes = { version = "=0.19.2-rc.2", path = "./crates/routes" } +lemmy_db_views = { version = "=0.19.2-rc.2", path = "./crates/db_views" } +lemmy_db_views_actor = { version = "=0.19.2-rc.2", path = "./crates/db_views_actor" } +lemmy_db_views_moderator = { version = "=0.19.2-rc.2", path = "./crates/db_views_moderator" } activitypub_federation = { version = "0.5.0-beta.6", default-features = false, features = [ "actix-web", ] } @@ -166,7 +166,7 @@ lemmy_utils = { workspace = true } lemmy_db_schema = { workspace = true } lemmy_api_common = { workspace = true } lemmy_routes = { workspace = true } -lemmy_federate = { version = "0.19.2-rc.1", path = "crates/federate" } +lemmy_federate = { version = "0.19.2-rc.2", path = "crates/federate" } activitypub_federation = { workspace = true } diesel = { workspace = true } diesel-async = { workspace = true } From 4ca63c5641ab4f0001f42f11fa3663120985be45 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 5 Jan 2024 15:42:46 +0100 Subject: [PATCH 13/19] Move apub context to join-lemmy.org (fixes #4234) (#4302) * Move apub context to join-lemmy.org (fixes #4234) * Dont store federation context in sent_activity table * include basic activitypub context * update lib * ci --- Cargo.lock | 177 +++++++++++++------------- Cargo.toml | 2 +- crates/apub/assets/lemmy/context.json | 25 ---- crates/apub/src/activities/mod.rs | 4 - crates/apub/src/activity_lists.rs | 2 +- crates/apub/src/http/mod.rs | 18 +-- crates/apub/src/lib.rs | 11 +- crates/federate/src/worker.rs | 12 +- 8 files changed, 115 insertions(+), 136 deletions(-) delete mode 100644 crates/apub/assets/lemmy/context.json diff --git a/Cargo.lock b/Cargo.lock index cf9570529..ba19a1961 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,9 +10,9 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" [[package]] name = "activitypub_federation" -version = "0.5.0-beta.6" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0aafb8ad437a019bac2e11d47fad6131974dace1855640a09d0e71d26571c1" +checksum = "8bac58c1d61b6e2358adbd043c78ba853428102b489acb7b6cb74ee6f2ae668f" dependencies = [ "activitystreams-kinds", "actix-web", @@ -106,9 +106,9 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.4.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92ef85799cba03f76e4f7c10f533e66d87c9a7e7055f3391f09000ad8351bc9" +checksum = "129d4c88e98860e1758c5de288d1632b07970a16d59bdf7b8d66053d582bb71f" dependencies = [ "actix-codec", "actix-rt", @@ -151,7 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -261,9 +261,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.4.0" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4a5b5e29603ca8c94a77c65cf874718ceb60292c5a5c3e5f4ace041af462b9" +checksum = "e43428f3bf11dee6d166b00ec2df4e3aa8cc1606aaa0b7433c146852e2f4e03b" dependencies = [ "actix-codec", "actix-http", @@ -309,7 +309,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -527,18 +527,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -911,7 +911,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -1256,7 +1256,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -1289,7 +1289,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -1454,7 +1454,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -1465,7 +1465,7 @@ checksum = "c7267437d5b12df60ae29bd97f8d120f1c3a6272d6f213551afa56bbb2ecfbb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -1477,7 +1477,7 @@ dependencies = [ "diesel_table_macro_syntax", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -1507,7 +1507,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" dependencies = [ - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -1699,7 +1699,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -1887,9 +1887,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1902,9 +1902,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1912,15 +1912,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1929,38 +1929,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -3141,7 +3141,7 @@ checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -3226,9 +3226,9 @@ dependencies = [ [[package]] name = "moka" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8017ec3548ffe7d4cef7ac0e12b044c01164a74c0f3119420faeaf13490ad8b" +checksum = "f353abec74660d4b8533c2516c86eb062f1ec8ca49a2758f4f2b1b60b06b0c6e" dependencies = [ "async-lock", "async-trait", @@ -3381,9 +3381,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.61" +version = "0.10.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" dependencies = [ "bitflags 2.4.1", "cfg-if", @@ -3402,7 +3402,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -3413,9 +3413,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.97" +version = "0.9.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" dependencies = [ "cc", "libc", @@ -3828,7 +3828,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -3968,9 +3968,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" dependencies = [ "unicode-ident", ] @@ -4048,7 +4048,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -4133,9 +4133,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -4193,7 +4193,7 @@ checksum = "b8f439da1766942fe069954da6058b2e6c1760eb878bae76f5be9fc29f56f574" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -4257,7 +4257,7 @@ dependencies = [ "quote", "refinery-core", "regex", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -4312,9 +4312,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ "async-compression", "base64 0.21.5", @@ -4694,9 +4694,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" dependencies = [ "serde_derive", ] @@ -4712,20 +4712,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "indexmap 2.1.0", "itoa", @@ -4789,7 +4789,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -4814,7 +4814,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -4957,7 +4957,7 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -5089,7 +5089,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -5111,9 +5111,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.40" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fa70a4ee923979ffb522cacce59d34421ebdea5625e1073c4326ef9d2dd42e" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -5218,22 +5218,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -5298,9 +5298,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -5334,7 +5334,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -5671,7 +5671,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -5834,7 +5834,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", "termcolor", ] @@ -5855,7 +5855,7 @@ checksum = "982ee4197351b5c9782847ef5ec1fdcaf50503fb19d68f9771adae314e72b492" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -6035,7 +6035,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -6069,7 +6069,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6490,7 +6490,7 @@ checksum = "be912bf68235a88fbefd1b73415cb218405958d1655b2ece9035a19920bdf6ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -6501,20 +6501,19 @@ checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" [[package]] name = "zstd" -version = "0.12.4" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "6.0.6" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Cargo.toml b/Cargo.toml index 3834daeb5..c54255e41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,7 +95,7 @@ lemmy_routes = { version = "=0.19.2-rc.2", path = "./crates/routes" } lemmy_db_views = { version = "=0.19.2-rc.2", path = "./crates/db_views" } lemmy_db_views_actor = { version = "=0.19.2-rc.2", path = "./crates/db_views_actor" } lemmy_db_views_moderator = { version = "=0.19.2-rc.2", path = "./crates/db_views_moderator" } -activitypub_federation = { version = "0.5.0-beta.6", default-features = false, features = [ +activitypub_federation = { version = "0.5.0", default-features = false, features = [ "actix-web", ] } diesel = "2.1.4" diff --git a/crates/apub/assets/lemmy/context.json b/crates/apub/assets/lemmy/context.json deleted file mode 100644 index d847b2105..000000000 --- a/crates/apub/assets/lemmy/context.json +++ /dev/null @@ -1,25 +0,0 @@ -[ - "https://www.w3.org/ns/activitystreams", - "https://w3id.org/security/v1", - { - "lemmy": "https://join-lemmy.org/ns#", - "litepub": "http://litepub.social/ns#", - "pt": "https://joinpeertube.org/ns#", - "sc": "http://schema.org/", - "ChatMessage": "litepub:ChatMessage", - "commentsEnabled": "pt:commentsEnabled", - "sensitive": "as:sensitive", - "matrixUserId": "lemmy:matrixUserId", - "postingRestrictedToMods": "lemmy:postingRestrictedToMods", - "removeData": "lemmy:removeData", - "stickied": "lemmy:stickied", - "moderators": { - "@type": "@id", - "@id": "lemmy:moderators" - }, - "expires": "as:endTime", - "distinguished": "lemmy:distinguished", - "language": "sc:inLanguage", - "identifier": "sc:identifier" - } -] diff --git a/crates/apub/src/activities/mod.rs b/crates/apub/src/activities/mod.rs index 83d029d4e..0463e880e 100644 --- a/crates/apub/src/activities/mod.rs +++ b/crates/apub/src/activities/mod.rs @@ -23,13 +23,11 @@ use crate::{ create_or_update::{note::CreateOrUpdateNote, page::CreateOrUpdatePage}, CreateOrUpdateType, }, - CONTEXT, }; use activitypub_federation::{ config::Data, fetch::object_id::ObjectId, kinds::{activity::AnnounceType, public}, - protocol::context::WithContext, traits::{ActivityHandler, Actor}, }; use anyhow::anyhow; @@ -44,7 +42,6 @@ use lemmy_db_schema::source::{ use lemmy_db_views_actor::structs::{CommunityPersonBanView, CommunityView}; use lemmy_utils::error::{LemmyError, LemmyErrorExt, LemmyErrorType, LemmyResult}; use serde::Serialize; -use std::ops::Deref; use tracing::info; use url::{ParseError, Url}; use uuid::Uuid; @@ -204,7 +201,6 @@ where Activity: ActivityHandler, { info!("Saving outgoing activity to queue {}", activity.id()); - let activity = WithContext::new(activity, CONTEXT.deref().clone()); let form = SentActivityForm { ap_id: activity.id().clone().into(), diff --git a/crates/apub/src/activity_lists.rs b/crates/apub/src/activity_lists.rs index b0c7c6674..206f0088b 100644 --- a/crates/apub/src/activity_lists.rs +++ b/crates/apub/src/activity_lists.rs @@ -35,7 +35,7 @@ use url::Url; /// This could theoretically be defined as an enum with variants `GroupInboxActivities` and /// `PersonInboxActivities`. In practice we need to write it out manually so that priorities /// are handled correctly. -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize, Clone)] #[serde(untagged)] #[enum_delegate::implement(ActivityHandler)] pub enum SharedInboxActivities { diff --git a/crates/apub/src/http/mod.rs b/crates/apub/src/http/mod.rs index d3e925de4..3d338b74b 100644 --- a/crates/apub/src/http/mod.rs +++ b/crates/apub/src/http/mod.rs @@ -2,7 +2,7 @@ use crate::{ activity_lists::SharedInboxActivities, fetcher::user_or_community::UserOrCommunity, protocol::objects::tombstone::Tombstone, - CONTEXT, + FEDERATION_CONTEXT, }; use activitypub_federation::{ actix_web::inbox::receive_activity, @@ -43,7 +43,7 @@ fn create_apub_response(data: &T) -> LemmyResult where T: Serialize, { - let json = serde_json::to_string_pretty(&WithContext::new(data, CONTEXT.clone()))?; + let json = serde_json::to_string_pretty(&WithContext::new(data, FEDERATION_CONTEXT.clone()))?; Ok( HttpResponse::Ok() @@ -54,7 +54,10 @@ where fn create_apub_tombstone_response>(id: T) -> LemmyResult { let tombstone = Tombstone::new(id.into()); - let json = serde_json::to_string_pretty(&WithContext::new(tombstone, CONTEXT.deref().clone()))?; + let json = serde_json::to_string_pretty(&WithContext::new( + tombstone, + FEDERATION_CONTEXT.deref().clone(), + ))?; Ok( HttpResponse::Gone() @@ -96,13 +99,6 @@ pub(crate) async fn get_activity( if sensitive { Ok(HttpResponse::Forbidden().finish()) } else { - // Don't use create_apub_response() to avoid duplicate context (the activity stored in db - // already includes context). - let json = serde_json::to_string_pretty(&activity.data)?; - Ok( - HttpResponse::Ok() - .content_type(FEDERATION_CONTENT_TYPE) - .body(json), - ) + create_apub_response(&activity.data) } } diff --git a/crates/apub/src/lib.rs b/crates/apub/src/lib.rs index 0d76a78b0..e6530e4b8 100644 --- a/crates/apub/src/lib.rs +++ b/crates/apub/src/lib.rs @@ -12,6 +12,7 @@ use lemmy_db_schema::{ use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult}; use moka::future::Cache; use once_cell::sync::Lazy; +use serde_json::Value; use std::{sync::Arc, time::Duration}; use url::Url; @@ -32,8 +33,14 @@ pub const FEDERATION_HTTP_FETCH_LIMIT: u32 = 50; /// changes take effect quickly. const BLOCKLIST_CACHE_DURATION: Duration = Duration::from_secs(60); -static CONTEXT: Lazy> = Lazy::new(|| { - serde_json::from_str(include_str!("../assets/lemmy/context.json")).expect("parse context") +/// Only include a basic context to save space and bandwidth. The main context is hosted statically +/// on join-lemmy.org. Include activitystreams explicitly for better compat, but this could +/// theoretically also be moved. +pub static FEDERATION_CONTEXT: Lazy = Lazy::new(|| { + Value::Array(vec![ + Value::String("https://join-lemmy.org/context.json".to_string()), + Value::String("https://www.w3.org/ns/activitystreams".to_string()), + ]) }); #[derive(Clone)] diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index e9e5fb708..e53a42bc3 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -5,11 +5,15 @@ use crate::util::{ LEMMY_TEST_FAST_FEDERATION, WORK_FINISHED_RECHECK_DELAY, }; -use activitypub_federation::{activity_sending::SendActivityTask, config::Data}; +use activitypub_federation::{ + activity_sending::SendActivityTask, + config::Data, + protocol::context::WithContext, +}; use anyhow::{Context, Result}; use chrono::{DateTime, TimeZone, Utc}; use lemmy_api_common::{context::LemmyContext, federate_retry_sleep_duration}; -use lemmy_apub::activity_lists::SharedInboxActivities; +use lemmy_apub::{activity_lists::SharedInboxActivities, FEDERATION_CONTEXT}; use lemmy_db_schema::{ newtypes::{ActivityId, CommunityId, InstanceId}, source::{ @@ -25,6 +29,7 @@ use once_cell::sync::Lazy; use reqwest::Url; use std::{ collections::{HashMap, HashSet}, + ops::Deref, time::Duration, }; use tokio::{sync::mpsc::UnboundedSender, time::sleep}; @@ -226,9 +231,10 @@ impl InstanceWorker { .await .context("failed getting actor instance (was it marked deleted / removed?)")?; + let object = WithContext::new(object.clone(), FEDERATION_CONTEXT.deref().clone()); let inbox_urls = inbox_urls.into_iter().collect(); let requests = - SendActivityTask::prepare(object, actor.as_ref(), inbox_urls, &self.context).await?; + SendActivityTask::prepare(&object, actor.as_ref(), inbox_urls, &self.context).await?; for task in requests { // usually only one due to shared inbox tracing::debug!("sending out {}", task); From e3b715002b02149c863bafcaa8133745653b88ec Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 5 Jan 2024 17:03:13 +0100 Subject: [PATCH 14/19] Handle federated reports from Mastodon, Kbin (#4323) * Test Kbin/Mbin federation * Handle reports from Mastodon/Kbin (fixes #4217) * prettier * revert * add mastodon activity * ci * revert * ci --- Cargo.lock | 4 +- Cargo.toml | 2 +- .../apub/assets/mastodon/activities/flag.json | 13 ++++++ .../apub/assets/mbin/activities/accept.json | 12 +++++ crates/apub/assets/mbin/activities/flag.json | 11 +++++ .../apub/src/activities/community/report.rs | 15 ++++-- .../protocol/activities/community/report.rs | 46 +++++++++++++++++-- crates/apub/src/protocol/activities/mod.rs | 12 ++++- 8 files changed, 102 insertions(+), 13 deletions(-) create mode 100644 crates/apub/assets/mastodon/activities/flag.json create mode 100644 crates/apub/assets/mbin/activities/accept.json create mode 100644 crates/apub/assets/mbin/activities/flag.json diff --git a/Cargo.lock b/Cargo.lock index ba19a1961..73aa51ef9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,9 +10,9 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" [[package]] name = "activitypub_federation" -version = "0.5.0" +version = "0.5.1-beta.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bac58c1d61b6e2358adbd043c78ba853428102b489acb7b6cb74ee6f2ae668f" +checksum = "866db431760d14a7360f12e75ad48f3265b5b89cd2303e548a02bcc8983e4fcd" dependencies = [ "activitystreams-kinds", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index c54255e41..bfb275b37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,7 +95,7 @@ lemmy_routes = { version = "=0.19.2-rc.2", path = "./crates/routes" } lemmy_db_views = { version = "=0.19.2-rc.2", path = "./crates/db_views" } lemmy_db_views_actor = { version = "=0.19.2-rc.2", path = "./crates/db_views_actor" } lemmy_db_views_moderator = { version = "=0.19.2-rc.2", path = "./crates/db_views_moderator" } -activitypub_federation = { version = "0.5.0", default-features = false, features = [ +activitypub_federation = { version = "0.5.1-beta.1", default-features = false, features = [ "actix-web", ] } diesel = "2.1.4" diff --git a/crates/apub/assets/mastodon/activities/flag.json b/crates/apub/assets/mastodon/activities/flag.json new file mode 100644 index 000000000..83f4c0817 --- /dev/null +++ b/crates/apub/assets/mastodon/activities/flag.json @@ -0,0 +1,13 @@ +{ + "@context": "https://www.w3.org/ns/activitystreams", + "id": "https://mastodon.example/ccb4f39a-506a-490e-9a8c-71831c7713a4", + "type": "Flag", + "actor": "https://mastodon.example/actor", + "content": "Please take a look at this user and their posts", + "object": [ + "https://example.com/users/1", + "https://example.com/posts/380590", + "https://example.com/posts/380591" + ], + "to": "https://example.com/users/1" +} diff --git a/crates/apub/assets/mbin/activities/accept.json b/crates/apub/assets/mbin/activities/accept.json new file mode 100644 index 000000000..3a190977c --- /dev/null +++ b/crates/apub/assets/mbin/activities/accept.json @@ -0,0 +1,12 @@ +{ + "@context": "https://www.w3.org/ns/activitystreams", + "id": "https://some-mbin.instance/f/object/2721ffc3-f8a9-417e-a124-af057434a3af#accept", + "type": "Accept", + "actor": "https://some-mbin.instance/m/someMag", + "object": { + "id": "https://some-other.instance/f/object/c51ea652-e594-4920-a989-f5350f0cec05", + "type": "Follow", + "actor": "https://some-other.instance/u/someUser", + "object": "https://some-mbin.instance/m/someMag" + } +} diff --git a/crates/apub/assets/mbin/activities/flag.json b/crates/apub/assets/mbin/activities/flag.json new file mode 100644 index 000000000..7c1e5ae23 --- /dev/null +++ b/crates/apub/assets/mbin/activities/flag.json @@ -0,0 +1,11 @@ +{ + "@context": ["https://www.w3.org/ns/activitystreams"], + "id": "https://mbin-test1/reports/45f8a01d-a73e-4575-bffa-c9f24c61f458", + "type": "Flag", + "actor": "https://mbin-test1/u/BentiGorlich", + "object": ["https://lemmy-test/post/4", "https://lemmy-test/u/BentiGorlich"], + "audience": "https://lemmy-test/c/test_mag", + "summary": "dikjhgasdpas dsaĆ¼", + "content": "dikjhgasdpas dsaĆ¼", + "to": ["https://lemmy-test/c/test_mag"] +} diff --git a/crates/apub/src/activities/community/report.rs b/crates/apub/src/activities/community/report.rs index 974810f61..70278075c 100644 --- a/crates/apub/src/activities/community/report.rs +++ b/crates/apub/src/activities/community/report.rs @@ -2,7 +2,10 @@ use crate::{ activities::{generate_activity_id, send_lemmy_activity, verify_person_in_community}, insert_received_activity, objects::{community::ApubCommunity, instance::ApubSite, person::ApubPerson}, - protocol::{activities::community::report::Report, InCommunity}, + protocol::{ + activities::community::report::{Report, ReportObject}, + InCommunity, + }, PostOrComment, }; use activitypub_federation::{ @@ -45,8 +48,9 @@ impl Report { let report = Report { actor: actor.id().into(), to: [community.id().into()], - object: object_id.clone(), - summary: reason, + object: ReportObject::Lemmy(object_id.clone()), + summary: Some(reason), + content: None, kind, id: id.clone(), audience: Some(community.id().into()), @@ -97,6 +101,7 @@ impl ActivityHandler for Report { #[tracing::instrument(skip_all)] async fn receive(self, context: &Data) -> Result<(), LemmyError> { let actor = self.actor.dereference(context).await?; + let reason = self.reason()?; match self.object.dereference(context).await? { PostOrComment::Post(post) => { let report_form = PostReportForm { @@ -104,7 +109,7 @@ impl ActivityHandler for Report { post_id: post.id, original_post_name: post.name.clone(), original_post_url: post.url.clone(), - reason: self.summary.clone(), + reason, original_post_body: post.body.clone(), }; PostReport::report(&mut context.pool(), &report_form).await?; @@ -114,7 +119,7 @@ impl ActivityHandler for Report { creator_id: actor.id, comment_id: comment.id, original_comment_text: comment.content.clone(), - reason: self.summary.clone(), + reason, }; CommentReport::report(&mut context.pool(), &report_form).await?; } diff --git a/crates/apub/src/protocol/activities/community/report.rs b/crates/apub/src/protocol/activities/community/report.rs index 6e8a1bbf3..adcddfdfc 100644 --- a/crates/apub/src/protocol/activities/community/report.rs +++ b/crates/apub/src/protocol/activities/community/report.rs @@ -11,7 +11,7 @@ use activitypub_federation::{ protocol::helpers::deserialize_one, }; use lemmy_api_common::context::LemmyContext; -use lemmy_utils::error::LemmyError; +use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult}; use serde::{Deserialize, Serialize}; use url::Url; @@ -21,14 +21,54 @@ pub struct Report { pub(crate) actor: ObjectId, #[serde(deserialize_with = "deserialize_one")] pub(crate) to: [ObjectId; 1], - pub(crate) object: ObjectId, - pub(crate) summary: String, + pub(crate) object: ReportObject, + /// Report reason as sent by Lemmy + pub(crate) summary: Option, + /// Report reason as sent by Mastodon + pub(crate) content: Option, #[serde(rename = "type")] pub(crate) kind: FlagType, pub(crate) id: Url, pub(crate) audience: Option>, } +impl Report { + pub fn reason(&self) -> LemmyResult { + self + .summary + .clone() + .or(self.content.clone()) + .ok_or(LemmyErrorType::CouldntFindObject.into()) + } +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub(crate) enum ReportObject { + Lemmy(ObjectId), + /// Mastodon sends an array containing user id and one or more post ids + Mastodon(Vec), +} + +impl ReportObject { + pub async fn dereference(self, context: &Data) -> LemmyResult { + match self { + ReportObject::Lemmy(l) => l.dereference(context).await, + ReportObject::Mastodon(objects) => { + for o in objects { + // Find the first reported item which can be dereferenced as post or comment (Lemmy can + // only handle one item per report). + let deref = ObjectId::from(o).dereference(context).await; + if deref.is_ok() { + return deref; + } + } + Err(LemmyErrorType::CouldntFindObject.into()) + } + } + } +} + #[async_trait::async_trait] impl InCommunity for Report { async fn community(&self, context: &Data) -> Result { diff --git a/crates/apub/src/protocol/activities/mod.rs b/crates/apub/src/protocol/activities/mod.rs index e7c5f64d0..024f08929 100644 --- a/crates/apub/src/protocol/activities/mod.rs +++ b/crates/apub/src/protocol/activities/mod.rs @@ -18,10 +18,10 @@ pub enum CreateOrUpdateType { mod tests { use crate::protocol::{ activities::{ - community::announce::AnnounceActivity, + community::{announce::AnnounceActivity, report::Report}, create_or_update::{note::CreateOrUpdateNote, page::CreateOrUpdatePage}, deletion::delete::Delete, - following::{follow::Follow, undo_follow::UndoFollow}, + following::{accept::AcceptFollow, follow::Follow, undo_follow::UndoFollow}, voting::{undo_vote::UndoVote, vote::Vote}, }, tests::test_json, @@ -50,6 +50,7 @@ mod tests { test_json::("assets/mastodon/activities/undo_follow.json")?; test_json::("assets/mastodon/activities/like_page.json")?; test_json::("assets/mastodon/activities/undo_like_page.json")?; + test_json::("assets/mastodon/activities/flag.json")?; Ok(()) } @@ -88,4 +89,11 @@ mod tests { test_json::("assets/peertube/activities/announce_video.json")?; Ok(()) } + + #[test] + fn test_parse_mbin_activities() -> LemmyResult<()> { + test_json::("assets/mbin/activities/accept.json")?; + test_json::("assets/mbin/activities/flag.json")?; + Ok(()) + } } From 2f09ad8e5b3879b2eab8332746b4d6e693087f5c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 9 Jan 2024 09:25:52 -0500 Subject: [PATCH 15/19] Version 0.19.2-rc.4 --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 24 ++++++++++++------------ crates/utils/translations | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 73aa51ef9..6db220981 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2529,7 +2529,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lemmy_api" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "activitypub_federation", "actix-web", @@ -2558,7 +2558,7 @@ dependencies = [ [[package]] name = "lemmy_api_common" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "activitypub_federation", "actix-web", @@ -2593,7 +2593,7 @@ dependencies = [ [[package]] name = "lemmy_api_crud" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "activitypub_federation", "actix-web", @@ -2615,7 +2615,7 @@ dependencies = [ [[package]] name = "lemmy_apub" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "activitypub_federation", "actix-web", @@ -2655,7 +2655,7 @@ dependencies = [ [[package]] name = "lemmy_db_schema" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "activitypub_federation", "async-trait", @@ -2692,7 +2692,7 @@ dependencies = [ [[package]] name = "lemmy_db_views" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "actix-web", "chrono", @@ -2712,7 +2712,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_actor" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "chrono", "diesel", @@ -2730,7 +2730,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_moderator" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "diesel", "diesel-async", @@ -2742,7 +2742,7 @@ dependencies = [ [[package]] name = "lemmy_federate" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "activitypub_federation", "anyhow", @@ -2765,7 +2765,7 @@ dependencies = [ [[package]] name = "lemmy_routes" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "activitypub_federation", "actix-web", @@ -2789,7 +2789,7 @@ dependencies = [ [[package]] name = "lemmy_server" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "activitypub_federation", "actix-cors", @@ -2832,7 +2832,7 @@ dependencies = [ [[package]] name = "lemmy_utils" -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index bfb275b37..4518f4523 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.19.2-rc.2" +version = "0.19.2-rc.4" publish = false edition = "2021" description = "A link aggregator for the fediverse" @@ -85,16 +85,16 @@ unused_self = "deny" unwrap_used = "deny" [workspace.dependencies] -lemmy_api = { version = "=0.19.2-rc.2", path = "./crates/api" } -lemmy_api_crud = { version = "=0.19.2-rc.2", path = "./crates/api_crud" } -lemmy_apub = { version = "=0.19.2-rc.2", path = "./crates/apub" } -lemmy_utils = { version = "=0.19.2-rc.2", path = "./crates/utils" } -lemmy_db_schema = { version = "=0.19.2-rc.2", path = "./crates/db_schema" } -lemmy_api_common = { version = "=0.19.2-rc.2", path = "./crates/api_common" } -lemmy_routes = { version = "=0.19.2-rc.2", path = "./crates/routes" } -lemmy_db_views = { version = "=0.19.2-rc.2", path = "./crates/db_views" } -lemmy_db_views_actor = { version = "=0.19.2-rc.2", path = "./crates/db_views_actor" } -lemmy_db_views_moderator = { version = "=0.19.2-rc.2", path = "./crates/db_views_moderator" } +lemmy_api = { version = "=0.19.2-rc.4", path = "./crates/api" } +lemmy_api_crud = { version = "=0.19.2-rc.4", path = "./crates/api_crud" } +lemmy_apub = { version = "=0.19.2-rc.4", path = "./crates/apub" } +lemmy_utils = { version = "=0.19.2-rc.4", path = "./crates/utils" } +lemmy_db_schema = { version = "=0.19.2-rc.4", path = "./crates/db_schema" } +lemmy_api_common = { version = "=0.19.2-rc.4", path = "./crates/api_common" } +lemmy_routes = { version = "=0.19.2-rc.4", path = "./crates/routes" } +lemmy_db_views = { version = "=0.19.2-rc.4", path = "./crates/db_views" } +lemmy_db_views_actor = { version = "=0.19.2-rc.4", path = "./crates/db_views_actor" } +lemmy_db_views_moderator = { version = "=0.19.2-rc.4", path = "./crates/db_views_moderator" } activitypub_federation = { version = "0.5.1-beta.1", default-features = false, features = [ "actix-web", ] } @@ -166,7 +166,7 @@ lemmy_utils = { workspace = true } lemmy_db_schema = { workspace = true } lemmy_api_common = { workspace = true } lemmy_routes = { workspace = true } -lemmy_federate = { version = "0.19.2-rc.2", path = "crates/federate" } +lemmy_federate = { version = "0.19.2-rc.4", path = "crates/federate" } activitypub_federation = { workspace = true } diesel = { workspace = true } diesel-async = { workspace = true } diff --git a/crates/utils/translations b/crates/utils/translations index 06a610696..2139975ef 160000 --- a/crates/utils/translations +++ b/crates/utils/translations @@ -1 +1 @@ -Subproject commit 06a610696af829248954e411ebe2cf3906092244 +Subproject commit 2139975ef383077e4709a4f2cae42922fd63b860 From 3d9dda467760dae16a12b77492e3a84fded203e8 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 9 Jan 2024 11:48:29 -0500 Subject: [PATCH 16/19] Woodpecker rust 1.75 (#4355) * Upgrading woodpecker rust to 1.75 * Trying to get publish working, try 1. * Version 0.19.2-rc.3.publish1 * Temporarily disable arm builds. * Version 0.19.2-rc.3.publish2 * Comment out arm blocks. * Version 0.19.2-rc.3.publish3 * Moving back publish block to below. * Upgrade to rasky lemmy-arm v0.2.0 * Version 0.19.2-rc.3.publish4 * Test bump for upgraded woodpecker. * Revert "Test bump for upgraded woodpecker." This reverts commit e2a5a99f33b63ef2a6f731b1ba7b4f06a02ded5f. * Adding link to raskys repo. --- .woodpecker.yml | 2 +- docker/Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index d65c90a3a..f4f3b5d7c 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,7 +2,7 @@ # See https://github.com/woodpecker-ci/woodpecker/issues/1677 variables: - - &rust_image "rust:1.74.0" + - &rust_image "rust:1.75" - &slow_check_paths - path: # rust source code diff --git a/docker/Dockerfile b/docker/Dockerfile index b04332118..e33b99cfb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,7 +4,8 @@ ARG CARGO_BUILD_FEATURES=default ARG RUST_RELEASE_MODE=debug ARG AMD_BUILDER_IMAGE=rust:${RUST_VERSION} -ARG ARM_BUILDER_IMAGE="ghcr.io/raskyld/aarch64-lemmy-linux-gnu:v0.1.0" +# Repo: https://github.com/raskyld/lemmy-cross-toolchains +ARG ARM_BUILDER_IMAGE="ghcr.io/raskyld/aarch64-lemmy-linux-gnu:v0.2.0" ARG AMD_RUNNER_IMAGE=debian:bookworm-slim ARG ARM_RUNNER_IMAGE=debian:bookworm-slim From 1ef90773e078c0b29f7ae43e4a4e0d83d1ed1fe4 Mon Sep 17 00:00:00 2001 From: dullbananas Date: Tue, 9 Jan 2024 10:19:25 -0700 Subject: [PATCH 17/19] Refactor post view tests (#4313) * Refactor post view tests * Update post_view.rs * Update post_view.rs * Update post_view.rs * Update post_view.rs * Update post_view.rs * Update post_view.rs * Update post_view.rs * remove unused import --- crates/db_views/src/post_view.rs | 634 +++++++++++++------------------ 1 file changed, 260 insertions(+), 374 deletions(-) diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index f5acc3804..0b93c6186 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -719,9 +719,6 @@ impl<'a> PostQuery<'a> { #[cfg(test)] mod tests { - #![allow(clippy::unwrap_used)] - #![allow(clippy::indexing_slicing)] - use crate::{ post_view::{PaginationCursorData, PostQuery, PostView}, structs::LocalUserView, @@ -729,9 +726,8 @@ mod tests { use chrono::Utc; use lemmy_db_schema::{ aggregates::structs::PostAggregates, - assert_length, impls::actor_language::UNDETERMINED_ID, - newtypes::LanguageId, + newtypes::{InstanceId, LanguageId, PersonId}, source::{ actor_language::LocalUserLanguage, comment::{Comment, CommentInsertForm}, @@ -746,14 +742,23 @@ mod tests { post::{Post, PostInsertForm, PostLike, PostLikeForm, PostRead, PostUpdateForm}, }, traits::{Blockable, Crud, Joinable, Likeable}, - utils::{build_db_pool_for_tests, DbPool, RANK_DEFAULT}, + utils::{build_db_pool, DbPool, RANK_DEFAULT}, SortType, SubscribedType, }; - use pretty_assertions::{assert_eq, assert_ne}; + use lemmy_utils::error::LemmyResult; + use pretty_assertions::assert_eq; use serial_test::serial; use std::{collections::HashSet, time::Duration}; + const POST_BY_BLOCKED_PERSON: &str = "post by blocked person"; + const POST_BY_BOT: &str = "post by bot"; + const POST: &str = "post"; + + fn names(post_views: &[PostView]) -> Vec<&str> { + post_views.iter().map(|i| i.post.name.as_str()).collect() + } + struct Data { inserted_instance: Instance, local_user_view: LocalUserView, @@ -764,36 +769,50 @@ mod tests { inserted_bot_post: Post, } - async fn init_data(pool: &mut DbPool<'_>) -> Data { - let inserted_instance = Instance::read_or_create(pool, "my_domain.tld".to_string()) - .await - .unwrap(); - - let person_name = "tegan".to_string(); + impl Data { + fn default_post_query(&self) -> PostQuery<'_> { + PostQuery { + sort: Some(SortType::New), + local_user: Some(&self.local_user_view), + ..Default::default() + } + } + } - let new_person = PersonInsertForm::builder() - .name(person_name.clone()) + fn default_person_insert_form(instance_id: InstanceId, name: &str) -> PersonInsertForm { + PersonInsertForm::builder() + .name(name.to_owned()) .public_key("pubkey".to_string()) - .instance_id(inserted_instance.id) - .build(); - - let inserted_person = Person::create(pool, &new_person).await.unwrap(); + .instance_id(instance_id) + .build() + } - let local_user_form = LocalUserInsertForm::builder() - .person_id(inserted_person.id) - .admin(Some(true)) + fn default_local_user_form(person_id: PersonId) -> LocalUserInsertForm { + LocalUserInsertForm::builder() + .person_id(person_id) .password_encrypted(String::new()) - .build(); - let inserted_local_user = LocalUser::create(pool, &local_user_form).await.unwrap(); + .build() + } - let new_bot = PersonInsertForm::builder() - .name("mybot".to_string()) - .bot_account(Some(true)) - .public_key("pubkey".to_string()) - .instance_id(inserted_instance.id) - .build(); + async fn init_data(pool: &mut DbPool<'_>) -> LemmyResult { + let inserted_instance = Instance::read_or_create(pool, "my_domain.tld".to_string()).await?; - let inserted_bot = Person::create(pool, &new_bot).await.unwrap(); + let new_person = default_person_insert_form(inserted_instance.id, "tegan"); + + let inserted_person = Person::create(pool, &new_person).await?; + + let local_user_form = LocalUserInsertForm { + admin: Some(true), + ..default_local_user_form(inserted_person.id) + }; + let inserted_local_user = LocalUser::create(pool, &local_user_form).await?; + + let new_bot = PersonInsertForm { + bot_account: Some(true), + ..default_person_insert_form(inserted_instance.id, "mybot") + }; + + let inserted_bot = Person::create(pool, &new_bot).await?; let new_community = CommunityInsertForm::builder() .name("test_community_3".to_string()) @@ -802,33 +821,24 @@ mod tests { .instance_id(inserted_instance.id) .build(); - let inserted_community = Community::create(pool, &new_community).await.unwrap(); + let inserted_community = Community::create(pool, &new_community).await?; // Test a person block, make sure the post query doesn't include their post - let blocked_person = PersonInsertForm::builder() - .name(person_name) - .public_key("pubkey".to_string()) - .instance_id(inserted_instance.id) - .build(); + let blocked_person = default_person_insert_form(inserted_instance.id, "john"); - let inserted_blocked_person = Person::create(pool, &blocked_person).await.unwrap(); + let inserted_blocked_person = Person::create(pool, &blocked_person).await?; - let blocked_local_user_form = LocalUserInsertForm::builder() - .person_id(inserted_blocked_person.id) - .password_encrypted(String::new()) - .build(); - let inserted_blocked_local_user = LocalUser::create(pool, &blocked_local_user_form) - .await - .unwrap(); + let inserted_blocked_local_user = + LocalUser::create(pool, &default_local_user_form(inserted_blocked_person.id)).await?; let post_from_blocked_person = PostInsertForm::builder() - .name("blocked_person_post".to_string()) + .name(POST_BY_BLOCKED_PERSON.to_string()) .creator_id(inserted_blocked_person.id) .community_id(inserted_community.id) .language_id(Some(LanguageId(1))) .build(); - Post::create(pool, &post_from_blocked_person).await.unwrap(); + Post::create(pool, &post_from_blocked_person).await?; // block that person let person_block = PersonBlockForm { @@ -836,25 +846,25 @@ mod tests { target_id: inserted_blocked_person.id, }; - PersonBlock::block(pool, &person_block).await.unwrap(); + PersonBlock::block(pool, &person_block).await?; // A sample post let new_post = PostInsertForm::builder() - .name("test post 3".to_string()) + .name(POST.to_string()) .creator_id(inserted_person.id) .community_id(inserted_community.id) .language_id(Some(LanguageId(47))) .build(); - let inserted_post = Post::create(pool, &new_post).await.unwrap(); + let inserted_post = Post::create(pool, &new_post).await?; let new_bot_post = PostInsertForm::builder() - .name("test bot post".to_string()) + .name(POST_BY_BOT.to_string()) .creator_id(inserted_bot.id) .community_id(inserted_community.id) .build(); - let inserted_bot_post = Post::create(pool, &new_bot_post).await.unwrap(); + let inserted_bot_post = Post::create(pool, &new_bot_post).await?; let local_user_view = LocalUserView { local_user: inserted_local_user, person: inserted_person, @@ -866,7 +876,7 @@ mod tests { counts: Default::default(), }; - Data { + Ok(Data { inserted_instance, local_user_view, blocked_local_user_view, @@ -874,35 +884,30 @@ mod tests { inserted_community, inserted_post, inserted_bot_post, - } + }) } #[tokio::test] #[serial] - async fn post_listing_with_person() { - let pool = &build_db_pool_for_tests().await; + async fn post_listing_with_person() -> LemmyResult<()> { + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let mut data = init_data(pool).await; + let mut data = init_data(pool).await?; let local_user_form = LocalUserUpdateForm { show_bot_accounts: Some(false), ..Default::default() }; let inserted_local_user = - LocalUser::update(pool, data.local_user_view.local_user.id, &local_user_form) - .await - .unwrap(); + LocalUser::update(pool, data.local_user_view.local_user.id, &local_user_form).await?; data.local_user_view.local_user = inserted_local_user; let read_post_listing = PostQuery { - sort: (Some(SortType::New)), - community_id: (Some(data.inserted_community.id)), - local_user: (Some(&data.local_user_view)), - ..Default::default() + community_id: Some(data.inserted_community.id), + ..data.default_post_query() } .list(pool) - .await - .unwrap(); + .await?; let post_listing_single_with_person = PostView::read( pool, @@ -910,16 +915,15 @@ mod tests { Some(data.local_user_view.person.id), false, ) - .await - .unwrap(); + .await?; - let mut expected_post_listing_with_user = expected_post_view(&data, pool).await; + let expected_post_listing_with_user = expected_post_view(&data, pool).await?; // Should be only one person, IE the bot post, and blocked should be missing - assert_length!(1, read_post_listing); - - assert_eq!(expected_post_listing_with_user, read_post_listing[0]); - expected_post_listing_with_user.my_vote = None; + assert_eq!( + vec![post_listing_single_with_person.clone()], + read_post_listing + ); assert_eq!( expected_post_listing_with_user, post_listing_single_with_person @@ -930,101 +934,91 @@ mod tests { ..Default::default() }; let inserted_local_user = - LocalUser::update(pool, data.local_user_view.local_user.id, &local_user_form) - .await - .unwrap(); + LocalUser::update(pool, data.local_user_view.local_user.id, &local_user_form).await?; data.local_user_view.local_user = inserted_local_user; let post_listings_with_bots = PostQuery { - sort: (Some(SortType::New)), - community_id: (Some(data.inserted_community.id)), - local_user: (Some(&data.local_user_view)), - ..Default::default() + community_id: Some(data.inserted_community.id), + ..data.default_post_query() } .list(pool) - .await - .unwrap(); + .await?; // should include bot post which has "undetermined" language - assert_length!(2, post_listings_with_bots); + assert_eq!(vec![POST_BY_BOT, POST], names(&post_listings_with_bots)); - cleanup(data, pool).await; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn post_listing_no_person() { - let pool = &build_db_pool_for_tests().await; + async fn post_listing_no_person() -> LemmyResult<()> { + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let data = init_data(pool).await; + let data = init_data(pool).await?; let read_post_listing_multiple_no_person = PostQuery { - sort: (Some(SortType::New)), - community_id: (Some(data.inserted_community.id)), - ..Default::default() + community_id: Some(data.inserted_community.id), + local_user: None, + ..data.default_post_query() } .list(pool) - .await - .unwrap(); + .await?; let read_post_listing_single_no_person = - PostView::read(pool, data.inserted_post.id, None, false) - .await - .unwrap(); + PostView::read(pool, data.inserted_post.id, None, false).await?; - let expected_post_listing_no_person = expected_post_view(&data, pool).await; + let expected_post_listing_no_person = expected_post_view(&data, pool).await?; // Should be 2 posts, with the bot post, and the blocked - assert_length!(3, read_post_listing_multiple_no_person); + assert_eq!( + vec![POST_BY_BOT, POST, POST_BY_BLOCKED_PERSON], + names(&read_post_listing_multiple_no_person) + ); assert_eq!( - expected_post_listing_no_person, - read_post_listing_multiple_no_person[1] + Some(&expected_post_listing_no_person), + read_post_listing_multiple_no_person.get(1) ); assert_eq!( expected_post_listing_no_person, read_post_listing_single_no_person ); - cleanup(data, pool).await; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn post_listing_block_community() { - let pool = &build_db_pool_for_tests().await; + async fn post_listing_block_community() -> LemmyResult<()> { + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let data = init_data(pool).await; + let data = init_data(pool).await?; let community_block = CommunityBlockForm { person_id: data.local_user_view.person.id, community_id: data.inserted_community.id, }; - CommunityBlock::block(pool, &community_block).await.unwrap(); + CommunityBlock::block(pool, &community_block).await?; let read_post_listings_with_person_after_block = PostQuery { - sort: (Some(SortType::New)), - community_id: (Some(data.inserted_community.id)), - local_user: (Some(&data.local_user_view)), - ..Default::default() + community_id: Some(data.inserted_community.id), + ..data.default_post_query() } .list(pool) - .await - .unwrap(); + .await?; // Should be 0 posts after the community block - assert_length!(0, read_post_listings_with_person_after_block); + assert_eq!(read_post_listings_with_person_after_block, vec![]); - CommunityBlock::unblock(pool, &community_block) - .await - .unwrap(); - cleanup(data, pool).await; + CommunityBlock::unblock(pool, &community_block).await?; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn post_listing_like() { - let pool = &build_db_pool_for_tests().await; + async fn post_listing_like() -> LemmyResult<()> { + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let mut data = init_data(pool).await; + let mut data = init_data(pool).await?; let post_like_form = PostLikeForm { post_id: data.inserted_post.id, @@ -1032,7 +1026,7 @@ mod tests { score: 1, }; - let inserted_post_like = PostLike::like(pool, &post_like_form).await.unwrap(); + let inserted_post_like = PostLike::like(pool, &post_like_form).await?; let expected_post_like = PostLike { post_id: data.inserted_post.id, @@ -1048,10 +1042,9 @@ mod tests { Some(data.local_user_view.person.id), false, ) - .await - .unwrap(); + .await?; - let mut expected_post_with_upvote = expected_post_view(&data, pool).await; + let mut expected_post_with_upvote = expected_post_view(&data, pool).await?; expected_post_with_upvote.my_vote = Some(1); expected_post_with_upvote.counts.score = 1; expected_post_with_upvote.counts.upvotes = 1; @@ -1062,60 +1055,47 @@ mod tests { ..Default::default() }; let inserted_local_user = - LocalUser::update(pool, data.local_user_view.local_user.id, &local_user_form) - .await - .unwrap(); + LocalUser::update(pool, data.local_user_view.local_user.id, &local_user_form).await?; data.local_user_view.local_user = inserted_local_user; let read_post_listing = PostQuery { - sort: (Some(SortType::New)), - community_id: (Some(data.inserted_community.id)), - local_user: (Some(&data.local_user_view)), - ..Default::default() + community_id: Some(data.inserted_community.id), + ..data.default_post_query() } .list(pool) - .await - .unwrap(); - assert_length!(1, read_post_listing); - - assert_eq!(expected_post_with_upvote, read_post_listing[0]); + .await?; + assert_eq!(vec![expected_post_with_upvote], read_post_listing); let read_liked_post_listing = PostQuery { - community_id: (Some(data.inserted_community.id)), - local_user: (Some(&data.local_user_view)), - liked_only: (true), - ..Default::default() + community_id: Some(data.inserted_community.id), + liked_only: true, + ..data.default_post_query() } .list(pool) - .await - .unwrap(); + .await?; assert_eq!(read_post_listing, read_liked_post_listing); let read_disliked_post_listing = PostQuery { - community_id: (Some(data.inserted_community.id)), - local_user: (Some(&data.local_user_view)), - disliked_only: (true), - ..Default::default() + community_id: Some(data.inserted_community.id), + disliked_only: true, + ..data.default_post_query() } .list(pool) - .await - .unwrap(); - assert!(read_disliked_post_listing.is_empty()); + .await?; + assert_eq!(read_disliked_post_listing, vec![]); let like_removed = - PostLike::remove(pool, data.local_user_view.person.id, data.inserted_post.id) - .await - .unwrap(); + PostLike::remove(pool, data.local_user_view.person.id, data.inserted_post.id).await?; assert_eq!(1, like_removed); - cleanup(data, pool).await; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn creator_is_moderator() { - let pool = &build_db_pool_for_tests().await; + async fn creator_info() -> LemmyResult<()> { + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let data = init_data(pool).await; + let data = init_data(pool).await?; // Make one of the inserted persons a moderator let person_id = data.local_user_view.person.id; @@ -1124,141 +1104,100 @@ mod tests { community_id, person_id, }; - CommunityModerator::join(pool, &form).await.unwrap(); + CommunityModerator::join(pool, &form).await?; let post_listing = PostQuery { - sort: (Some(SortType::Old)), - community_id: (Some(data.inserted_community.id)), - local_user: (Some(&data.local_user_view)), - ..Default::default() + community_id: Some(data.inserted_community.id), + ..data.default_post_query() } .list(pool) - .await - .unwrap(); - - assert_eq!(post_listing[0].creator.name, "tegan"); - assert!(post_listing[0].creator_is_moderator); + .await? + .into_iter() + .map(|p| (p.creator.name, p.creator_is_moderator, p.creator_is_admin)) + .collect::>(); + + let expected_post_listing = vec![ + ("mybot".to_owned(), false, false), + ("tegan".to_owned(), true, true), + ]; - assert_eq!(post_listing[1].creator.name, "mybot"); - assert!(!post_listing[1].creator_is_moderator); + assert_eq!(expected_post_listing, post_listing); - cleanup(data, pool).await; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn creator_is_admin() { - let pool = &build_db_pool_for_tests().await; - let pool = &mut pool.into(); - let data = init_data(pool).await; - - let post_listing = PostQuery { - sort: (Some(SortType::Old)), - community_id: (Some(data.inserted_community.id)), - local_user: (Some(&data.local_user_view)), - ..Default::default() - } - .list(pool) - .await - .unwrap(); + async fn post_listing_person_language() -> LemmyResult<()> { + const EL_POSTO: &str = "el posto"; - assert_eq!(post_listing[0].creator.name, "tegan"); - assert!(post_listing[0].creator_is_admin); - - assert_eq!(post_listing[1].creator.name, "mybot"); - assert!(!post_listing[1].creator_is_admin); - - cleanup(data, pool).await; - } - - #[tokio::test] - #[serial] - async fn post_listing_person_language() { - let pool = &build_db_pool_for_tests().await; + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let data = init_data(pool).await; + let data = init_data(pool).await?; let spanish_id = Language::read_id_from_code(pool, Some("es")) - .await - .unwrap() - .unwrap(); + .await? + .expect("spanish should exist"); + + let french_id = Language::read_id_from_code(pool, Some("fr")) + .await? + .expect("french should exist"); + let post_spanish = PostInsertForm::builder() - .name("asffgdsc".to_string()) + .name(EL_POSTO.to_string()) .creator_id(data.local_user_view.person.id) .community_id(data.inserted_community.id) .language_id(Some(spanish_id)) .build(); - Post::create(pool, &post_spanish).await.unwrap(); + Post::create(pool, &post_spanish).await?; - let post_listings_all = PostQuery { - sort: (Some(SortType::New)), - local_user: (Some(&data.local_user_view)), - ..Default::default() - } - .list(pool) - .await - .unwrap(); + let post_listings_all = data.default_post_query().list(pool).await?; // no language filters specified, all posts should be returned - assert_length!(3, post_listings_all); + assert_eq!(vec![EL_POSTO, POST_BY_BOT, POST], names(&post_listings_all)); - let french_id = Language::read_id_from_code(pool, Some("fr")) - .await - .unwrap() - .unwrap(); - LocalUserLanguage::update(pool, vec![french_id], data.local_user_view.local_user.id) - .await - .unwrap(); - - let post_listing_french = PostQuery { - sort: (Some(SortType::New)), - local_user: (Some(&data.local_user_view)), - ..Default::default() - } - .list(pool) - .await - .unwrap(); + LocalUserLanguage::update(pool, vec![french_id], data.local_user_view.local_user.id).await?; + + let post_listing_french = data.default_post_query().list(pool).await?; // only one post in french and one undetermined should be returned - assert_length!(2, post_listing_french); - assert!(post_listing_french - .iter() - .any(|p| p.post.language_id == french_id)); + assert_eq!(vec![POST_BY_BOT, POST], names(&post_listing_french)); + assert_eq!( + Some(french_id), + post_listing_french.get(1).map(|p| p.post.language_id) + ); LocalUserLanguage::update( pool, vec![french_id, UNDETERMINED_ID], data.local_user_view.local_user.id, ) - .await - .unwrap(); - let post_listings_french_und = PostQuery { - sort: (Some(SortType::New)), - local_user: (Some(&data.local_user_view)), - ..Default::default() - } - .list(pool) - .await - .unwrap(); + .await?; + let post_listings_french_und = data + .default_post_query() + .list(pool) + .await? + .into_iter() + .map(|p| (p.post.name, p.post.language_id)) + .collect::>(); + let expected_post_listings_french_und = vec![ + (POST_BY_BOT.to_owned(), UNDETERMINED_ID), + (POST.to_owned(), french_id), + ]; // french post and undetermined language post should be returned - assert_length!(2, post_listings_french_und); - assert_eq!( - UNDETERMINED_ID, - post_listings_french_und[0].post.language_id - ); - assert_eq!(french_id, post_listings_french_und[1].post.language_id); + assert_eq!(expected_post_listings_french_und, post_listings_french_und); - cleanup(data, pool).await; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn post_listings_removed() { - let pool = &build_db_pool_for_tests().await; + async fn post_listings_removed() -> LemmyResult<()> { + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let mut data = init_data(pool).await; + let mut data = init_data(pool).await?; // Remove the post Post::update( @@ -1269,45 +1208,31 @@ mod tests { ..Default::default() }, ) - .await - .unwrap(); + .await?; // Make sure you don't see the removed post in the results - let post_listings_no_admin = PostQuery { - sort: Some(SortType::New), - local_user: Some(&data.local_user_view), - ..Default::default() - } - .list(pool) - .await - .unwrap(); - assert_length!(1, post_listings_no_admin); + let post_listings_no_admin = data.default_post_query().list(pool).await?; + assert_eq!(vec![POST], names(&post_listings_no_admin)); // Removed bot post is shown to admins on its profile page data.local_user_view.local_user.admin = true; let post_listings_is_admin = PostQuery { - sort: Some(SortType::New), creator_id: Some(data.inserted_bot.id), - local_user: Some(&data.local_user_view), - ..Default::default() + ..data.default_post_query() } .list(pool) - .await - .unwrap(); - assert_eq!( - data.inserted_bot.id, - post_listings_is_admin[0].post.creator_id - ); + .await?; + assert_eq!(vec![POST_BY_BOT], names(&post_listings_is_admin)); - cleanup(data, pool).await; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn post_listings_deleted() { - let pool = &build_db_pool_for_tests().await; + async fn post_listings_deleted() -> LemmyResult<()> { + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let data = init_data(pool).await; + let data = init_data(pool).await?; // Delete the post Post::update( @@ -1318,8 +1243,7 @@ mod tests { ..Default::default() }, ) - .await - .unwrap(); + .await?; // Deleted post is only shown to creator for (local_user, expect_contains_deleted) in [ @@ -1328,32 +1252,30 @@ mod tests { (Some(&data.local_user_view), true), ] { let contains_deleted = PostQuery { - sort: Some(SortType::New), local_user, - ..Default::default() + ..data.default_post_query() } .list(pool) - .await - .unwrap() + .await? .iter() .any(|p| p.post.id == data.inserted_post.id); assert_eq!(expect_contains_deleted, contains_deleted); } - cleanup(data, pool).await; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn post_listing_instance_block() { - let pool = &build_db_pool_for_tests().await; + async fn post_listing_instance_block() -> LemmyResult<()> { + const POST_FROM_BLOCKED_INSTANCE: &str = "post on blocked instance"; + + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let data = init_data(pool).await; + let data = init_data(pool).await?; - let blocked_instance = Instance::read_or_create(pool, "another_domain.tld".to_string()) - .await - .unwrap(); + let blocked_instance = Instance::read_or_create(pool, "another_domain.tld".to_string()).await?; let community_form = CommunityInsertForm::builder() .name("test_community_4".to_string()) @@ -1361,73 +1283,56 @@ mod tests { .public_key("pubkey".to_string()) .instance_id(blocked_instance.id) .build(); - let inserted_community = Community::create(pool, &community_form).await.unwrap(); + let inserted_community = Community::create(pool, &community_form).await?; let post_form = PostInsertForm::builder() - .name("blocked instance post".to_string()) + .name(POST_FROM_BLOCKED_INSTANCE.to_string()) .creator_id(data.inserted_bot.id) .community_id(inserted_community.id) .language_id(Some(LanguageId(1))) .build(); - let post_from_blocked_instance = Post::create(pool, &post_form).await.unwrap(); + let post_from_blocked_instance = Post::create(pool, &post_form).await?; // no instance block, should return all posts - let post_listings_all = PostQuery { - local_user: Some(&data.local_user_view), - ..Default::default() - } - .list(pool) - .await - .unwrap(); - assert_length!(3, post_listings_all); + let post_listings_all = data.default_post_query().list(pool).await?; + assert_eq!( + vec![POST_FROM_BLOCKED_INSTANCE, POST_BY_BOT, POST], + names(&post_listings_all) + ); // block the instance let block_form = InstanceBlockForm { person_id: data.local_user_view.person.id, instance_id: blocked_instance.id, }; - InstanceBlock::block(pool, &block_form).await.unwrap(); + InstanceBlock::block(pool, &block_form).await?; // now posts from communities on that instance should be hidden - let post_listings_blocked = PostQuery { - local_user: Some(&data.local_user_view), - ..Default::default() - } - .list(pool) - .await - .unwrap(); - assert_length!(2, post_listings_blocked); - assert_ne!( - post_listings_blocked[0].post.id, - post_from_blocked_instance.id - ); - assert_ne!( - post_listings_blocked[1].post.id, - post_from_blocked_instance.id - ); + let post_listings_blocked = data.default_post_query().list(pool).await?; + assert_eq!(vec![POST_BY_BOT, POST], names(&post_listings_blocked)); + assert!(post_listings_blocked + .iter() + .all(|p| p.post.id != post_from_blocked_instance.id)); // after unblocking it should return all posts again - InstanceBlock::unblock(pool, &block_form).await.unwrap(); - let post_listings_blocked = PostQuery { - local_user: Some(&data.local_user_view), - ..Default::default() - } - .list(pool) - .await - .unwrap(); - assert_length!(3, post_listings_blocked); + InstanceBlock::unblock(pool, &block_form).await?; + let post_listings_blocked = data.default_post_query().list(pool).await?; + assert_eq!( + vec![POST_FROM_BLOCKED_INSTANCE, POST_BY_BOT, POST], + names(&post_listings_blocked) + ); - Instance::delete(pool, blocked_instance.id).await.unwrap(); - cleanup(data, pool).await; + Instance::delete(pool, blocked_instance.id).await?; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn pagination_includes_each_post_once() { - let pool = &build_db_pool_for_tests().await; + async fn pagination_includes_each_post_once() -> LemmyResult<()> { + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let data = init_data(pool).await; + let data = init_data(pool).await?; let community_form = CommunityInsertForm::builder() .name("yes".to_string()) @@ -1435,7 +1340,7 @@ mod tests { .public_key("pubkey".to_string()) .instance_id(data.inserted_instance.id) .build(); - let inserted_community = Community::create(pool, &community_form).await.unwrap(); + let inserted_community = Community::create(pool, &community_form).await?; let mut inserted_post_ids = vec![]; let mut inserted_comment_ids = vec![]; @@ -1451,7 +1356,7 @@ mod tests { .featured_community(Some((comments % 2) == 0)) .published(Some(Utc::now() - Duration::from_secs(comments % 3))) .build(); - let inserted_post = Post::create(pool, &post_form).await.unwrap(); + let inserted_post = Post::create(pool, &post_form).await?; inserted_post_ids.push(inserted_post.id); for _ in 0..comments { @@ -1460,7 +1365,7 @@ mod tests { .post_id(inserted_post.id) .content("yes".to_owned()) .build(); - let inserted_comment = Comment::create(pool, &comment_form, None).await.unwrap(); + let inserted_comment = Comment::create(pool, &comment_form, None).await?; inserted_comment_ids.push(inserted_comment.id); } } @@ -1477,8 +1382,7 @@ mod tests { ..Default::default() } .list(pool) - .await - .unwrap(); + .await?; listed_post_ids.extend(post_listings.iter().map(|p| p.post.id)); @@ -1494,18 +1398,16 @@ mod tests { assert_eq!(inserted_post_ids, listed_post_ids); - Community::delete(pool, inserted_community.id) - .await - .unwrap(); - cleanup(data, pool).await; + Community::delete(pool, inserted_community.id).await?; + cleanup(data, pool).await } #[tokio::test] #[serial] - async fn post_listings_hide_read() { - let pool = &build_db_pool_for_tests().await; + async fn post_listings_hide_read() -> LemmyResult<()> { + let pool = &build_db_pool().await?; let pool = &mut pool.into(); - let mut data = init_data(pool).await; + let mut data = init_data(pool).await?; // Make sure local user hides read posts let local_user_form = LocalUserUpdateForm { @@ -1513,9 +1415,7 @@ mod tests { ..Default::default() }; let inserted_local_user = - LocalUser::update(pool, data.local_user_view.local_user.id, &local_user_form) - .await - .unwrap(); + LocalUser::update(pool, data.local_user_view.local_user.id, &local_user_form).await?; data.local_user_view.local_user = inserted_local_user; // Mark a post as read @@ -1524,50 +1424,36 @@ mod tests { HashSet::from([data.inserted_bot_post.id]), data.local_user_view.person.id, ) - .await - .unwrap(); + .await?; // Make sure you don't see the read post in the results - let post_listings_hide_read = PostQuery { - sort: Some(SortType::New), - local_user: Some(&data.local_user_view), - ..Default::default() - } - .list(pool) - .await - .unwrap(); - assert_length!(1, post_listings_hide_read); + let post_listings_hide_read = data.default_post_query().list(pool).await?; + assert_eq!(vec![POST], names(&post_listings_hide_read)); - cleanup(data, pool).await; + cleanup(data, pool).await } - async fn cleanup(data: Data, pool: &mut DbPool<'_>) { - let num_deleted = Post::delete(pool, data.inserted_post.id).await.unwrap(); - Community::delete(pool, data.inserted_community.id) - .await - .unwrap(); - Person::delete(pool, data.local_user_view.person.id) - .await - .unwrap(); - Person::delete(pool, data.inserted_bot.id).await.unwrap(); - Person::delete(pool, data.blocked_local_user_view.person.id) - .await - .unwrap(); - Instance::delete(pool, data.inserted_instance.id) - .await - .unwrap(); + async fn cleanup(data: Data, pool: &mut DbPool<'_>) -> LemmyResult<()> { + let num_deleted = Post::delete(pool, data.inserted_post.id).await?; + Community::delete(pool, data.inserted_community.id).await?; + Person::delete(pool, data.local_user_view.person.id).await?; + Person::delete(pool, data.inserted_bot.id).await?; + Person::delete(pool, data.blocked_local_user_view.person.id).await?; + Instance::delete(pool, data.inserted_instance.id).await?; assert_eq!(1, num_deleted); + + Ok(()) } - async fn expected_post_view(data: &Data, pool: &mut DbPool<'_>) -> PostView { + async fn expected_post_view(data: &Data, pool: &mut DbPool<'_>) -> LemmyResult { let (inserted_person, inserted_community, inserted_post) = ( &data.local_user_view.person, &data.inserted_community, &data.inserted_post, ); - let agg = PostAggregates::read(pool, inserted_post.id).await.unwrap(); + let agg = PostAggregates::read(pool, inserted_post.id).await?; - PostView { + Ok(PostView { post: Post { id: inserted_post.id, name: inserted_post.name.clone(), @@ -1668,6 +1554,6 @@ mod tests { read: false, saved: false, creator_blocked: false, - } + }) } } From 92b49dea3a43238c17ee6cae551fc2b3d25f570f Mon Sep 17 00:00:00 2001 From: Nutomic Date: Tue, 9 Jan 2024 18:37:48 +0100 Subject: [PATCH 18/19] Increase CI timeout for restore cache (#4358) --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index f4f3b5d7c..762fb0c7f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -100,7 +100,7 @@ steps: region: us-east-1 cache_key: "rust-cache" path-style: true - backend_operation_timeout: 15m + backend_operation_timeout: 30m compression_level: 0 exit_code: true mount: From ea0b856f1e5c00f6757913d33527cff3ca9a3718 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 9 Jan 2024 12:45:54 -0500 Subject: [PATCH 19/19] Version 0.19.2-rc.5 --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6db220981..6774ed3af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2529,7 +2529,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lemmy_api" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "activitypub_federation", "actix-web", @@ -2558,7 +2558,7 @@ dependencies = [ [[package]] name = "lemmy_api_common" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "activitypub_federation", "actix-web", @@ -2593,7 +2593,7 @@ dependencies = [ [[package]] name = "lemmy_api_crud" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "activitypub_federation", "actix-web", @@ -2615,7 +2615,7 @@ dependencies = [ [[package]] name = "lemmy_apub" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "activitypub_federation", "actix-web", @@ -2655,7 +2655,7 @@ dependencies = [ [[package]] name = "lemmy_db_schema" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "activitypub_federation", "async-trait", @@ -2692,7 +2692,7 @@ dependencies = [ [[package]] name = "lemmy_db_views" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "actix-web", "chrono", @@ -2712,7 +2712,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_actor" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "chrono", "diesel", @@ -2730,7 +2730,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_moderator" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "diesel", "diesel-async", @@ -2742,7 +2742,7 @@ dependencies = [ [[package]] name = "lemmy_federate" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "activitypub_federation", "anyhow", @@ -2765,7 +2765,7 @@ dependencies = [ [[package]] name = "lemmy_routes" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "activitypub_federation", "actix-web", @@ -2789,7 +2789,7 @@ dependencies = [ [[package]] name = "lemmy_server" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "activitypub_federation", "actix-cors", @@ -2832,7 +2832,7 @@ dependencies = [ [[package]] name = "lemmy_utils" -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 4518f4523..def862d8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.19.2-rc.4" +version = "0.19.2-rc.5" publish = false edition = "2021" description = "A link aggregator for the fediverse" @@ -85,16 +85,16 @@ unused_self = "deny" unwrap_used = "deny" [workspace.dependencies] -lemmy_api = { version = "=0.19.2-rc.4", path = "./crates/api" } -lemmy_api_crud = { version = "=0.19.2-rc.4", path = "./crates/api_crud" } -lemmy_apub = { version = "=0.19.2-rc.4", path = "./crates/apub" } -lemmy_utils = { version = "=0.19.2-rc.4", path = "./crates/utils" } -lemmy_db_schema = { version = "=0.19.2-rc.4", path = "./crates/db_schema" } -lemmy_api_common = { version = "=0.19.2-rc.4", path = "./crates/api_common" } -lemmy_routes = { version = "=0.19.2-rc.4", path = "./crates/routes" } -lemmy_db_views = { version = "=0.19.2-rc.4", path = "./crates/db_views" } -lemmy_db_views_actor = { version = "=0.19.2-rc.4", path = "./crates/db_views_actor" } -lemmy_db_views_moderator = { version = "=0.19.2-rc.4", path = "./crates/db_views_moderator" } +lemmy_api = { version = "=0.19.2-rc.5", path = "./crates/api" } +lemmy_api_crud = { version = "=0.19.2-rc.5", path = "./crates/api_crud" } +lemmy_apub = { version = "=0.19.2-rc.5", path = "./crates/apub" } +lemmy_utils = { version = "=0.19.2-rc.5", path = "./crates/utils" } +lemmy_db_schema = { version = "=0.19.2-rc.5", path = "./crates/db_schema" } +lemmy_api_common = { version = "=0.19.2-rc.5", path = "./crates/api_common" } +lemmy_routes = { version = "=0.19.2-rc.5", path = "./crates/routes" } +lemmy_db_views = { version = "=0.19.2-rc.5", path = "./crates/db_views" } +lemmy_db_views_actor = { version = "=0.19.2-rc.5", path = "./crates/db_views_actor" } +lemmy_db_views_moderator = { version = "=0.19.2-rc.5", path = "./crates/db_views_moderator" } activitypub_federation = { version = "0.5.1-beta.1", default-features = false, features = [ "actix-web", ] } @@ -166,7 +166,7 @@ lemmy_utils = { workspace = true } lemmy_db_schema = { workspace = true } lemmy_api_common = { workspace = true } lemmy_routes = { workspace = true } -lemmy_federate = { version = "0.19.2-rc.4", path = "crates/federate" } +lemmy_federate = { version = "0.19.2-rc.5", path = "crates/federate" } activitypub_federation = { workspace = true } diesel = { workspace = true } diesel-async = { workspace = true }