-use crate::newtypes::{CommunityId, DbUrl, InstanceId, PersonId};
#[cfg(feature = "full")]
use crate::schema::{community, community_follower, community_moderator, community_person_ban};
+use crate::{
+ newtypes::{CommunityId, DbUrl, InstanceId, PersonId},
+ source::placeholder_apub_url,
+};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
#[cfg(feature = "full")]
pub icon: Option<DbUrl>,
/// A URL for a banner.
pub banner: Option<DbUrl>,
- #[serde(skip_serializing)]
+ #[serde(skip, default = "placeholder_apub_url")]
pub followers_url: DbUrl,
- #[serde(skip_serializing)]
+ #[serde(skip, default = "placeholder_apub_url")]
pub inbox_url: DbUrl,
#[serde(skip)]
pub shared_inbox_url: Option<DbUrl>,
+use crate::newtypes::DbUrl;
+use url::Url;
+
#[cfg(feature = "full")]
pub mod activity;
pub mod actor_language;
pub mod secret;
pub mod site;
pub mod tagline;
+
+/// Default value for columns like [community::Community.inbox_url] which are marked as serde(skip).
+///
+/// This is necessary so they can be successfully deserialized from API responses, even though the
+/// value is not sent by Lemmy. Necessary for crates which rely on Rust API such as lemmy-stats-crawler.
+fn placeholder_apub_url() -> DbUrl {
+ DbUrl(Box::new(
+ Url::parse("http://example.com").expect("parse placeholer url"),
+ ))
+}
-use crate::newtypes::{DbUrl, InstanceId, PersonId};
#[cfg(feature = "full")]
use crate::schema::{person, person_follower};
+use crate::{
+ newtypes::{DbUrl, InstanceId, PersonId},
+ source::placeholder_apub_url,
+};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
#[cfg(feature = "full")]
pub banner: Option<DbUrl>,
/// Whether the person is deleted.
pub deleted: bool,
- #[serde(skip_serializing)]
+ #[serde(skip, default = "placeholder_apub_url")]
pub inbox_url: DbUrl,
#[serde(skip)]
pub shared_inbox_url: Option<DbUrl>,