1
0
Fork 0
forked from alemi/upub

fix: oops leftovers aha

This commit is contained in:
əlemi 2024-06-08 02:18:45 +02:00
parent 07e537e454
commit 8386854ed7
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 13 additions and 2 deletions

View file

@ -10,6 +10,9 @@ pub use config::Config;
pub mod init;
pub mod ext;
pub mod selector;
pub use selector::Query;
pub use traits::normalize::AP;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

View file

@ -20,7 +20,16 @@ pub enum Identity {
}
impl Identity {
pub fn filter_condition(&self) -> Condition {
pub fn filter_activities(&self) -> Condition {
let base_cond = Condition::any().add(upub::model::addressing::Column::Actor.is_null());
match self {
Identity::Anonymous => base_cond,
Identity::Remote { internal, .. } => base_cond.add(upub::model::addressing::Column::Instance.eq(*internal)),
Identity::Local { internal, .. } => base_cond.add(upub::model::addressing::Column::Actor.eq(*internal)),
}
}
pub fn filter_objects(&self) -> Condition {
let base_cond = Condition::any().add(upub::model::addressing::Column::Actor.is_null());
match self {
Identity::Anonymous => base_cond,
@ -28,7 +37,6 @@ impl Identity {
// TODO should we allow all users on same server to see? or just specific user??
Identity::Local { id, internal } => base_cond
.add(upub::model::addressing::Column::Actor.eq(*internal))
.add(upub::model::activity::Column::Actor.eq(id))
.add(upub::model::object::Column::AttributedTo.eq(id)),
}
}