mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 09:04:55 +00:00
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:
@@ -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());
|
||||
};
|
||||
|
||||
@@ -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(¤t.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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user