From 6bbadc78b08c327c2349ac78803c56bb1cf87900 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 May 2022 01:15:13 +0900 Subject: [PATCH] Rename: Licensed07 -> Licensed --- plume-common/src/activity_pub/mod.rs | 10 +++++----- plume-models/src/posts.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index b4d3f153..3b421206 100644 --- a/plume-common/src/activity_pub/mod.rs +++ b/plume-common/src/activity_pub/mod.rs @@ -435,18 +435,18 @@ where #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] #[serde(rename_all = "camelCase")] -pub struct Licensed07 { +pub struct Licensed { pub license: Option, } -impl UnparsedExtension for Licensed07 +impl UnparsedExtension for Licensed where U: UnparsedMutExt, { type Error = serde_json::Error; fn try_from_unparsed(unparsed_mut: &mut U) -> Result { - Ok(Licensed07 { + Ok(Licensed { license: unparsed_mut.remove("license")?, }) } @@ -457,7 +457,7 @@ where } } -pub type LicensedArticle = Ext2, Licensed07, SourceProperty>; +pub type LicensedArticle = Ext2, Licensed, SourceProperty>; pub trait ToAsString { fn to_as_string(&self) -> Option; @@ -570,7 +570,7 @@ mod tests { let object = ApObject::new(Article::new()); let licensed_article = LicensedArticle::new( object, - Licensed07 { + Licensed { license: Some("CC-0".into()), }, SourceProperty { diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 1096bcfe..46c48007 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -19,7 +19,7 @@ use plume_common::{ activity_pub::{ inbox::{AsActor, AsObject, FromId}, sign::Signer, - Hashtag, HashtagType, Id, IntoId, Licensed07, LicensedArticle, Source, SourceProperty, + Hashtag, HashtagType, Id, IntoId, Licensed, LicensedArticle, Source, SourceProperty, ToAsString, ToAsUri, PUBLIC_VISIBILITY, }, utils::{iri_percent_encode_seg, md_to_html}, @@ -409,7 +409,7 @@ impl Post { .filter_map(|cc| cc.parse::().ok()) .collect::>(), ); - let license = Licensed07 { + let license = Licensed { license: Some(self.license.clone()), }; Ok(LicensedArticle::new(article, license, source))