fix: pre-release shared instances fixes (#6856)

* fix: dedupe notifications

* fix: notifs + members btn robustness

* fix: temp fix for external file wrongly showing updated

* fix: fmt
This commit is contained in:
Calum H.
2026-07-24 16:47:08 +00:00
committed by GitHub
parent cd56b98975
commit fbe70c6938
14 changed files with 179 additions and 34 deletions
@@ -25,6 +25,7 @@ pub async fn invite_shared_instance_users(
user_ids: Vec<String>,
) -> crate::Result<SharedInstanceUsers> {
let state = State::get().await?;
let _shared_instance_lock = state.lock_shared_instance(instance_id).await;
let (metadata, attachment) =
shared_instance_for_invites(instance_id, user_ids.len(), &state)
.await?;
@@ -64,6 +65,7 @@ pub async fn create_shared_instance_invite_link(
replace_invite_id: Option<String>,
) -> crate::Result<SharedInstanceInviteLink> {
let state = State::get().await?;
let _shared_instance_lock = state.lock_shared_instance(instance_id).await;
let (metadata, attachment) =
shared_instance_for_invites(instance_id, 0, &state).await?;
ensure_owner(&attachment)?;
@@ -129,6 +131,7 @@ pub async fn remove_shared_instance_users(
has_pending_recipients: bool,
) -> crate::Result<SharedInstanceUsers> {
let state = State::get().await?;
let _shared_instance_lock = state.lock_shared_instance(instance_id).await;
let Some(attachment) = shared_attachment(instance_id, &state).await? else {
return Ok(SharedInstanceUsers::empty());
};
+5 -1
View File
@@ -30,6 +30,7 @@ pub async fn authenticate_finish_flow(
.await?;
creds.upsert(&state.pool).await?;
state.friends_socket.disconnect().await?;
state
.friends_socket
.connect(&state.pool, &state.api_semaphore, &state.process_manager)
@@ -45,8 +46,8 @@ pub async fn logout() -> crate::Result<()> {
if let Some(current) = current {
ModrinthCredentials::remove(&current.user_id, &state.pool).await?;
state.friends_socket.disconnect().await?;
}
state.friends_socket.disconnect().await?;
Ok(())
}
@@ -57,6 +58,9 @@ pub async fn get_credentials() -> crate::Result<Option<ModrinthCredentials>> {
let current =
ModrinthCredentials::get_and_refresh(&state.pool, &state.api_semaphore)
.await?;
if current.is_none() {
state.friends_socket.disconnect().await?;
}
Ok(current)
}