chore: stuff i forgot to commit ooops

This commit is contained in:
əlemi 2024-05-20 01:57:22 +02:00
parent 756012ee69
commit 9d59c73c59
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 13 additions and 12 deletions

View file

@ -117,6 +117,18 @@ impl Context {
}
}
/// get bare id, usually an uuid but unspecified
pub fn id(&self, uri: &str) -> String {
if uri.starts_with(&self.0.domain) {
uri.split('/').last().unwrap_or("").to_string()
} else {
uri
.replace("https://", "+")
.replace("http://", "+")
.replace('/', "@")
}
}
/// get full user id uri
pub fn uid(&self, id: String) -> String {
self.uri("users", id)
@ -132,17 +144,6 @@ impl Context {
self.uri("activities", id)
}
/// get bare id, usually an uuid but unspecified
pub fn id(&self, uri: &str) -> String {
if uri.starts_with(&self.0.domain) {
uri.split('/').last().unwrap_or("").to_string()
} else {
uri
.replace("https://", "+")
.replace("http://", "+")
.replace('/', "@")
}
}
pub fn server(id: &str) -> String {
id

View file

@ -319,7 +319,7 @@ impl apb::server::Inbox for Context {
// TODO in theory we could work with just object_id but right now only accept embedded
let undone_activity = activity.object().extract().ok_or_else(UpubError::bad_request)?;
let undone_aid = undone_activity.id().ok_or_else(UpubError::bad_request)?;
let undone_object_id = undone_activity.object().id().ok_or_else(UpubError::bad_request)?;
let undone_object_uri = undone_activity.object().id().ok_or_else(UpubError::bad_request)?;
let activity_type = undone_activity.activity_type().ok_or_else(UpubError::bad_request)?;
let undone_activity_author = undone_activity.actor().id().ok_or_else(UpubError::bad_request)?;