forked from alemi/upub
fix: oops leftovers aha
This commit is contained in:
parent
07e537e454
commit
8386854ed7
2 changed files with 13 additions and 2 deletions
|
@ -10,6 +10,9 @@ pub use config::Config;
|
||||||
pub mod init;
|
pub mod init;
|
||||||
pub mod ext;
|
pub mod ext;
|
||||||
|
|
||||||
|
pub mod selector;
|
||||||
|
pub use selector::Query;
|
||||||
|
|
||||||
pub use traits::normalize::AP;
|
pub use traits::normalize::AP;
|
||||||
|
|
||||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
|
@ -20,7 +20,16 @@ pub enum Identity {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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());
|
let base_cond = Condition::any().add(upub::model::addressing::Column::Actor.is_null());
|
||||||
match self {
|
match self {
|
||||||
Identity::Anonymous => base_cond,
|
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??
|
// TODO should we allow all users on same server to see? or just specific user??
|
||||||
Identity::Local { id, internal } => base_cond
|
Identity::Local { id, internal } => base_cond
|
||||||
.add(upub::model::addressing::Column::Actor.eq(*internal))
|
.add(upub::model::addressing::Column::Actor.eq(*internal))
|
||||||
.add(upub::model::activity::Column::Actor.eq(id))
|
|
||||||
.add(upub::model::object::Column::AttributedTo.eq(id)),
|
.add(upub::model::object::Column::AttributedTo.eq(id)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue