Move new subscriptions to a unfied prehandle function.

This commit is contained in:
Paul Makles
2021-01-19 11:46:22 +00:00
parent c21d7c4620
commit 8cbba0671d
7 changed files with 45 additions and 30 deletions

View File

@@ -137,9 +137,6 @@ pub async fn req(user: User, username: String) -> Result<JsonValue> {
)
.ok();
hive::subscribe_if_exists(user.id.clone(), target_id.to_string()).ok();
hive::subscribe_if_exists(target_id.to_string(), user.id.clone()).ok();
Ok(json!({ "status": "Outgoing" }))
}
Err(_) => Err(Error::DatabaseError {

View File

@@ -90,9 +90,6 @@ pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
)
.ok();
hive::subscribe_if_exists(user.id.clone(), target.id.clone()).ok();
hive::subscribe_if_exists(target.id.clone(), user.id.clone()).ok();
Ok(json!({ "status": "Blocked" }))
}
Err(_) => Err(Error::DatabaseError {

View File

@@ -60,10 +60,6 @@ pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
)
.ok();
let hive = hive::get_hive();
hive.unsubscribe(&user.id, &target.id).ok();
hive.unsubscribe(&target.id, &user.id).ok();
Ok(json!({ "status": "None" }))
}
Err(_) => Err(Error::DatabaseError {

View File

@@ -90,10 +90,6 @@ pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
)
.ok();
let hive = hive::get_hive();
hive.unsubscribe(&user.id, &target.id).ok();
hive.unsubscribe(&target.id, &user.id).ok();
Ok(json!({ "status": "None" }))
}
Err(_) => Err(Error::DatabaseError {