Don't add inbox as connection

This commit is contained in:
asonix
2021-02-10 00:44:48 -06:00
parent a4d70d7e3a
commit b2904bb1ba
6 changed files with 13 additions and 22 deletions
+3 -11
View File
@@ -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,
+1 -1
View File
@@ -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)?;
+1 -1
View File
@@ -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);