Move StaffMode declaration out of paths
This commit is contained in:
parent
2d889f59bf
commit
57781fd7aa
6 changed files with 28 additions and 33 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue