Move StaffMode declaration out of paths

This commit is contained in:
Mikayla Maki 2023-01-27 15:37:36 -08:00
parent 2d889f59bf
commit 57781fd7aa
6 changed files with 28 additions and 33 deletions

View file

@ -7,7 +7,7 @@ use postage::{sink::Sink, watch};
use rpc::proto::{RequestMessage, UsersResponse};
use settings::Settings;
use std::sync::{Arc, Weak};
use util::{paths::StaffMode, TryFutureExt as _};
use util::{StaffMode, TryFutureExt as _};
#[derive(Default, Debug)]
pub struct User {
@ -149,11 +149,16 @@ impl UserStore {
);
cx.update(|cx| {
cx.set_global(
info.as_ref()
.map(|info| StaffMode(info.staff))
.unwrap_or(StaffMode(false)),
);
cx.update_default_global(|staff_mode: &mut StaffMode, _| {
if !staff_mode.0 {
*staff_mode = StaffMode(
info.as_ref()
.map(|info| info.staff)
.unwrap_or_default(),
)
}
()
});
});
current_user_tx.send(user).await.ok();