mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 14:48:19 +01:00
fix: migration stuff
This commit is contained in:
parent
4429aa380a
commit
451cf8941a
|
|
@ -159,7 +159,10 @@ pub async fn lysand_user_from_db(
|
||||||
let mut emojis = Vec::new();
|
let mut emojis = Vec::new();
|
||||||
for tag in tags {
|
for tag in tags {
|
||||||
let mut content_format = ContentFormat::default();
|
let mut content_format = ContentFormat::default();
|
||||||
let content_entry = ContentEntry::from_string(tag.id.to_string());
|
if tag.id.is_none() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let content_entry = ContentEntry::from_string(tag.id.unwrap().to_string());
|
||||||
content_format.x.insert(tag.type_, content_entry);
|
content_format.x.insert(tag.type_, content_entry);
|
||||||
emojis.push(super::objects::CustomEmoji {
|
emojis.push(super::objects::CustomEmoji {
|
||||||
name: tag.name,
|
name: tag.name,
|
||||||
|
|
@ -314,15 +317,16 @@ pub async fn db_user_from_url(url: Url) -> anyhow::Result<entities::user::Model>
|
||||||
for emoji in custom_emojis.emojis {
|
for emoji in custom_emojis.emojis {
|
||||||
let touple = emoji.url.select_rich_img_touple().await?;
|
let touple = emoji.url.select_rich_img_touple().await?;
|
||||||
tags.push(TagType {
|
tags.push(TagType {
|
||||||
id: Url::parse(&touple.1).unwrap(),
|
id: Some(Url::parse(&touple.1).unwrap()),
|
||||||
name: emoji.name,
|
name: emoji.name,
|
||||||
type_: "Emoji".to_string(),
|
type_: "Emoji".to_string(),
|
||||||
updated: Utc::now(),
|
updated: Some(Utc::now()),
|
||||||
icon: IconType {
|
href: None,
|
||||||
|
icon: Some(IconType {
|
||||||
type_: "Image".to_string(),
|
type_: "Image".to_string(),
|
||||||
media_type: touple.0,
|
media_type: touple.0,
|
||||||
url: Url::parse(&touple.1).unwrap(),
|
url: Url::parse(&touple.1).unwrap(),
|
||||||
},
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,12 +95,13 @@ pub struct Person {
|
||||||
}
|
}
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct TagType {
|
pub struct TagType {
|
||||||
pub id: Url,
|
pub id: Option<Url>,
|
||||||
|
pub href: Option<Url>,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub type_: String,
|
pub type_: String,
|
||||||
pub updated: DateTime<Utc>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
pub icon: IconType,
|
pub icon: Option<IconType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue