From a2529a78571e7b1b85a311bb708871499b590402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 1 Dec 2026 02:23:35 +0300 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20update=20clien?= =?UTF-8?q?ts=20live=20in=20each=20user's=20Builder=20=E2=80=BA=20Users=20?= =?UTF-8?q?dropdown=20(Clients=20group,=20polled=20every=20second=20while?= =?UTF-8?q?=20open)=20instead=20of=20a=20Releases=20card;=20board=20keys?= =?UTF-8?q?=20users=20by=20id.=20Release=20builds=20compile=20a=20git=20ar?= =?UTF-8?q?chive=20snapshot=20of=20HEAD=20(target/release-src),=20so=20wor?= =?UTF-8?q?king=20tree=20edits=20never=20leak=20into=20a=20release;=20Wind?= =?UTF-8?q?ows=20reuses=20the=20same=20archive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/lang/en/builder_release.txt | 8 -- crates/client/lang/en/builder_users.txt | 10 ++ crates/client/lang/tr/builder_release.txt | 8 -- crates/client/lang/tr/builder_users.txt | 10 ++ crates/client/src/gui/builder/releases.rs | 136 ++-------------------- crates/client/src/gui/builder/users.rs | 125 +++++++++++++++++++- crates/client/src/gui/chat.rs | 9 +- crates/client/src/release.rs | 46 ++++++-- crates/common/src/call.rs | 4 +- crates/common/src/model.rs | 1 - crates/server/src/call/release.rs | 4 +- crates/server/src/update.rs | 14 +-- 12 files changed, 202 insertions(+), 173 deletions(-) diff --git a/crates/client/lang/en/builder_release.txt b/crates/client/lang/en/builder_release.txt index a79cf74..269060f 100644 --- a/crates/client/lang/en/builder_release.txt +++ b/crates/client/lang/en/builder_release.txt @@ -21,11 +21,3 @@ linux_v3 = Linux v3 windows_vm = Windows VM windows_v1 = Windows v1 windows_v3 = Windows v3 -clients = Clients -no_clients = No clients -unknown = Unknown -dev = Dev -latest = Latest -available = Available -installing = Installing -ready = Ready diff --git a/crates/client/lang/en/builder_users.txt b/crates/client/lang/en/builder_users.txt index fdd95fd..d083e7c 100644 --- a/crates/client/lang/en/builder_users.txt +++ b/crates/client/lang/en/builder_users.txt @@ -43,3 +43,13 @@ group_sessions = Sessions group_friends = Friends tag_builder = Builder friends_count = {count} friends +group_clients = Clients +no_clients = No clients +unknown = Unknown +dev = Dev +latest = Latest +available = Available +installing = Installing +ready = Ready +failed = Failed +required = Required diff --git a/crates/client/lang/tr/builder_release.txt b/crates/client/lang/tr/builder_release.txt index 0c26551..3f72132 100644 --- a/crates/client/lang/tr/builder_release.txt +++ b/crates/client/lang/tr/builder_release.txt @@ -21,11 +21,3 @@ linux_v3 = Linux v3 windows_vm = Windows VM windows_v1 = Windows v1 windows_v3 = Windows v3 -clients = İstemciler -no_clients = İstemci yok -unknown = Bilinmiyor -dev = Geliştirme -latest = Güncel -available = Mevcut -installing = Kuruluyor -ready = Hazır diff --git a/crates/client/lang/tr/builder_users.txt b/crates/client/lang/tr/builder_users.txt index a833947..72982b8 100644 --- a/crates/client/lang/tr/builder_users.txt +++ b/crates/client/lang/tr/builder_users.txt @@ -43,3 +43,13 @@ group_sessions = Oturumlar group_friends = Arkadaşlar tag_builder = Kurucu friends_count = {count} arkadaş +group_clients = İstemciler +no_clients = İstemci yok +unknown = Bilinmiyor +dev = Geliştirme +latest = Güncel +available = Mevcut +installing = Kuruluyor +ready = Hazır +failed = Başarısız +required = Zorunlu diff --git a/crates/client/src/gui/builder/releases.rs b/crates/client/src/gui/builder/releases.rs index 51da8b8..5555c6b 100644 --- a/crates/client/src/gui/builder/releases.rs +++ b/crates/client/src/gui/builder/releases.rs @@ -1,19 +1,16 @@ use common::{ - call::{ListReleases, ListUpdateClients, PublishRelease, SetReleaseRequired}, - model::{ReleaseInfo, Staged, UpdateClient, UpdateState}, + call::{ListReleases, PublishRelease, SetReleaseRequired}, + model::{ReleaseInfo, Staged}, }; use gpui_kit::{ AnyElement, Context, Div, Entity, Hsla, IntoElement, ParentElement, PathPromptOptions, Styled, - Task, Window, div, px, + Window, div, px, }; -use std::{path::PathBuf, time::Duration}; +use std::path::PathBuf; -use super::BuilderTab; use super::ui::{card, card_header, confirmed, delete_icon_button, list_row, rows_body}; use crate::gui::{ - Palette, Yumush, - chat::View, - entity_action, millis_time, notify_error, + Palette, Yumush, entity_action, millis_time, notify_error, parts::{self, Fill, Press}, storage, style::{space, text}, @@ -22,7 +19,6 @@ use crate::gui::{ use crate::lang::w; use crate::release::{Build, Event, Job, Level, PLAN, is_source}; -const CLIENTS_TICK: Duration = Duration::from_secs(1); const METER: f32 = 140.; #[derive(Default)] @@ -38,8 +34,6 @@ pub(crate) struct Desk { failed: bool, cancelled: bool, auto_publish: bool, - clients: Vec, - clients_task: Option>, } struct Row { @@ -107,14 +101,14 @@ fn job_label(job: Job) -> &'static str { } } -fn caption_text(value: impl Into, color: Hsla) -> Div { +pub(super) fn caption_text(value: impl Into, color: Hsla) -> Div { div() .text_size(text(text::CAPTION)) .text_color(color) .child(value.into()) } -fn meter(share: f32, label: String, palette: Palette) -> Div { +pub(super) fn meter(share: f32, label: String, palette: Palette) -> Div { div() .w(px(METER)) .flex() @@ -171,75 +165,6 @@ fn job_row(row: &Row, palette: Palette) -> Div { .child(status) } -fn client_row(client: &UpdateClient, palette: Palette) -> Div { - let name = client.user.clone().unwrap_or_else(|| client.device.clone()); - let release = match (client.release, client.target.as_deref()) { - (Some(seq), Some(target)) => format!("#{seq} · {target}"), - _ => w().builder_release.unknown.to_string(), - }; - let state = match client.state { - UpdateState::Unknown => caption_text(w().builder_release.dev, palette.muted), - UpdateState::Latest => caption_text(w().builder_release.latest, palette.ok), - UpdateState::Available { required, .. } => caption_text( - if required { - format!( - "{} · {}", - w().builder_release.available, - w().builder_release.required - ) - } else { - w().builder_release.available.to_string() - }, - palette.muted, - ), - UpdateState::Downloading { percent, .. } => { - meter(f32::from(percent) / 100., format!("{percent}%"), palette) - } - UpdateState::Installing { .. } => { - caption_text(w().builder_release.installing, palette.muted) - } - UpdateState::Ready { .. } => caption_text(w().builder_release.ready, palette.ok), - UpdateState::Failed { .. } => caption_text(w().builder_release.failed, palette.danger), - }; - let dot = div() - .size(px(space::SM)) - .flex_shrink_0() - .rounded_full() - .bg(if client.online { - palette.ok - } else { - palette.muted - }); - let seen = (!client.online) - .then(|| caption_text(millis_time(client.seen_ms, w().common.date), palette.muted)); - - list_row() - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .child( - div() - .truncate() - .text_size(text(text::LABEL)) - .text_color(palette.text) - .child(name), - ) - .children( - client - .user - .is_some() - .then(|| caption_text(client.device.clone(), palette.muted)), - ), - ) - .child(caption_text(release, palette.muted)) - .child(state) - .child(dot) - .children(seen) -} - fn draft_row(draft: &Draft, duplicate: bool, entity: &Entity, palette: Palette) -> Div { let id = draft.id; let status = match &draft.stage { @@ -363,7 +288,6 @@ impl Yumush { if !self.desk.drafts.is_empty() { body.push(self.draft_card(entity, palette).into_any_element()); } - body.push(self.clients_card(palette).into_any_element()); body.push(self.releases_card(entity, palette).into_any_element()); body } @@ -457,23 +381,6 @@ impl Yumush { ) } - fn clients_card(&self, palette: Palette) -> Div { - let rows: Vec
= self - .desk - .clients - .iter() - .map(|client| client_row(client, palette)) - .collect(); - - card(palette) - .child(card_header( - w().builder_release.clients, - Vec::new(), - palette, - )) - .child(rows_body(rows, w().builder_release.no_clients, palette)) - } - fn draft_card(&self, entity: &Entity, palette: Palette) -> Div { let drafts = &self.desk.drafts; let rows: Vec
= drafts @@ -528,7 +435,6 @@ impl Yumush { } pub(super) fn load_releases(&mut self, window: &mut Window, cx: &mut Context) { - self.watch_clients(cx); self.fetch_builder( window, cx, @@ -540,34 +446,6 @@ impl Yumush { ); } - fn watch_clients(&mut self, cx: &mut Context) { - if self.desk.clients_task.is_some() { - return; - } - let network = self.network.clone(); - self.desk.clients_task = Some(cx.spawn(async move |this, cx| { - loop { - let open = this - .update(cx, |yumush, _| { - yumush.chat.view == View::Builder - && yumush.chat.builder_tab == BuilderTab::Releases - }) - .unwrap_or(false); - if !open { - let _ = this.update(cx, |yumush, _| yumush.desk.clients_task = None); - break; - } - if let Ok(clients) = network.call(ListUpdateClients).await { - let _ = this.update(cx, |yumush, cx| { - yumush.desk.clients = clients; - cx.notify(); - }); - } - cx.background_executor().timer(CLIENTS_TICK).await; - } - })); - } - pub(super) fn pick_release_source(&self, window: &mut Window, cx: &mut Context) { let picked = cx.prompt_for_paths(PathPromptOptions { files: false, diff --git a/crates/client/src/gui/builder/users.rs b/crates/client/src/gui/builder/users.rs index e0c0c48..b328f3a 100644 --- a/crates/client/src/gui/builder/users.rs +++ b/crates/client/src/gui/builder/users.rs @@ -1,12 +1,13 @@ use common::model::Id; -use std::future::Future; +use std::{future::Future, time::Duration}; use common::{ call::{ - BanUser, ClearProfile, CreateUser, DeleteUser, FollowStats, ListSessions, PurgeUser, - RenameUser, ResetPassword, RevokeSession, RevokeSessions, SuspendUser, TimeoutUser, + BanUser, ClearProfile, CreateUser, DeleteUser, FollowStats, ListSessions, + ListUpdateClients, PurgeUser, RenameUser, ResetPassword, RevokeSession, RevokeSessions, + SuspendUser, TimeoutUser, }, - model::{Account, BanScope, Role, SessionInfo, User}, + model::{Account, BanScope, Role, SessionInfo, UpdateClient, UpdateState, User}, permission, stats::Stats, time::{DAY_MILLIS, HOUR_MILLIS, MINUTE_MILLIS, now_ms}, @@ -21,11 +22,15 @@ use gpui_kit::{ px, }; +use super::BuilderTab; +use super::releases::{caption_text, meter}; use super::ui::{action_button, action_group, card, confirm_button, confirmed, pill}; use crate::lang::w; use crate::{ gui::{ - Palette, Tooltip as _, Yumush, avatar, clickable, entity_action, millis_time, notify_error, + Palette, Tooltip as _, Yumush, avatar, + chat::View, + clickable, entity_action, millis_time, notify_error, parts::{self, Press}, profile::user_link, style::{radius, size, space, text}, @@ -36,6 +41,7 @@ use crate::{ }; const FRIENDS_MAX_H: f32 = 200.; +const CLIENTS_TICK: Duration = Duration::from_secs(1); const MINUTES_PER_HOUR: u64 = HOUR_MILLIS / MINUTE_MILLIS; const MINUTES_PER_DAY: u64 = DAY_MILLIS / MINUTE_MILLIS; @@ -249,10 +255,43 @@ impl Yumush { .is_some_and(|(open, _)| *open == user_id) { self.chat.builder_sessions = None; + self.chat.builder_clients.clear(); + self.chat.builder_clients_task = None; cx.notify(); return; } self.load_sessions(user_id, window, cx); + self.chat.builder_clients.clear(); + self.watch_builder_clients(user_id, cx); + } + + fn watch_builder_clients(&mut self, user_id: Id, cx: &mut Context) { + let network = self.network.clone(); + self.chat.builder_clients_task = Some(cx.spawn(async move |this, cx| { + loop { + let open = this + .update(cx, |yumush, _| { + yumush.chat.view == View::Builder + && yumush.chat.builder_tab == BuilderTab::Users + && yumush + .chat + .builder_sessions + .as_ref() + .is_some_and(|(open, _)| *open == user_id) + }) + .unwrap_or(false); + if !open { + break; + } + if let Ok(clients) = network.call(ListUpdateClients { user_id }).await { + let _ = this.update(cx, |yumush, cx| { + yumush.chat.builder_clients = clients; + cx.notify(); + }); + } + cx.background_executor().timer(CLIENTS_TICK).await; + } + })); } pub(super) fn revoke_builder_session( @@ -667,6 +706,68 @@ impl Yumush { .child(revoke_button) } + fn builder_client_row(&self, client: &UpdateClient, palette: Palette) -> Div { + let release = match (client.release, client.target.as_deref()) { + (Some(seq), Some(target)) => format!("#{seq} · {target}"), + _ => w().builder_users.unknown.to_string(), + }; + let state = match client.state { + UpdateState::Unknown => caption_text(w().builder_users.dev, palette.muted), + UpdateState::Latest => caption_text(w().builder_users.latest, palette.ok), + UpdateState::Available { required, .. } => caption_text( + if required { + format!( + "{} · {}", + w().builder_users.available, + w().builder_users.required + ) + } else { + w().builder_users.available.to_string() + }, + palette.muted, + ), + UpdateState::Downloading { percent, .. } => { + meter(f32::from(percent) / 100., format!("{percent}%"), palette) + } + UpdateState::Installing { .. } => { + caption_text(w().builder_users.installing, palette.muted) + } + UpdateState::Ready { .. } => caption_text(w().builder_users.ready, palette.ok), + UpdateState::Failed { .. } => caption_text(w().builder_users.failed, palette.danger), + }; + let dot = div() + .size(px(space::SM)) + .flex_shrink_0() + .rounded_full() + .bg(if client.online { + palette.ok + } else { + palette.muted + }); + let seen = + (!client.online).then(|| caption_text(seen_text(Some(client.seen_ms)), palette.muted)); + + div() + .w_full() + .h(px(size::CONTROL_SM)) + .flex() + .items_center() + .gap(px(space::SM)) + .child(crate::gui::parts::small_icon(IconName::Monitor).text_color(palette.muted)) + .child( + div() + .flex_1() + .text_size(text(text::CAPTION)) + .min_w_0() + .truncate() + .child(client.device.clone()), + ) + .child(caption_text(release, palette.muted)) + .child(state) + .child(dot) + .children(seen) + } + pub(super) fn builder_rename_row( &self, user_id: Id, @@ -1050,6 +1151,15 @@ impl Yumush { .into_any_element() }) .collect(); + let clients: Vec = if self.chat.builder_clients.is_empty() { + vec![caption_text(w().builder_users.no_clients, palette.muted).into_any_element()] + } else { + self.chat + .builder_clients + .iter() + .map(|client| self.builder_client_row(client, palette).into_any_element()) + .collect() + }; div() .flex() @@ -1089,6 +1199,11 @@ impl Yumush { palette, sessions, )) + .children(action_group( + w().builder_users.group_clients, + palette, + clients, + )) .children(action_group( w().builder_users.group_friends, palette, diff --git a/crates/client/src/gui/chat.rs b/crates/client/src/gui/chat.rs index 8485989..7e2ead0 100644 --- a/crates/client/src/gui/chat.rs +++ b/crates/client/src/gui/chat.rs @@ -43,7 +43,8 @@ use common::{ Account, AdminActionKind, AdminLogEntry, AttachmentInfo, Ban, BanScope, CallLog, Community, CommunityKind, CommunitySummary, CommunityUsage, DayStat, Edit, Friends, Id, Invitation, InviteCode, LogEntry, Member, Message, MessageHit, Overview, Presence, Rank, Reply, Report, - ReportStatus, ServerBan, SessionInfo, Unread, Usage, User, VoiceRoom, mentions, + ReportStatus, ServerBan, SessionInfo, Unread, UpdateClient, Usage, User, VoiceRoom, + mentions, }, permission, share::{Kind, Share}, @@ -198,6 +199,8 @@ pub struct Chat { pub(super) pending_builder_password: Option, pub(super) builder_password: Entity, pub(super) builder_sessions: Option<(Id, Vec)>, + pub(super) builder_clients: Vec, + pub(super) builder_clients_task: Option>, pub(super) builder_friends: Vec, pub(super) pending_builder_rename: Option, pub(super) builder_rename: Entity, @@ -543,6 +546,8 @@ impl Chat { new_password, pending_builder_password: None, builder_sessions: None, + builder_clients: Vec::new(), + builder_clients_task: None, builder_friends: Vec::new(), pending_builder_rename: None, builder_rename: new_input(w().chat.new_username, window, cx), @@ -1253,6 +1258,8 @@ impl Chat { self.pending_builder_delete = None; self.pending_builder_password = None; self.builder_sessions = None; + self.builder_clients.clear(); + self.builder_clients_task = None; self.pending_builder_rename = None; self.pending_builder_timeout = None; self.pending_builder_ban = None; diff --git a/crates/client/src/release.rs b/crates/client/src/release.rs index 8dd838f..7ffbb51 100644 --- a/crates/client/src/release.rs +++ b/crates/client/src/release.rs @@ -42,6 +42,8 @@ pub enum Event { Done, } +const TREE: &str = "target/release-src"; +const ARCHIVE: &str = "dist/source.tgz"; const VM: &str = "yumush-win"; const TARGET: &str = "yumush@127.0.0.1"; const PORT: &str = "2222"; @@ -148,7 +150,7 @@ fn preflight(source: &Path) -> Result { if !dirty.stdout.is_empty() { return Err("uncommitted changes".into()); } - fs::create_dir_all(source.join("dist")).map_err(|e| e.to_string())?; + snapshot(source)?; if !podman_ok(&["container", "exists", VM]) { return Ok(Vm::Missing); } @@ -212,6 +214,31 @@ fn toml_text(cpu: &str) -> String { ) } +fn snapshot(source: &Path) -> Result<(), String> { + let tree = source.join(TREE); + if tree.exists() { + fs::remove_dir_all(&tree).map_err(|e| e.to_string())?; + } + fs::create_dir_all(&tree).map_err(|e| e.to_string())?; + fs::create_dir_all(source.join("dist")).map_err(|e| e.to_string())?; + let tgz = source.join(ARCHIVE); + check( + Command::new("git") + .arg("-C") + .arg(source) + .args(["archive", "--format=tar.gz", "-o"]) + .arg(&tgz) + .arg("HEAD"), + )?; + check( + Command::new("tar") + .arg("xzf") + .arg(&tgz) + .arg("-C") + .arg(&tree), + ) +} + fn build_linux(job: Job, level: Level, source: &Path, cx: &Cx) -> Result<(), String> { let (name, cpu) = flags(level); fs::write( @@ -220,11 +247,11 @@ fn build_linux(job: Job, level: Level, source: &Path, cx: &Cx) -> Result<(), Str ) .map_err(|e| e.to_string())?; let mut cmd = Command::new("cargo"); - cmd.current_dir(source) + cmd.current_dir(source.join(TREE)) .args(["build", "--release", "-p", "client", "--target-dir"]) - .arg(format!("target/release-{name}")) + .arg(source.join(format!("target/release-{name}"))) .arg("--config") - .arg(format!("dist/{name}.toml")) + .arg(source.join(format!("dist/{name}.toml"))) .env("CARGO_TERM_PROGRESS_WHEN", "always") .env("CARGO_TERM_PROGRESS_WIDTH", "200") .env("CARGO_TERM_COLOR", "never") @@ -243,16 +270,11 @@ fn build_linux(job: Job, level: Level, source: &Path, cx: &Cx) -> Result<(), Str fn start_windows(job: Job, source: &Path, key: &Path, cx: &Cx) -> Result<(), String> { wait_ssh(job, key, cx)?; - let tgz = source.join("dist/source.tgz"); check( - Command::new("git") - .arg("-C") - .arg(source) - .args(["archive", "--format=tar.gz", "-o"]) - .arg(&tgz) - .arg("HEAD"), + scp(key) + .arg(source.join(ARCHIVE)) + .arg(format!("{TARGET}:release.tgz")), )?; - check(scp(key).arg(&tgz).arg(format!("{TARGET}:release.tgz")))?; stream(&mut ps(key, EXTRACT), job, cx)?; cx.send(Event::Finished(job)); Ok(()) diff --git a/crates/common/src/call.rs b/crates/common/src/call.rs index 584ffbc..16408ac 100644 --- a/crates/common/src/call.rs +++ b/crates/common/src/call.rs @@ -629,7 +629,9 @@ pub struct ListBackups; pub struct ListReleases; #[derive(Debug, Clone, Encode, Decode)] -pub struct ListUpdateClients; +pub struct ListUpdateClients { + pub user_id: Id, +} #[derive(Debug, Clone, Encode, Decode)] pub struct PublishRelease { diff --git a/crates/common/src/model.rs b/crates/common/src/model.rs index ca9b661..8e1ede0 100644 --- a/crates/common/src/model.rs +++ b/crates/common/src/model.rs @@ -467,7 +467,6 @@ pub enum UpdateState { #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] pub struct UpdateClient { - pub user: Option, pub device: String, pub release: Option, pub target: Option, diff --git a/crates/server/src/call/release.rs b/crates/server/src/call/release.rs index 0a5f2f8..30a941a 100644 --- a/crates/server/src/call/release.rs +++ b/crates/server/src/call/release.rs @@ -42,11 +42,13 @@ impl Handle for ListUpdateClients { let online = cx.sh.services.hub.installs(); let mut clients = Vec::new(); for (install, seen) in cx.sh.releases.recent() { + if seen.user != Some(self.user_id) { + continue; + } let (release, target) = db::release::of_file(&seen.build, cx.db) .await? .map_or((None, None), |(seq, target)| (Some(seq), Some(target))); clients.push(UpdateClient { - user: seen.user, device: seen.device, release, target, diff --git a/crates/server/src/update.rs b/crates/server/src/update.rs index ab5efa7..a892bf7 100644 --- a/crates/server/src/update.rs +++ b/crates/server/src/update.rs @@ -8,7 +8,7 @@ use std::{ use common::{ error::{Error as CommonError, ReleaseProblem}, frame::{self, DOWN_MAX, Sending, UP_MAX}, - model::{Staged, UpdateState, User}, + model::{Id, Staged, UpdateState, User}, open::Stage, permission, time::now_ms, @@ -42,7 +42,7 @@ fn pack(bytes: &[u8], path: &Path) -> std::io::Result { #[derive(Clone)] pub struct Seen { - pub user: Option, + pub user: Option, pub device: String, pub build: Sha, pub state: UpdateState, @@ -74,9 +74,9 @@ impl Releases { }) } - pub fn record(&self, me: &Me, user: Option, state: UpdateState) { + pub fn record(&self, me: &Me, user: Option, state: UpdateState) { let mut board = self.board.lock().unwrap(); - let user = user.or_else(|| board.get(&me.install).and_then(|seen| seen.user.clone())); + let user = user.or_else(|| board.get(&me.install).and_then(|seen| seen.user)); board.insert( me.install, Seen { @@ -245,7 +245,7 @@ impl Releases { if percent != shown { shown = percent; let state = UpdateState::Downloading { seq, percent }; - self.record(&me, user.clone(), state); + self.record(&me, user, state); } } } @@ -271,13 +271,13 @@ impl Releases { } } -async fn who(me: &Me, db: &Db) -> Option { +async fn who(me: &Me, db: &Db) -> Option { let token = me.token.clone()?; db.run(async |conn| authentication::resume(&token, conn).await) .await .ok() - .map(|(_, user)| user.username) + .map(|(_, user)| user.id) } fn state_of(status: Status) -> UpdateState {