forge
Explore
Log in

Don't you dare go Hollow

Update clients live in each user's Builder › Users dropdown (Clients group, polled every second while open) instead of a Releases card

Browse files at this commit

a2529a78571e7b1b85a311bb708871499b590402Ahmet Kaan GümüşParent: 510fe00
  • refactor
    • update clients live in each user's Builder › Users dropdown (Clients group, polled every second while open) instead of a Releases card
    • board keys users by id. Release builds compile a git archive snapshot of HEAD (target/release-src), so working tree edits never leak into a release
    • Windows reuses the same archive
Show full message
♻️ refactor: update clients live in each user's Builder › Users dropdown (Clients group, polled every second while open) instead of a Releases card; board keys users by id. Release builds compile a git archive snapshot of HEAD (target/release-src), so working tree edits never leak into a release; Windows reuses the same archive
crates/client/lang/en/builder_release.txtmodified+0 -8
@@ -21,11 +21,3 @@ linux_v3 = Linux v3
2121 windows_vm = Windows VM
2222 windows_v1 = Windows v1
2323 windows_v3 = Windows v3
24-clients = Clients
25-no_clients = No clients
26-unknown = Unknown
27-dev = Dev
28-latest = Latest
29-available = Available
30-installing = Installing
31-ready = Ready
crates/client/lang/en/builder_users.txtmodified+10 -0
@@ -43,3 +43,13 @@ group_sessions = Sessions
4343 group_friends = Friends
4444 tag_builder = Builder
4545 friends_count = {count} friends
46+group_clients = Clients
47+no_clients = No clients
48+unknown = Unknown
49+dev = Dev
50+latest = Latest
51+available = Available
52+installing = Installing
53+ready = Ready
54+failed = Failed
55+required = Required
crates/client/lang/tr/builder_release.txtmodified+0 -8
@@ -21,11 +21,3 @@ linux_v3 = Linux v3
2121 windows_vm = Windows VM
2222 windows_v1 = Windows v1
2323 windows_v3 = Windows v3
24-clients = İstemciler
25-no_clients = İstemci yok
26-unknown = Bilinmiyor
27-dev = Geliştirme
28-latest = Güncel
29-available = Mevcut
30-installing = Kuruluyor
31-ready = Hazır
crates/client/lang/tr/builder_users.txtmodified+10 -0
@@ -43,3 +43,13 @@ group_sessions = Oturumlar
4343 group_friends = Arkadaşlar
4444 tag_builder = Kurucu
4545 friends_count = {count} arkadaş
46+group_clients = İstemciler
47+no_clients = İstemci yok
48+unknown = Bilinmiyor
49+dev = Geliştirme
50+latest = Güncel
51+available = Mevcut
52+installing = Kuruluyor
53+ready = Hazır
54+failed = Başarısız
55+required = Zorunlu
crates/client/src/gui/builder/releases.rsmodified+7 -129
@@ -1,19 +1,16 @@
11 use common::{
2- call::{ListReleases, ListUpdateClients, PublishRelease, SetReleaseRequired},
3- model::{ReleaseInfo, Staged, UpdateClient, UpdateState},
2+ call::{ListReleases, PublishRelease, SetReleaseRequired},
3+ model::{ReleaseInfo, Staged},
44 };
55 use gpui_kit::{
66 AnyElement, Context, Div, Entity, Hsla, IntoElement, ParentElement, PathPromptOptions, Styled,
7- Task, Window, div, px,
7+ Window, div, px,
88 };
9-use std::{path::PathBuf, time::Duration};
9+use std::path::PathBuf;
1010
11-use super::BuilderTab;
1211 use super::ui::{card, card_header, confirmed, delete_icon_button, list_row, rows_body};
1312 use crate::gui::{
14- Palette, Yumush,
15- chat::View,
16- entity_action, millis_time, notify_error,
13+ Palette, Yumush, entity_action, millis_time, notify_error,
1714 parts::{self, Fill, Press},
1815 storage,
1916 style::{space, text},
@@ -22,7 +19,6 @@ use crate::gui::{
2219 use crate::lang::w;
2320 use crate::release::{Build, Event, Job, Level, PLAN, is_source};
2421
25-const CLIENTS_TICK: Duration = Duration::from_secs(1);
2622 const METER: f32 = 140.;
2723
2824 #[derive(Default)]
@@ -38,8 +34,6 @@ pub(crate) struct Desk {
3834 failed: bool,
3935 cancelled: bool,
4036 auto_publish: bool,
41- clients: Vec<UpdateClient>,
42- clients_task: Option<Task<()>>,
4337 }
4438
4539 struct Row {
@@ -107,14 +101,14 @@ fn job_label(job: Job) -> &'static str {
107101 }
108102 }
109103
110-fn caption_text(value: impl Into<String>, color: Hsla) -> Div {
104+pub(super) fn caption_text(value: impl Into<String>, color: Hsla) -> Div {
111105 div()
112106 .text_size(text(text::CAPTION))
113107 .text_color(color)
114108 .child(value.into())
115109 }
116110
117-fn meter(share: f32, label: String, palette: Palette) -> Div {
111+pub(super) fn meter(share: f32, label: String, palette: Palette) -> Div {
118112 div()
119113 .w(px(METER))
120114 .flex()
@@ -171,75 +165,6 @@ fn job_row(row: &Row, palette: Palette) -> Div {
171165 .child(status)
172166 }
173167
174-fn client_row(client: &UpdateClient, palette: Palette) -> Div {
175- let name = client.user.clone().unwrap_or_else(|| client.device.clone());
176- let release = match (client.release, client.target.as_deref()) {
177- (Some(seq), Some(target)) => format!("#{seq} · {target}"),
178- _ => w().builder_release.unknown.to_string(),
179- };
180- let state = match client.state {
181- UpdateState::Unknown => caption_text(w().builder_release.dev, palette.muted),
182- UpdateState::Latest => caption_text(w().builder_release.latest, palette.ok),
183- UpdateState::Available { required, .. } => caption_text(
184- if required {
185- format!(
186- "{} · {}",
187- w().builder_release.available,
188- w().builder_release.required
189- )
190- } else {
191- w().builder_release.available.to_string()
192- },
193- palette.muted,
194- ),
195- UpdateState::Downloading { percent, .. } => {
196- meter(f32::from(percent) / 100., format!("{percent}%"), palette)
197- }
198- UpdateState::Installing { .. } => {
199- caption_text(w().builder_release.installing, palette.muted)
200- }
201- UpdateState::Ready { .. } => caption_text(w().builder_release.ready, palette.ok),
202- UpdateState::Failed { .. } => caption_text(w().builder_release.failed, palette.danger),
203- };
204- let dot = div()
205- .size(px(space::SM))
206- .flex_shrink_0()
207- .rounded_full()
208- .bg(if client.online {
209- palette.ok
210- } else {
211- palette.muted
212- });
213- let seen = (!client.online)
214- .then(|| caption_text(millis_time(client.seen_ms, w().common.date), palette.muted));
215-
216- list_row()
217- .child(
218- div()
219- .flex_1()
220- .min_w_0()
221- .flex()
222- .flex_col()
223- .child(
224- div()
225- .truncate()
226- .text_size(text(text::LABEL))
227- .text_color(palette.text)
228- .child(name),
229- )
230- .children(
231- client
232- .user
233- .is_some()
234- .then(|| caption_text(client.device.clone(), palette.muted)),
235- ),
236- )
237- .child(caption_text(release, palette.muted))
238- .child(state)
239- .child(dot)
240- .children(seen)
241-}
242-
243168 fn draft_row(draft: &Draft, duplicate: bool, entity: &Entity<Yumush>, palette: Palette) -> Div {
244169 let id = draft.id;
245170 let status = match &draft.stage {
@@ -363,7 +288,6 @@ impl Yumush {
363288 if !self.desk.drafts.is_empty() {
364289 body.push(self.draft_card(entity, palette).into_any_element());
365290 }
366- body.push(self.clients_card(palette).into_any_element());
367291 body.push(self.releases_card(entity, palette).into_any_element());
368292 body
369293 }
@@ -457,23 +381,6 @@ impl Yumush {
457381 )
458382 }
459383
460- fn clients_card(&self, palette: Palette) -> Div {
461- let rows: Vec<Div> = self
462- .desk
463- .clients
464- .iter()
465- .map(|client| client_row(client, palette))
466- .collect();
467-
468- card(palette)
469- .child(card_header(
470- w().builder_release.clients,
471- Vec::new(),
472- palette,
473- ))
474- .child(rows_body(rows, w().builder_release.no_clients, palette))
475- }
476-
477384 fn draft_card(&self, entity: &Entity<Self>, palette: Palette) -> Div {
478385 let drafts = &self.desk.drafts;
479386 let rows: Vec<Div> = drafts
@@ -528,7 +435,6 @@ impl Yumush {
528435 }
529436
530437 pub(super) fn load_releases(&mut self, window: &mut Window, cx: &mut Context<Self>) {
531- self.watch_clients(cx);
532438 self.fetch_builder(
533439 window,
534440 cx,
@@ -540,34 +446,6 @@ impl Yumush {
540446 );
541447 }
542448
543- fn watch_clients(&mut self, cx: &mut Context<Self>) {
544- if self.desk.clients_task.is_some() {
545- return;
546- }
547- let network = self.network.clone();
548- self.desk.clients_task = Some(cx.spawn(async move |this, cx| {
549- loop {
550- let open = this
551- .update(cx, |yumush, _| {
552- yumush.chat.view == View::Builder
553- && yumush.chat.builder_tab == BuilderTab::Releases
554- })
555- .unwrap_or(false);
556- if !open {
557- let _ = this.update(cx, |yumush, _| yumush.desk.clients_task = None);
558- break;
559- }
560- if let Ok(clients) = network.call(ListUpdateClients).await {
561- let _ = this.update(cx, |yumush, cx| {
562- yumush.desk.clients = clients;
563- cx.notify();
564- });
565- }
566- cx.background_executor().timer(CLIENTS_TICK).await;
567- }
568- }));
569- }
570-
571449 pub(super) fn pick_release_source(&self, window: &mut Window, cx: &mut Context<Self>) {
572450 let picked = cx.prompt_for_paths(PathPromptOptions {
573451 files: false,
crates/client/src/gui/builder/users.rsmodified+120 -5
@@ -1,12 +1,13 @@
11 use common::model::Id;
2-use std::future::Future;
2+use std::{future::Future, time::Duration};
33
44 use common::{
55 call::{
6- BanUser, ClearProfile, CreateUser, DeleteUser, FollowStats, ListSessions, PurgeUser,
7- RenameUser, ResetPassword, RevokeSession, RevokeSessions, SuspendUser, TimeoutUser,
6+ BanUser, ClearProfile, CreateUser, DeleteUser, FollowStats, ListSessions,
7+ ListUpdateClients, PurgeUser, RenameUser, ResetPassword, RevokeSession, RevokeSessions,
8+ SuspendUser, TimeoutUser,
89 },
9- model::{Account, BanScope, Role, SessionInfo, User},
10+ model::{Account, BanScope, Role, SessionInfo, UpdateClient, UpdateState, User},
1011 permission,
1112 stats::Stats,
1213 time::{DAY_MILLIS, HOUR_MILLIS, MINUTE_MILLIS, now_ms},
@@ -21,11 +22,15 @@ use gpui_kit::{
2122 px,
2223 };
2324
25+use super::BuilderTab;
26+use super::releases::{caption_text, meter};
2427 use super::ui::{action_button, action_group, card, confirm_button, confirmed, pill};
2528 use crate::lang::w;
2629 use crate::{
2730 gui::{
28- Palette, Tooltip as _, Yumush, avatar, clickable, entity_action, millis_time, notify_error,
31+ Palette, Tooltip as _, Yumush, avatar,
32+ chat::View,
33+ clickable, entity_action, millis_time, notify_error,
2934 parts::{self, Press},
3035 profile::user_link,
3136 style::{radius, size, space, text},
@@ -36,6 +41,7 @@ use crate::{
3641 };
3742
3843 const FRIENDS_MAX_H: f32 = 200.;
44+const CLIENTS_TICK: Duration = Duration::from_secs(1);
3945 const MINUTES_PER_HOUR: u64 = HOUR_MILLIS / MINUTE_MILLIS;
4046 const MINUTES_PER_DAY: u64 = DAY_MILLIS / MINUTE_MILLIS;
4147
@@ -249,10 +255,43 @@ impl Yumush {
249255 .is_some_and(|(open, _)| *open == user_id)
250256 {
251257 self.chat.builder_sessions = None;
258+ self.chat.builder_clients.clear();
259+ self.chat.builder_clients_task = None;
252260 cx.notify();
253261 return;
254262 }
255263 self.load_sessions(user_id, window, cx);
264+ self.chat.builder_clients.clear();
265+ self.watch_builder_clients(user_id, cx);
266+ }
267+
268+ fn watch_builder_clients(&mut self, user_id: Id, cx: &mut Context<Self>) {
269+ let network = self.network.clone();
270+ self.chat.builder_clients_task = Some(cx.spawn(async move |this, cx| {
271+ loop {
272+ let open = this
273+ .update(cx, |yumush, _| {
274+ yumush.chat.view == View::Builder
275+ && yumush.chat.builder_tab == BuilderTab::Users
276+ && yumush
277+ .chat
278+ .builder_sessions
279+ .as_ref()
280+ .is_some_and(|(open, _)| *open == user_id)
281+ })
282+ .unwrap_or(false);
283+ if !open {
284+ break;
285+ }
286+ if let Ok(clients) = network.call(ListUpdateClients { user_id }).await {
287+ let _ = this.update(cx, |yumush, cx| {
288+ yumush.chat.builder_clients = clients;
289+ cx.notify();
290+ });
291+ }
292+ cx.background_executor().timer(CLIENTS_TICK).await;
293+ }
294+ }));
256295 }
257296
258297 pub(super) fn revoke_builder_session(
@@ -667,6 +706,68 @@ impl Yumush {
667706 .child(revoke_button)
668707 }
669708
709+ fn builder_client_row(&self, client: &UpdateClient, palette: Palette) -> Div {
710+ let release = match (client.release, client.target.as_deref()) {
711+ (Some(seq), Some(target)) => format!("#{seq} · {target}"),
712+ _ => w().builder_users.unknown.to_string(),
713+ };
714+ let state = match client.state {
715+ UpdateState::Unknown => caption_text(w().builder_users.dev, palette.muted),
716+ UpdateState::Latest => caption_text(w().builder_users.latest, palette.ok),
717+ UpdateState::Available { required, .. } => caption_text(
718+ if required {
719+ format!(
720+ "{} · {}",
721+ w().builder_users.available,
722+ w().builder_users.required
723+ )
724+ } else {
725+ w().builder_users.available.to_string()
726+ },
727+ palette.muted,
728+ ),
729+ UpdateState::Downloading { percent, .. } => {
730+ meter(f32::from(percent) / 100., format!("{percent}%"), palette)
731+ }
732+ UpdateState::Installing { .. } => {
733+ caption_text(w().builder_users.installing, palette.muted)
734+ }
735+ UpdateState::Ready { .. } => caption_text(w().builder_users.ready, palette.ok),
736+ UpdateState::Failed { .. } => caption_text(w().builder_users.failed, palette.danger),
737+ };
738+ let dot = div()
739+ .size(px(space::SM))
740+ .flex_shrink_0()
741+ .rounded_full()
742+ .bg(if client.online {
743+ palette.ok
744+ } else {
745+ palette.muted
746+ });
747+ let seen =
748+ (!client.online).then(|| caption_text(seen_text(Some(client.seen_ms)), palette.muted));
749+
750+ div()
751+ .w_full()
752+ .h(px(size::CONTROL_SM))
753+ .flex()
754+ .items_center()
755+ .gap(px(space::SM))
756+ .child(crate::gui::parts::small_icon(IconName::Monitor).text_color(palette.muted))
757+ .child(
758+ div()
759+ .flex_1()
760+ .text_size(text(text::CAPTION))
761+ .min_w_0()
762+ .truncate()
763+ .child(client.device.clone()),
764+ )
765+ .child(caption_text(release, palette.muted))
766+ .child(state)
767+ .child(dot)
768+ .children(seen)
769+ }
770+
670771 pub(super) fn builder_rename_row(
671772 &self,
672773 user_id: Id,
@@ -1050,6 +1151,15 @@ impl Yumush {
10501151 .into_any_element()
10511152 })
10521153 .collect();
1154+ let clients: Vec<AnyElement> = if self.chat.builder_clients.is_empty() {
1155+ vec![caption_text(w().builder_users.no_clients, palette.muted).into_any_element()]
1156+ } else {
1157+ self.chat
1158+ .builder_clients
1159+ .iter()
1160+ .map(|client| self.builder_client_row(client, palette).into_any_element())
1161+ .collect()
1162+ };
10531163
10541164 div()
10551165 .flex()
@@ -1089,6 +1199,11 @@ impl Yumush {
10891199 palette,
10901200 sessions,
10911201 ))
1202+ .children(action_group(
1203+ w().builder_users.group_clients,
1204+ palette,
1205+ clients,
1206+ ))
10921207 .children(action_group(
10931208 w().builder_users.group_friends,
10941209 palette,
crates/client/src/gui/chat.rsmodified+8 -1
@@ -43,7 +43,8 @@ use common::{
4343 Account, AdminActionKind, AdminLogEntry, AttachmentInfo, Ban, BanScope, CallLog, Community,
4444 CommunityKind, CommunitySummary, CommunityUsage, DayStat, Edit, Friends, Id, Invitation,
4545 InviteCode, LogEntry, Member, Message, MessageHit, Overview, Presence, Rank, Reply, Report,
46- ReportStatus, ServerBan, SessionInfo, Unread, Usage, User, VoiceRoom, mentions,
46+ ReportStatus, ServerBan, SessionInfo, Unread, UpdateClient, Usage, User, VoiceRoom,
47+ mentions,
4748 },
4849 permission,
4950 share::{Kind, Share},
@@ -198,6 +199,8 @@ pub struct Chat {
198199 pub(super) pending_builder_password: Option<Id>,
199200 pub(super) builder_password: Entity<InputState>,
200201 pub(super) builder_sessions: Option<(Id, Vec<SessionInfo>)>,
202+ pub(super) builder_clients: Vec<UpdateClient>,
203+ pub(super) builder_clients_task: Option<Task<()>>,
201204 pub(super) builder_friends: Vec<User>,
202205 pub(super) pending_builder_rename: Option<Id>,
203206 pub(super) builder_rename: Entity<InputState>,
@@ -543,6 +546,8 @@ impl Chat {
543546 new_password,
544547 pending_builder_password: None,
545548 builder_sessions: None,
549+ builder_clients: Vec::new(),
550+ builder_clients_task: None,
546551 builder_friends: Vec::new(),
547552 pending_builder_rename: None,
548553 builder_rename: new_input(w().chat.new_username, window, cx),
@@ -1253,6 +1258,8 @@ impl Chat {
12531258 self.pending_builder_delete = None;
12541259 self.pending_builder_password = None;
12551260 self.builder_sessions = None;
1261+ self.builder_clients.clear();
1262+ self.builder_clients_task = None;
12561263 self.pending_builder_rename = None;
12571264 self.pending_builder_timeout = None;
12581265 self.pending_builder_ban = None;
crates/client/src/release.rsmodified+34 -12
@@ -42,6 +42,8 @@ pub enum Event {
4242 Done,
4343 }
4444
45+const TREE: &str = "target/release-src";
46+const ARCHIVE: &str = "dist/source.tgz";
4547 const VM: &str = "yumush-win";
4648 const TARGET: &str = "yumush@127.0.0.1";
4749 const PORT: &str = "2222";
@@ -148,7 +150,7 @@ fn preflight(source: &Path) -> Result<Vm, String> {
148150 if !dirty.stdout.is_empty() {
149151 return Err("uncommitted changes".into());
150152 }
151- fs::create_dir_all(source.join("dist")).map_err(|e| e.to_string())?;
153+ snapshot(source)?;
152154 if !podman_ok(&["container", "exists", VM]) {
153155 return Ok(Vm::Missing);
154156 }
@@ -212,6 +214,31 @@ fn toml_text(cpu: &str) -> String {
212214 )
213215 }
214216
217+fn snapshot(source: &Path) -> Result<(), String> {
218+ let tree = source.join(TREE);
219+ if tree.exists() {
220+ fs::remove_dir_all(&tree).map_err(|e| e.to_string())?;
221+ }
222+ fs::create_dir_all(&tree).map_err(|e| e.to_string())?;
223+ fs::create_dir_all(source.join("dist")).map_err(|e| e.to_string())?;
224+ let tgz = source.join(ARCHIVE);
225+ check(
226+ Command::new("git")
227+ .arg("-C")
228+ .arg(source)
229+ .args(["archive", "--format=tar.gz", "-o"])
230+ .arg(&tgz)
231+ .arg("HEAD"),
232+ )?;
233+ check(
234+ Command::new("tar")
235+ .arg("xzf")
236+ .arg(&tgz)
237+ .arg("-C")
238+ .arg(&tree),
239+ )
240+}
241+
215242 fn build_linux(job: Job, level: Level, source: &Path, cx: &Cx) -> Result<(), String> {
216243 let (name, cpu) = flags(level);
217244 fs::write(
@@ -220,11 +247,11 @@ fn build_linux(job: Job, level: Level, source: &Path, cx: &Cx) -> Result<(), Str
220247 )
221248 .map_err(|e| e.to_string())?;
222249 let mut cmd = Command::new("cargo");
223- cmd.current_dir(source)
250+ cmd.current_dir(source.join(TREE))
224251 .args(["build", "--release", "-p", "client", "--target-dir"])
225- .arg(format!("target/release-{name}"))
252+ .arg(source.join(format!("target/release-{name}")))
226253 .arg("--config")
227- .arg(format!("dist/{name}.toml"))
254+ .arg(source.join(format!("dist/{name}.toml")))
228255 .env("CARGO_TERM_PROGRESS_WHEN", "always")
229256 .env("CARGO_TERM_PROGRESS_WIDTH", "200")
230257 .env("CARGO_TERM_COLOR", "never")
@@ -243,16 +270,11 @@ fn build_linux(job: Job, level: Level, source: &Path, cx: &Cx) -> Result<(), Str
243270
244271 fn start_windows(job: Job, source: &Path, key: &Path, cx: &Cx) -> Result<(), String> {
245272 wait_ssh(job, key, cx)?;
246- let tgz = source.join("dist/source.tgz");
247273 check(
248- Command::new("git")
249- .arg("-C")
250- .arg(source)
251- .args(["archive", "--format=tar.gz", "-o"])
252- .arg(&tgz)
253- .arg("HEAD"),
274+ scp(key)
275+ .arg(source.join(ARCHIVE))
276+ .arg(format!("{TARGET}:release.tgz")),
254277 )?;
255- check(scp(key).arg(&tgz).arg(format!("{TARGET}:release.tgz")))?;
256278 stream(&mut ps(key, EXTRACT), job, cx)?;
257279 cx.send(Event::Finished(job));
258280 Ok(())
crates/common/src/call.rsmodified+3 -1
@@ -629,7 +629,9 @@ pub struct ListBackups;
629629 pub struct ListReleases;
630630
631631 #[derive(Debug, Clone, Encode, Decode)]
632-pub struct ListUpdateClients;
632+pub struct ListUpdateClients {
633+ pub user_id: Id,
634+}
633635
634636 #[derive(Debug, Clone, Encode, Decode)]
635637 pub struct PublishRelease {
crates/common/src/model.rsmodified+0 -1
@@ -467,7 +467,6 @@ pub enum UpdateState {
467467
468468 #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]
469469 pub struct UpdateClient {
470- pub user: Option<String>,
471470 pub device: String,
472471 pub release: Option<u64>,
473472 pub target: Option<String>,
crates/server/src/call/release.rsmodified+3 -1
@@ -42,11 +42,13 @@ impl Handle for ListUpdateClients {
4242 let online = cx.sh.services.hub.installs();
4343 let mut clients = Vec::new();
4444 for (install, seen) in cx.sh.releases.recent() {
45+ if seen.user != Some(self.user_id) {
46+ continue;
47+ }
4548 let (release, target) = db::release::of_file(&seen.build, cx.db)
4649 .await?
4750 .map_or((None, None), |(seq, target)| (Some(seq), Some(target)));
4851 clients.push(UpdateClient {
49- user: seen.user,
5052 device: seen.device,
5153 release,
5254 target,
crates/server/src/update.rsmodified+7 -7
@@ -8,7 +8,7 @@ use std::{
88 use common::{
99 error::{Error as CommonError, ReleaseProblem},
1010 frame::{self, DOWN_MAX, Sending, UP_MAX},
11- model::{Staged, UpdateState, User},
11+ model::{Id, Staged, UpdateState, User},
1212 open::Stage,
1313 permission,
1414 time::now_ms,
@@ -42,7 +42,7 @@ fn pack(bytes: &[u8], path: &Path) -> std::io::Result<u64> {
4242
4343 #[derive(Clone)]
4444 pub struct Seen {
45- pub user: Option<String>,
45+ pub user: Option<Id>,
4646 pub device: String,
4747 pub build: Sha,
4848 pub state: UpdateState,
@@ -74,9 +74,9 @@ impl Releases {
7474 })
7575 }
7676
77- pub fn record(&self, me: &Me, user: Option<String>, state: UpdateState) {
77+ pub fn record(&self, me: &Me, user: Option<Id>, state: UpdateState) {
7878 let mut board = self.board.lock().unwrap();
79- let user = user.or_else(|| board.get(&me.install).and_then(|seen| seen.user.clone()));
79+ let user = user.or_else(|| board.get(&me.install).and_then(|seen| seen.user));
8080 board.insert(
8181 me.install,
8282 Seen {
@@ -245,7 +245,7 @@ impl Releases {
245245 if percent != shown {
246246 shown = percent;
247247 let state = UpdateState::Downloading { seq, percent };
248- self.record(&me, user.clone(), state);
248+ self.record(&me, user, state);
249249 }
250250 }
251251 }
@@ -271,13 +271,13 @@ impl Releases {
271271 }
272272 }
273273
274-async fn who(me: &Me, db: &Db) -> Option<String> {
274+async fn who(me: &Me, db: &Db) -> Option<Id> {
275275 let token = me.token.clone()?;
276276
277277 db.run(async |conn| authentication::resume(&token, conn).await)
278278 .await
279279 .ok()
280- .map(|(_, user)| user.username)
280+ .map(|(_, user)| user.id)
281281 }
282282
283283 fn state_of(status: Status) -> UpdateState {