Don't add inbox as connection
This commit is contained in:
+3
-11
@@ -15,24 +15,16 @@ use std::{future::Future, pin::Pin};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub(crate) struct Follow {
|
||||
is_listener: bool,
|
||||
input: AcceptedActivities,
|
||||
actor: Actor,
|
||||
}
|
||||
|
||||
impl Follow {
|
||||
pub fn new(is_listener: bool, input: AcceptedActivities, actor: Actor) -> Self {
|
||||
Follow {
|
||||
is_listener,
|
||||
input,
|
||||
actor,
|
||||
}
|
||||
pub fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
||||
Follow { input, actor }
|
||||
}
|
||||
|
||||
async fn perform(self, state: JobState) -> Result<(), anyhow::Error> {
|
||||
if !self.is_listener {
|
||||
state.db.add_listener(self.actor.inbox.clone()).await?;
|
||||
}
|
||||
let my_id = state.config.generate_url(UrlKind::Actor);
|
||||
|
||||
// if following relay directly, not just following 'public', followback
|
||||
@@ -45,7 +37,7 @@ impl Follow {
|
||||
.queue(Deliver::new(self.actor.inbox.clone(), follow)?)?;
|
||||
}
|
||||
|
||||
state.actors.follower(self.actor.clone()).await?;
|
||||
state.actors.add_connection(self.actor.clone()).await?;
|
||||
|
||||
let accept = generate_accept_follow(
|
||||
&state.config,
|
||||
|
||||
@@ -11,7 +11,7 @@ pub(crate) struct Reject(pub(crate) Actor);
|
||||
|
||||
impl Reject {
|
||||
async fn perform(self, state: JobState) -> Result<(), anyhow::Error> {
|
||||
state.actors.unfollower(&self.0).await?;
|
||||
state.actors.remove_connection(&self.0).await?;
|
||||
|
||||
let my_id = state.config.generate_url(UrlKind::Actor);
|
||||
let undo = generate_undo_follow(&state.config, &self.0.id, &my_id)?;
|
||||
|
||||
@@ -21,7 +21,7 @@ impl Undo {
|
||||
async fn perform(self, state: JobState) -> Result<(), anyhow::Error> {
|
||||
let was_following = state.state.db.is_connected(self.actor.id.clone()).await?;
|
||||
|
||||
state.actors.unfollower(&self.actor).await?;
|
||||
state.actors.remove_connection(&self.actor).await?;
|
||||
|
||||
if was_following {
|
||||
let my_id = state.config.generate_url(UrlKind::Actor);
|
||||
|
||||
Reference in New Issue
Block a user