Remote trailng 07 from Note in comments.rs

This commit is contained in:
Kitaiti Makoto 2022-05-03 00:50:43 +09:00
parent 595fa05660
commit ce42524273

View File

@ -16,7 +16,7 @@ use activitystreams::{
base::{AnyBase, Base}, base::{AnyBase, Base},
iri_string::types::IriString, iri_string::types::IriString,
link::{self, kind::MentionType}, link::{self, kind::MentionType},
object::{Note as Note07, Tombstone}, object::{Note, Tombstone},
prelude::*, prelude::*,
primitives::OneOrMany, primitives::OneOrMany,
time::OffsetDateTime, time::OffsetDateTime,
@ -111,7 +111,7 @@ impl Comment {
.unwrap_or(false) .unwrap_or(false)
} }
pub fn to_activity07(&self, conn: &DbConn) -> Result<Note07> { pub fn to_activity07(&self, conn: &DbConn) -> Result<Note> {
let author = User::get(conn, self.author_id)?; let author = User::get(conn, self.author_id)?;
let (html, mentions, _hashtags) = utils::md_to_html( let (html, mentions, _hashtags) = utils::md_to_html(
self.content.get().as_ref(), self.content.get().as_ref(),
@ -120,7 +120,7 @@ impl Comment {
Some(Media::get_media_processor(conn, vec![&author])), Some(Media::get_media_processor(conn, vec![&author])),
); );
let mut note = Note07::new(); let mut note = Note::new();
let to = vec![PUBLIC_VISIBILITY.parse::<IriString>()?]; let to = vec![PUBLIC_VISIBILITY.parse::<IriString>()?];
note.set_id( note.set_id(
@ -219,13 +219,13 @@ impl Comment {
impl FromId<DbConn> for Comment { impl FromId<DbConn> for Comment {
type Error = Error; type Error = Error;
type Object = Note07; type Object = Note;
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> { fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
Self::find_by_ap_url(conn, id) Self::find_by_ap_url(conn, id)
} }
fn from_activity07(conn: &DbConn, note: Note07) -> Result<Self> { fn from_activity07(conn: &DbConn, note: Note) -> Result<Self> {
let comm = { let comm = {
let previous_url = note let previous_url = note
.in_reply_to() .in_reply_to()