mirror of
https://github.com/versia-pub/activitypub.git
synced 2026-03-13 19:09:17 +01:00
feat: meow meow akkoma?
This commit is contained in:
parent
cd6ff024e4
commit
dc4afd8411
13 changed files with 163 additions and 11 deletions
|
|
@ -6,7 +6,7 @@ use crate::{
|
|||
person::DbUser,
|
||||
post::{DbPost, Note},
|
||||
},
|
||||
utils::generate_random_object_id,
|
||||
utils::{base_url_encode, generate_create_id, generate_random_object_id},
|
||||
};
|
||||
use activitypub_federation::{
|
||||
activity_sending::SendActivityTask,
|
||||
|
|
@ -32,14 +32,20 @@ pub struct CreatePost {
|
|||
}
|
||||
|
||||
impl CreatePost {
|
||||
pub async fn send(note: Note, inbox: Url, data: &Data<StateHandle>) -> Result<(), Error> {
|
||||
pub async fn send(
|
||||
note: Note,
|
||||
db_entry: post::Model,
|
||||
inbox: Url,
|
||||
data: &Data<StateHandle>,
|
||||
) -> Result<(), Error> {
|
||||
print!("Sending reply to {}", ¬e.attributed_to);
|
||||
let encoded_url = base_url_encode(¬e.id.clone().into());
|
||||
let create = CreatePost {
|
||||
actor: note.attributed_to.clone(),
|
||||
to: note.to.clone(),
|
||||
object: note,
|
||||
kind: CreateType::Create,
|
||||
id: generate_random_object_id(data.domain())?,
|
||||
id: generate_create_id(data.domain(), &db_entry.id, &encoded_url)?,
|
||||
};
|
||||
let create_with_context = WithContext::new_default(create);
|
||||
let sends = SendActivityTask::prepare(
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ impl Accept {
|
|||
actor: follow_req.object.clone(),
|
||||
object: follow_req,
|
||||
kind: AcceptType::Accept,
|
||||
id: generate_follow_accept_id(data.domain(), follow_relation.id)?,
|
||||
id: generate_follow_accept_id(data.domain(), follow_relation.id.to_string().as_str())?,
|
||||
};
|
||||
let create_with_context = WithContext::new_default(create);
|
||||
let sends = SendActivityTask::prepare(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue