Rename: Licensed07 -> Licensed

This commit is contained in:
Kitaiti Makoto 2022-05-03 01:15:13 +09:00
parent e1673787b4
commit 6bbadc78b0
2 changed files with 7 additions and 7 deletions

View file

@ -435,18 +435,18 @@ where
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Licensed07 { pub struct Licensed {
pub license: Option<String>, pub license: Option<String>,
} }
impl<U> UnparsedExtension<U> for Licensed07 impl<U> UnparsedExtension<U> for Licensed
where where
U: UnparsedMutExt, U: UnparsedMutExt,
{ {
type Error = serde_json::Error; type Error = serde_json::Error;
fn try_from_unparsed(unparsed_mut: &mut U) -> Result<Self, Self::Error> { fn try_from_unparsed(unparsed_mut: &mut U) -> Result<Self, Self::Error> {
Ok(Licensed07 { Ok(Licensed {
license: unparsed_mut.remove("license")?, license: unparsed_mut.remove("license")?,
}) })
} }
@ -457,7 +457,7 @@ where
} }
} }
pub type LicensedArticle = Ext2<ApObject<Article>, Licensed07, SourceProperty>; pub type LicensedArticle = Ext2<ApObject<Article>, Licensed, SourceProperty>;
pub trait ToAsString { pub trait ToAsString {
fn to_as_string(&self) -> Option<String>; fn to_as_string(&self) -> Option<String>;
@ -570,7 +570,7 @@ mod tests {
let object = ApObject::new(Article::new()); let object = ApObject::new(Article::new());
let licensed_article = LicensedArticle::new( let licensed_article = LicensedArticle::new(
object, object,
Licensed07 { Licensed {
license: Some("CC-0".into()), license: Some("CC-0".into()),
}, },
SourceProperty { SourceProperty {

View file

@ -19,7 +19,7 @@ use plume_common::{
activity_pub::{ activity_pub::{
inbox::{AsActor, AsObject, FromId}, inbox::{AsActor, AsObject, FromId},
sign::Signer, sign::Signer,
Hashtag, HashtagType, Id, IntoId, Licensed07, LicensedArticle, Source, SourceProperty, Hashtag, HashtagType, Id, IntoId, Licensed, LicensedArticle, Source, SourceProperty,
ToAsString, ToAsUri, PUBLIC_VISIBILITY, ToAsString, ToAsUri, PUBLIC_VISIBILITY,
}, },
utils::{iri_percent_encode_seg, md_to_html}, utils::{iri_percent_encode_seg, md_to_html},
@ -409,7 +409,7 @@ impl Post {
.filter_map(|cc| cc.parse::<IriString>().ok()) .filter_map(|cc| cc.parse::<IriString>().ok())
.collect::<Vec<IriString>>(), .collect::<Vec<IriString>>(),
); );
let license = Licensed07 { let license = Licensed {
license: Some(self.license.clone()), license: Some(self.license.clone()),
}; };
Ok(LicensedArticle::new(article, license, source)) Ok(LicensedArticle::new(article, license, source))