forge
Explore
Log in

Don't you dare go Hollow

Tabbed pages keep one head height, so switching Settings or Admin tabs no longer moves the tabs or the sheet

Browse files at this commit

f708a8c20df948ce8a9cfb4654b0816c66e1e49dAhmet Kaan GümüşParent: 41ee476
All checks have passed
Show checks
  • style
    • tabbed pages keep one head height, so switching Settings or Admin tabs no longer moves the tabs or the sheet
    • rows that only held facts and actions are one flat line with their actions beside the facts and a confirm that opens in place (tokens, SSH and GPG keys, push devices, secrets, packages, mail, merge queue, branches, tags, advisories, sessions)
    • Security shows password and email directly and lists sessions with Revoke on each line, and the security log sits in the Security rail
    • every control has one focus ring inside its own edge
    • colours offer five presets and a Custom chip with its word, on the same columns in both rows
    • Run alerts previews stand on the switch's middle line
    • the CI log keeps line numbers on one line, the run and job pages fit the window with the log scrolling inside, and the job head reads Run #N with a plain state
    • passed is one green everywhere in CI, taken from the accent's lightness and strength, and the Log and Timeline switch marks its current tab like any other
    • the admin organization page lists its members with links and puts Open profile in the head
    • a one-field form sends from beside its field
    • the snippet form's files are one row on the fields' edge
    • the profile menu's name opens your profile in place of a Your profile row
    • every pager, numbered or not, is the same row on the sheet's inset ✨ feat: the path bar names every place above a page as a link (repo sections, #N items, a job's run, Keys above GPG keys and tokens, Users above an account, Snippets above a snippet), so no page needs the browser's Back button
    • the audit log has numbered pages, folds repeats into one line with ×N, and reads as words in English and Turkish, with every action, target kind, detail and role named in both ♻️ refactor: the Spark and Gold accents and the Spark background are gone, and accounts that chose them fall back to the default
    • old session addresses redirect to Security 🐛 fix: branch rows keep the commit subject on the row's line
    • edit history titles read "of the issue description"
Show full message
💄 style: tabbed pages keep one head height, so switching Settings or Admin tabs no longer moves the tabs or the sheet; rows that only held facts and actions are one flat line with their actions beside the facts and a confirm that opens in place (tokens, SSH and GPG keys, push devices, secrets, packages, mail, merge queue, branches, tags, advisories, sessions); Security shows password and email directly and lists sessions with Revoke on each line, and the security log sits in the Security rail; every control has one focus ring inside its own edge; colours offer five presets and a Custom chip with its word, on the same columns in both rows; Run alerts previews stand on the switch's middle line; the CI log keeps line numbers on one line, the run and job pages fit the window with the log scrolling inside, and the job head reads Run #N with a plain state; passed is one green everywhere in CI, taken from the accent's lightness and strength, and the Log and Timeline switch marks its current tab like any other; the admin organization page lists its members with links and puts Open profile in the head; a one-field form sends from beside its field; the snippet form's files are one row on the fields' edge; the profile menu's name opens your profile in place of a Your profile row; every pager, numbered or not, is the same row on the sheet's inset ✨ feat: the path bar names every place above a page as a link (repo sections, #N items, a job's run, Keys above GPG keys and tokens, Users above an account, Snippets above a snippet), so no page needs the browser's Back button; the audit log has numbered pages, folds repeats into one line with ×N, and reads as words in English and Turkish, with every action, target kind, detail and role named in both ♻️ refactor: the Spark and Gold accents and the Spark background are gone, and accounts that chose them fall back to the default; old session addresses redirect to Security 🐛 fix: branch rows keep the commit subject on the row's line; edit history titles read "of the issue description"

34 changed files +1908 -815

crates/forge-core/src/store/audit.rsmodified+70 -35
@@ -2,7 +2,7 @@
22
33 use turso::{Row, Value};
44
5-use super::{Store, col_opt_text, col_text, db_err, fetch_all};
5+use super::{Store, col_int, col_opt_text, col_text, db_err, fetch_all, fetch_opt};
66 use crate::audit::{AuditAction, AuditCursor, AuditEntry, AuditFilter};
77 use crate::error::{Error, Result};
88
@@ -28,6 +28,46 @@ fn map_audit(row: &Row) -> Result<AuditEntry> {
2828 })
2929 }
3030
31+/// The WHERE clause and its parameters for `filter` and an optional cursor, shared by the
32+/// listings and the count so they select the same entries.
33+fn audit_where(filter: &AuditFilter, before: Option<&AuditCursor>) -> (String, Vec<Value>) {
34+ let mut clauses: Vec<&str> = Vec::new();
35+ let mut params: Vec<Value> = Vec::new();
36+ if let Some(actor) = &filter.actor_id {
37+ clauses.push("actor_id = ?");
38+ params.push(Value::Text(actor.clone()));
39+ }
40+ if let Some(action) = filter.action {
41+ clauses.push("action = ?");
42+ params.push(Value::Text(action.as_str().to_string()));
43+ }
44+ if let Some(kind) = &filter.target_kind {
45+ clauses.push("target_kind = ?");
46+ params.push(Value::Text(kind.clone()));
47+ }
48+ if let Some(id) = &filter.target_id {
49+ clauses.push("target_id = ?");
50+ params.push(Value::Text(id.clone()));
51+ }
52+ if let Some(user) = &filter.involving_user {
53+ clauses.push("(actor_id = ? OR (target_kind = 'user' AND target_id = ?))");
54+ params.push(Value::Text(user.clone()));
55+ params.push(Value::Text(user.clone()));
56+ }
57+ if let Some(cursor) = before {
58+ clauses.push("(at < ? OR (at = ? AND id < ?))");
59+ params.push(Value::Text(cursor.at.clone()));
60+ params.push(Value::Text(cursor.at.clone()));
61+ params.push(Value::Text(cursor.id.clone()));
62+ }
63+ let where_sql = if clauses.is_empty() {
64+ String::new()
65+ } else {
66+ format!("WHERE {}", clauses.join(" AND "))
67+ };
68+ (where_sql, params)
69+}
70+
3171 impl Store {
3272 /// Appends one entry. Nothing else in the store writes to `audit_log`.
3373 pub async fn record_audit(&self, entry: &AuditEntry) -> Result<()> {
@@ -66,40 +106,7 @@ impl Store {
66106 before: Option<&AuditCursor>,
67107 limit: u32,
68108 ) -> Result<Vec<AuditEntry>> {
69- let mut clauses: Vec<&str> = Vec::new();
70- let mut params: Vec<Value> = Vec::new();
71- if let Some(actor) = &filter.actor_id {
72- clauses.push("actor_id = ?");
73- params.push(Value::Text(actor.clone()));
74- }
75- if let Some(action) = filter.action {
76- clauses.push("action = ?");
77- params.push(Value::Text(action.as_str().to_string()));
78- }
79- if let Some(kind) = &filter.target_kind {
80- clauses.push("target_kind = ?");
81- params.push(Value::Text(kind.clone()));
82- }
83- if let Some(id) = &filter.target_id {
84- clauses.push("target_id = ?");
85- params.push(Value::Text(id.clone()));
86- }
87- if let Some(user) = &filter.involving_user {
88- clauses.push("(actor_id = ? OR (target_kind = 'user' AND target_id = ?))");
89- params.push(Value::Text(user.clone()));
90- params.push(Value::Text(user.clone()));
91- }
92- if let Some(cursor) = before {
93- clauses.push("(at < ? OR (at = ? AND id < ?))");
94- params.push(Value::Text(cursor.at.clone()));
95- params.push(Value::Text(cursor.at.clone()));
96- params.push(Value::Text(cursor.id.clone()));
97- }
98- let where_sql = if clauses.is_empty() {
99- String::new()
100- } else {
101- format!("WHERE {}", clauses.join(" AND "))
102- };
109+ let (where_sql, mut params) = audit_where(filter, before);
103110 let sql = format!(
104111 "SELECT {AUDIT_COLS} FROM audit_log {where_sql} ORDER BY at DESC, id DESC LIMIT ?"
105112 );
@@ -108,6 +115,34 @@ impl Store {
108115 fetch_all(&conn, &sql, params, map_audit).await
109116 }
110117
118+ /// Entries matching `filter` in the same order as [`Store::list_audit`], skipping `offset`
119+ /// entries first. For numbered pages. `limit` is clamped to 1..=200.
120+ pub async fn list_audit_page(
121+ &self,
122+ filter: &AuditFilter,
123+ offset: u32,
124+ limit: u32,
125+ ) -> Result<Vec<AuditEntry>> {
126+ let (where_sql, mut params) = audit_where(filter, None);
127+ let sql = format!(
128+ "SELECT {AUDIT_COLS} FROM audit_log {where_sql} ORDER BY at DESC, id DESC \
129+ LIMIT ? OFFSET ?"
130+ );
131+ params.push(Value::Integer(i64::from(limit.clamp(1, MAX_AUDIT_PAGE))));
132+ params.push(Value::Integer(i64::from(offset)));
133+ let conn = self.read_conn().await;
134+ fetch_all(&conn, &sql, params, map_audit).await
135+ }
136+
137+ /// How many entries match `filter`, for the page count.
138+ pub async fn count_audit(&self, filter: &AuditFilter) -> Result<u64> {
139+ let (where_sql, params) = audit_where(filter, None);
140+ let sql = format!("SELECT COUNT(*) FROM audit_log {where_sql}");
141+ let conn = self.read_conn().await;
142+ let count = fetch_opt(&conn, &sql, params, |row| col_int(row, 0)).await?;
143+ Ok(count.unwrap_or(0).max(0) as u64)
144+ }
145+
111146 /// Retention: deletes entries stamped before `cutoff` (an RFC 3339 UTC stamp). Returns the
112147 /// number of entries removed. This is the only delete on the audit log.
113148 pub async fn purge_audit_before(&self, cutoff: &str) -> Result<u64> {
crates/forge-e2e/tests/e2e/orgs_ui_e2e.rsmodified+2 -2
@@ -469,14 +469,14 @@ async fn org_settings_delete_and_audit_end_to_end() {
469469 .await;
470470 assert_eq!(audit.status, 200, "audit page");
471471 assert!(
472- audit.body.contains("<code>org_settings_updated</code>"),
472+ audit.body.contains("title=\"org_settings_updated\""),
473473 "settings change is audited"
474474 );
475475 let audit = http
476476 .get("/admin/audit?action=org_deleted", Some(&root_session))
477477 .await;
478478 assert!(
479- audit.body.contains("<code>org_deleted</code>"),
479+ audit.body.contains("title=\"org_deleted\""),
480480 "org deletion is audited"
481481 );
482482 }
crates/forge-e2e/tests/e2e/section_nav_e2e.rsmodified+1 -2
@@ -201,12 +201,11 @@ async fn settings_pages_get_the_settings_tabs() {
201201 "/settings/keys",
202202 "/settings/export",
203203 ];
204- // A page folded into another tab marks that tab: sessions under security, GPG keys and
204+ // A page folded into another tab marks that tab: GPG keys and
205205 // tokens under keys.
206206 let pages = [
207207 ("/settings/profile", "/settings/profile"),
208208 ("/settings/keys", "/settings/keys"),
209- ("/settings/sessions", "/settings/security"),
210209 ("/settings/security", "/settings/security"),
211210 ("/settings/notifications", "/settings/notifications"),
212211 ("/settings/appearance", "/settings/appearance"),
crates/forge-e2e/tests/e2e/ui_prefs_e2e.rsmodified+10 -10
@@ -267,14 +267,14 @@ async fn light_and_dark_colours_save_independently_and_render_on_html() {
267267 ("csrf", &csrf),
268268 ("theme", "light"),
269269 ("language", "en"),
270- ("base_dark", "spark"),
270+ ("base_dark", "graphite"),
271271 ],
272272 Some(&session),
273273 )
274274 .await;
275275 assert_eq!(saved.status, 303, "save: {}", saved.body);
276276 let page = env.http.get("/settings/appearance", Some(&session)).await;
277- let chosen = ["ocean", "plum", "ink", "spark"].map(str::to_owned);
277+ let chosen = ["ocean", "plum", "ink", "graphite"].map(str::to_owned);
278278 assert_eq!(checked_colours(&page.body), chosen.clone().map(Some));
279279 assert_eq!(html_colours(&page.body), chosen.map(Some));
280280
@@ -300,7 +300,7 @@ async fn light_and_dark_colours_save_independently_and_render_on_html() {
300300 assert_ne!(res.status, 303, "bad {field} {bad:?} must not save");
301301 }
302302 let page = env.http.get("/settings/appearance", Some(&session)).await;
303- let chosen = ["ocean", "plum", "ink", "spark"].map(str::to_owned);
303+ let chosen = ["ocean", "plum", "ink", "graphite"].map(str::to_owned);
304304 assert_eq!(checked_colours(&page.body), chosen.clone().map(Some));
305305 assert_eq!(html_colours(&page.body), chosen.map(Some));
306306
@@ -314,8 +314,8 @@ async fn light_and_dark_colours_save_independently_and_render_on_html() {
314314 ("theme", "light"),
315315 ("language", "tr"),
316316 ("accent_light", "hue-200"),
317- ("accent_dark", "gold"),
318- ("base_light", "spark"),
317+ ("accent_dark", "rose"),
318+ ("base_light", "graphite"),
319319 ("base_dark", "dusk"),
320320 ],
321321 Some(&session),
@@ -324,9 +324,9 @@ async fn light_and_dark_colours_save_independently_and_render_on_html() {
324324 assert_eq!(saved.status, 303, "save: {}", saved.body);
325325 let page = env.http.get("/settings/appearance", Some(&session)).await;
326326 // The Custom radio carries the hue at the default vividness; the stored id stays `hue-200`.
327- let checked = ["hue-200-v50", "gold", "spark", "dusk"].map(str::to_owned);
327+ let checked = ["hue-200-v50", "rose", "graphite", "dusk"].map(str::to_owned);
328328 assert_eq!(checked_colours(&page.body), checked.map(Some));
329- let chosen = ["hue-200", "gold", "spark", "dusk"].map(str::to_owned);
329+ let chosen = ["hue-200", "rose", "graphite", "dusk"].map(str::to_owned);
330330 assert_eq!(html_colours(&page.body), chosen.map(Some));
331331
332332 // The newest accents and backgrounds save and show the same way.
@@ -369,16 +369,16 @@ async fn a_save_without_colour_fields_keeps_the_stored_colours() {
369369 ("theme", "light"),
370370 ("language", "en"),
371371 ("accent_light", "rose"),
372- ("accent_dark", "gold"),
372+ ("accent_dark", "ocean"),
373373 ("base_light", "fern"),
374- ("base_dark", "spark"),
374+ ("base_dark", "dusk"),
375375 ],
376376 Some(&session),
377377 )
378378 .await;
379379 assert_eq!(saved.status, 303, "save: {}", saved.body);
380380 let before = env.http.get("/settings/appearance", Some(&session)).await;
381- let stored = ["rose", "gold", "fern", "spark"].map(str::to_owned);
381+ let stored = ["rose", "ocean", "fern", "dusk"].map(str::to_owned);
382382 assert_eq!(html_colours(&before.body), stored.clone().map(Some));
383383
384384 let saved = env
crates/forge-e2e/tests/e2e/wiki_e2e.rsmodified+1 -1
@@ -242,7 +242,7 @@ async fn wiki_end_to_end() {
242242 .await;
243243 assert_eq!(audit.status, 200, "audit page");
244244 assert!(
245- audit.body.contains("<code>wiki_pushed</code>"),
245+ audit.body.contains("title=\"wiki_pushed\""),
246246 "the wiki push is audited: {}",
247247 audit.body
248248 );
crates/forge-web-base/src/accent.rsmodified+16 -8
@@ -310,16 +310,24 @@ mod tests {
310310 fn the_presets_are_offered_in_picker_order_and_removed_ids_are_not() {
311311 assert_eq!(
312312 ids().collect::<Vec<_>>(),
313- ["ember", "sage", "spark", "ocean", "plum", "rose", "gold"]
313+ ["ember", "sage", "ocean", "plum", "rose"]
314314 );
315315 assert_eq!(
316316 base_ids().collect::<Vec<_>>(),
317- ["anvil", "fern", "spark", "graphite", "dusk", "ink"]
317+ ["anvil", "fern", "graphite", "dusk", "ink"]
318318 );
319- for id in ["ochre", "teal", "Sage", "sage ", "terracotta"] {
319+ for id in [
320+ "ochre",
321+ "teal",
322+ "Sage",
323+ "sage ",
324+ "terracotta",
325+ "spark",
326+ "gold",
327+ ] {
320328 assert!(!is_offered(id), "{id}");
321329 }
322- for id in ["stone", "mist", "Fern", "dune", "slate-blue"] {
330+ for id in ["stone", "mist", "Fern", "dune", "slate-blue", "spark"] {
323331 assert!(!is_offered_base(id), "{id}");
324332 }
325333 }
@@ -372,11 +380,11 @@ mod tests {
372380 fn preset_hues_come_from_the_colour() {
373381 assert_eq!(preset_accent_hue("sage"), Some(149));
374382 assert_eq!(preset_accent_hue("ocean"), Some(240));
375- assert_eq!(preset_accent_hue("spark"), Some(42));
383+ assert_eq!(preset_accent_hue("plum"), Some(300));
376384 assert_eq!(preset_accent_hue("fern"), None);
377385 assert_eq!(preset_accent_hue("hue-5"), None);
378386 assert!(preset_base_hue("fern").is_some());
379- assert!(preset_base_hue("spark").is_some());
387+ assert!(preset_base_hue("dusk").is_some());
380388 assert_eq!(preset_base_hue("sage"), None);
381389 }
382390
@@ -406,8 +414,8 @@ mod tests {
406414 Some("/theme/custom.css?al=hue-215&ad=plum&bl=fern&bd=hue-7")
407415 );
408416 assert_eq!(
409- custom_css_href("sage", "sage", "spark", "hue-0").as_deref(),
410- Some("/theme/custom.css?al=sage&ad=sage&bl=spark&bd=hue-0")
417+ custom_css_href("sage", "sage", "ink", "hue-0").as_deref(),
418+ Some("/theme/custom.css?al=sage&ad=sage&bl=ink&bd=hue-0")
411419 );
412420 }
413421
crates/forge-web-base/src/accent_palette.rsmodified+0 -88
@@ -141,34 +141,6 @@ pub const PALETTES: &[Palette] = &[
141141 hunk_text: "#B3C385",
142142 },
143143 },
144- // Flare orange: a bright, clean orange on plain neutral greys.
145- Palette {
146- id: "spark",
147- light: Tokens {
148- accent: "#E8590C",
149- accent_ink: "#A83A07",
150- accent_soft: "#FDE9DB",
151- accent_text: "#18181B",
152- focus: "#A83A07",
153- public_bg: "#FDE9DB",
154- public_text: "#A83A07",
155- note: "#A83A07",
156- hunk_bg: "#FEF4EC",
157- hunk_text: "#9C3606",
158- },
159- dark: Tokens {
160- accent: "#FF7A1A",
161- accent_ink: "#FF9A4D",
162- accent_soft: "#3B2214",
163- accent_text: "#18181B",
164- focus: "#FF7A1A",
165- public_bg: "#3B2214",
166- public_text: "#FF9A4D",
167- note: "#FF9A4D",
168- hunk_bg: "#2A1A10",
169- hunk_text: "#FF7A1A",
170- },
171- },
172144 // Blue, clear and cool.
173145 Palette {
174146 id: "ocean",
@@ -253,34 +225,6 @@ pub const PALETTES: &[Palette] = &[
253225 hunk_text: "#E79DAD",
254226 },
255227 },
256- // Bright yellow, leaning to lemon, so it takes dark text.
257- Palette {
258- id: "gold",
259- light: Tokens {
260- accent: "#D4A017",
261- accent_ink: "#7D5A00",
262- accent_soft: "#F8F0D6",
263- accent_text: "#1F1700",
264- focus: "#7D5A00",
265- public_bg: "#F8F0D6",
266- public_text: "#7D5A00",
267- note: "#7D5A00",
268- hunk_bg: "#FCF8EA",
269- hunk_text: "#7D5A00",
270- },
271- dark: Tokens {
272- accent: "#E8BC4A",
273- accent_ink: "#F5D27A",
274- accent_soft: "#3A2E0E",
275- accent_text: "#1F1700",
276- focus: "#E8BC4A",
277- public_bg: "#3A2E0E",
278- public_text: "#F5D27A",
279- note: "#F5D27A",
280- hunk_bg: "#2A220D",
281- hunk_text: "#E8BC4A",
282- },
283- },
284228 ];
285229
286230 /// The neutral colour tokens one base sets in one theme. The values are CSS colours;
@@ -438,38 +382,6 @@ pub const BASES: &[Base] = &[
438382 ln_text: "#8A959A",
439383 },
440384 },
441- // Spark: plain neutral greys, barely warm.
442- Base {
443- id: "spark",
444- light: BaseTokens {
445- bg: "#FAFAFA",
446- surface: "#FFFFFF",
447- surface_2: "#F0F0F0",
448- text: "#18181B",
449- text_2: "#3F3F46",
450- muted: "#6C6C75",
451- border: "#E4E4E7",
452- border_strong: "#D4D4D8",
453- code_bg: "#F0F0F0",
454- private_bg: "#F0F0F0",
455- private_text: "#3F3F46",
456- ln_text: "#666670",
457- },
458- dark: BaseTokens {
459- bg: "#18181A",
460- surface: "#212124",
461- surface_2: "#2A2A2E",
462- text: "#F4F4F5",
463- text_2: "#D4D4D8",
464- muted: "#A1A1AA",
465- border: "#3A3A40",
466- border_strong: "#4A4A50",
467- code_bg: "#111113",
468- private_bg: "#2A2A2E",
469- private_text: "#D4D4D8",
470- ln_text: "#A1A1AA",
471- },
472- },
473385 // Graphite: a cool neutral grey, flatter than the warmer neutrals.
474386 Base {
475387 id: "graphite",
crates/forge-web-base/src/i18n/audit_names.rsadded+536 -0
@@ -0,0 +1,536 @@
1+//! Display names for audit log entries: the action ids, the target kinds and the detail keys that
2+//! the audit log stores. An id with no name here shows its raw text, and the test below rules that
3+//! out for every action id.
4+
5+use super::Lang;
6+
7+/// The display name of an audit action id, or `None` for an id this table does not know.
8+pub fn action_name(lang: Lang, action: &str) -> Option<&'static str> {
9+ match (action, lang) {
10+ ("login_success", Lang::En) => Some("Signed in"),
11+ ("login_success", Lang::Tr) => Some("Giriş yapıldı"),
12+ ("login_failed", Lang::En) => Some("Sign-in failed"),
13+ ("login_failed", Lang::Tr) => Some("Giriş başarısız"),
14+ ("login_2fa_failed", Lang::En) => Some("Two-factor sign-in failed"),
15+ ("login_2fa_failed", Lang::Tr) => Some("İki adımlı doğrulama başarısız"),
16+ ("logout", Lang::En) => Some("Signed out"),
17+ ("logout", Lang::Tr) => Some("Çıkış yapıldı"),
18+ ("password_changed", Lang::En) => Some("Password changed"),
19+ ("password_changed", Lang::Tr) => Some("Parola değiştirildi"),
20+ ("email_changed", Lang::En) => Some("Email changed"),
21+ ("email_changed", Lang::Tr) => Some("E-posta değiştirildi"),
22+ ("password_reset_by_admin", Lang::En) => Some("Password reset by admin"),
23+ ("password_reset_by_admin", Lang::Tr) => Some("Parola yönetici tarafından sıfırlandı"),
24+ ("totp_enabled", Lang::En) => Some("Two-factor authentication turned on"),
25+ ("totp_enabled", Lang::Tr) => Some("İki adımlı doğrulama açıldı"),
26+ ("totp_disabled", Lang::En) => Some("Two-factor authentication turned off"),
27+ ("totp_disabled", Lang::Tr) => Some("İki adımlı doğrulama kapatıldı"),
28+ ("recovery_codes_regenerated", Lang::En) => Some("Recovery codes regenerated"),
29+ ("recovery_codes_regenerated", Lang::Tr) => Some("Kurtarma kodları yenilendi"),
30+ ("ssh_key_added", Lang::En) => Some("SSH key added"),
31+ ("ssh_key_added", Lang::Tr) => Some("SSH anahtarı eklendi"),
32+ ("ssh_key_removed", Lang::En) => Some("SSH key removed"),
33+ ("ssh_key_removed", Lang::Tr) => Some("SSH anahtarı kaldırıldı"),
34+ ("gpg_key_added", Lang::En) => Some("GPG key added"),
35+ ("gpg_key_added", Lang::Tr) => Some("GPG anahtarı eklendi"),
36+ ("gpg_key_deleted", Lang::En) => Some("GPG key deleted"),
37+ ("gpg_key_deleted", Lang::Tr) => Some("GPG anahtarı silindi"),
38+ ("token_created", Lang::En) => Some("Access token created"),
39+ ("token_created", Lang::Tr) => Some("Erişim belirteci oluşturuldu"),
40+ ("token_revoked", Lang::En) => Some("Access token revoked"),
41+ ("token_revoked", Lang::Tr) => Some("Erişim belirteci iptal edildi"),
42+ ("session_revoked", Lang::En) => Some("Session revoked"),
43+ ("session_revoked", Lang::Tr) => Some("Oturum sonlandırıldı"),
44+ ("user_created", Lang::En) => Some("User created"),
45+ ("user_created", Lang::Tr) => Some("Kullanıcı oluşturuldu"),
46+ ("username_changed", Lang::En) => Some("Username changed"),
47+ ("username_changed", Lang::Tr) => Some("Kullanıcı adı değiştirildi"),
48+ ("user_deleted", Lang::En) => Some("User deleted"),
49+ ("user_deleted", Lang::Tr) => Some("Kullanıcı silindi"),
50+ ("repo_created", Lang::En) => Some("Repository created"),
51+ ("repo_created", Lang::Tr) => Some("Depo oluşturuldu"),
52+ ("repo_deleted", Lang::En) => Some("Repository deleted"),
53+ ("repo_deleted", Lang::Tr) => Some("Depo silindi"),
54+ ("repo_renamed", Lang::En) => Some("Repository renamed"),
55+ ("repo_renamed", Lang::Tr) => Some("Depo yeniden adlandırıldı"),
56+ ("repo_transferred", Lang::En) => Some("Repository transferred"),
57+ ("repo_transferred", Lang::Tr) => Some("Depo devredildi"),
58+ ("repo_transfer_initiated", Lang::En) => Some("Repository transfer started"),
59+ ("repo_transfer_initiated", Lang::Tr) => Some("Depo devri başlatıldı"),
60+ ("repo_transfer_accepted", Lang::En) => Some("Repository transfer accepted"),
61+ ("repo_transfer_accepted", Lang::Tr) => Some("Depo devri kabul edildi"),
62+ ("repo_transfer_declined", Lang::En) => Some("Repository transfer declined"),
63+ ("repo_transfer_declined", Lang::Tr) => Some("Depo devri reddedildi"),
64+ ("repo_transfer_cancelled", Lang::En) => Some("Repository transfer cancelled"),
65+ ("repo_transfer_cancelled", Lang::Tr) => Some("Depo devri iptal edildi"),
66+ ("repo_visibility_changed", Lang::En) => Some("Repository visibility changed"),
67+ ("repo_visibility_changed", Lang::Tr) => Some("Depo görünürlüğü değiştirildi"),
68+ ("collaborator_added", Lang::En) => Some("Collaborator added"),
69+ ("collaborator_added", Lang::Tr) => Some("Ortak eklendi"),
70+ ("collaborator_removed", Lang::En) => Some("Collaborator removed"),
71+ ("collaborator_removed", Lang::Tr) => Some("Ortak kaldırıldı"),
72+ ("collaborator_role_changed", Lang::En) => Some("Collaborator role changed"),
73+ ("collaborator_role_changed", Lang::Tr) => Some("Ortak rolü değiştirildi"),
74+ ("branch_rule_created", Lang::En) => Some("Branch rule created"),
75+ ("branch_rule_created", Lang::Tr) => Some("Dal kuralı oluşturuldu"),
76+ ("branch_rule_updated", Lang::En) => Some("Branch rule updated"),
77+ ("branch_rule_updated", Lang::Tr) => Some("Dal kuralı güncellendi"),
78+ ("branch_rule_deleted", Lang::En) => Some("Branch rule deleted"),
79+ ("branch_rule_deleted", Lang::Tr) => Some("Dal kuralı silindi"),
80+ ("repo_archived", Lang::En) => Some("Repository archived"),
81+ ("repo_archived", Lang::Tr) => Some("Depo arşivlendi"),
82+ ("repo_unarchived", Lang::En) => Some("Repository unarchived"),
83+ ("repo_unarchived", Lang::Tr) => Some("Depo arşivden çıkarıldı"),
84+ ("webhook_created", Lang::En) => Some("Webhook created"),
85+ ("webhook_created", Lang::Tr) => Some("Web kancası oluşturuldu"),
86+ ("webhook_updated", Lang::En) => Some("Webhook updated"),
87+ ("webhook_updated", Lang::Tr) => Some("Web kancası güncellendi"),
88+ ("webhook_deleted", Lang::En) => Some("Webhook deleted"),
89+ ("webhook_deleted", Lang::Tr) => Some("Web kancası silindi"),
90+ ("mirror_created", Lang::En) => Some("Mirror created"),
91+ ("mirror_created", Lang::Tr) => Some("Yansı oluşturuldu"),
92+ ("mirror_updated", Lang::En) => Some("Mirror updated"),
93+ ("mirror_updated", Lang::Tr) => Some("Yansı güncellendi"),
94+ ("mirror_deleted", Lang::En) => Some("Mirror deleted"),
95+ ("mirror_deleted", Lang::Tr) => Some("Yansı silindi"),
96+ ("mirror_sync_failed", Lang::En) => Some("Mirror sync failed"),
97+ ("mirror_sync_failed", Lang::Tr) => Some("Yansı eşitleme başarısız"),
98+ ("backup_started", Lang::En) => Some("Backup started"),
99+ ("backup_started", Lang::Tr) => Some("Yedekleme başlatıldı"),
100+ ("fsck_started", Lang::En) => Some("Integrity check started"),
101+ ("fsck_started", Lang::Tr) => Some("Bütünlük denetimi başlatıldı"),
102+ ("replication_reconcile_started", Lang::En) => Some("Replication reconcile started"),
103+ ("replication_reconcile_started", Lang::Tr) => Some("Çoğaltma uzlaştırması başlatıldı"),
104+ ("ci_secret_set", Lang::En) => Some("CI secret set"),
105+ ("ci_secret_set", Lang::Tr) => Some("CI gizli değeri ayarlandı"),
106+ ("ci_secret_deleted", Lang::En) => Some("CI secret deleted"),
107+ ("ci_secret_deleted", Lang::Tr) => Some("CI gizli değeri silindi"),
108+ ("ci_runner_registered", Lang::En) => Some("CI runner registered"),
109+ ("ci_runner_registered", Lang::Tr) => Some("CI çalıştırıcısı kaydedildi"),
110+ ("ci_runner_deleted", Lang::En) => Some("CI runner deleted"),
111+ ("ci_runner_deleted", Lang::Tr) => Some("CI çalıştırıcısı silindi"),
112+ ("ci_runner_restart_requested", Lang::En) => Some("CI runner restart requested"),
113+ ("ci_runner_restart_requested", Lang::Tr) => {
114+ Some("CI çalıştırıcısının yeniden başlatılması istendi")
115+ }
116+ ("ci_runner_config_changed", Lang::En) => Some("CI runner settings changed"),
117+ ("ci_runner_config_changed", Lang::Tr) => Some("CI çalıştırıcısı ayarları değiştirildi"),
118+ ("ci_registration_token_created", Lang::En) => Some("CI registration token created"),
119+ ("ci_registration_token_created", Lang::Tr) => Some("CI kayıt belirteci oluşturuldu"),
120+ ("advisory_alert_dismissed", Lang::En) => Some("Advisory alert dismissed"),
121+ ("advisory_alert_dismissed", Lang::Tr) => Some("Güvenlik uyarısı kapatıldı"),
122+ ("advisory_alert_reopened", Lang::En) => Some("Advisory alert reopened"),
123+ ("advisory_alert_reopened", Lang::Tr) => Some("Güvenlik uyarısı yeniden açıldı"),
124+ ("ui_prefs_changed", Lang::En) => Some("Display preferences changed"),
125+ ("ui_prefs_changed", Lang::Tr) => Some("Görünüm tercihleri değiştirildi"),
126+ ("discussions_enabled", Lang::En) => Some("Discussions turned on"),
127+ ("discussions_enabled", Lang::Tr) => Some("Tartışmalar açıldı"),
128+ ("discussions_disabled", Lang::En) => Some("Discussions turned off"),
129+ ("discussions_disabled", Lang::Tr) => Some("Tartışmalar kapatıldı"),
130+ ("discussion_created", Lang::En) => Some("Discussion created"),
131+ ("discussion_created", Lang::Tr) => Some("Tartışma oluşturuldu"),
132+ ("discussion_edited", Lang::En) => Some("Discussion edited"),
133+ ("discussion_edited", Lang::Tr) => Some("Tartışma düzenlendi"),
134+ ("discussion_deleted", Lang::En) => Some("Discussion deleted"),
135+ ("discussion_deleted", Lang::Tr) => Some("Tartışma silindi"),
136+ ("discussion_locked", Lang::En) => Some("Discussion locked"),
137+ ("discussion_locked", Lang::Tr) => Some("Tartışma kilitlendi"),
138+ ("discussion_unlocked", Lang::En) => Some("Discussion unlocked"),
139+ ("discussion_unlocked", Lang::Tr) => Some("Tartışmanın kilidi açıldı"),
140+ ("discussion_answered", Lang::En) => Some("Discussion answered"),
141+ ("discussion_answered", Lang::Tr) => Some("Tartışma yanıtlandı"),
142+ ("discussion_comment_created", Lang::En) => Some("Discussion comment posted"),
143+ ("discussion_comment_created", Lang::Tr) => Some("Tartışmaya yorum eklendi"),
144+ ("discussion_comment_edited", Lang::En) => Some("Discussion comment edited"),
145+ ("discussion_comment_edited", Lang::Tr) => Some("Tartışma yorumu düzenlendi"),
146+ ("discussion_comment_deleted", Lang::En) => Some("Discussion comment deleted"),
147+ ("discussion_comment_deleted", Lang::Tr) => Some("Tartışma yorumu silindi"),
148+ ("mail_settings_updated", Lang::En) => Some("Mail settings updated"),
149+ ("mail_settings_updated", Lang::Tr) => Some("E-posta ayarları güncellendi"),
150+ ("mail_test_queued", Lang::En) => Some("Test email queued"),
151+ ("mail_test_queued", Lang::Tr) => Some("Deneme e-postası kuyruğa alındı"),
152+ ("server_settings_updated", Lang::En) => Some("Server settings updated"),
153+ ("server_settings_updated", Lang::Tr) => Some("Sunucu ayarları güncellendi"),
154+ ("server_restarted", Lang::En) => Some("Server restarted"),
155+ ("server_restarted", Lang::Tr) => Some("Sunucu yeniden başlatıldı"),
156+ ("snippet_created", Lang::En) => Some("Snippet created"),
157+ ("snippet_created", Lang::Tr) => Some("Parçacık oluşturuldu"),
158+ ("snippet_updated", Lang::En) => Some("Snippet updated"),
159+ ("snippet_updated", Lang::Tr) => Some("Parçacık güncellendi"),
160+ ("snippet_deleted", Lang::En) => Some("Snippet deleted"),
161+ ("snippet_deleted", Lang::Tr) => Some("Parçacık silindi"),
162+ ("wiki_page_saved", Lang::En) => Some("Wiki page saved"),
163+ ("wiki_page_saved", Lang::Tr) => Some("Wiki sayfası kaydedildi"),
164+ ("wiki_enabled", Lang::En) => Some("Wiki turned on"),
165+ ("wiki_enabled", Lang::Tr) => Some("Wiki açıldı"),
166+ ("wiki_disabled", Lang::En) => Some("Wiki turned off"),
167+ ("wiki_disabled", Lang::Tr) => Some("Wiki kapatıldı"),
168+ ("wiki_pushed", Lang::En) => Some("Wiki pushed"),
169+ ("wiki_pushed", Lang::Tr) => Some("Wiki gönderildi"),
170+ ("org_created", Lang::En) => Some("Organization created"),
171+ ("org_created", Lang::Tr) => Some("Kuruluş oluşturuldu"),
172+ ("org_deleted", Lang::En) => Some("Organization deleted"),
173+ ("org_deleted", Lang::Tr) => Some("Kuruluş silindi"),
174+ ("org_settings_updated", Lang::En) => Some("Organization settings updated"),
175+ ("org_settings_updated", Lang::Tr) => Some("Kuruluş ayarları güncellendi"),
176+ ("org_member_added", Lang::En) => Some("Organization member added"),
177+ ("org_member_added", Lang::Tr) => Some("Kuruluşa üye eklendi"),
178+ ("org_member_removed", Lang::En) => Some("Organization member removed"),
179+ ("org_member_removed", Lang::Tr) => Some("Kuruluş üyesi çıkarıldı"),
180+ ("org_member_role_changed", Lang::En) => Some("Organization member role changed"),
181+ ("org_member_role_changed", Lang::Tr) => Some("Kuruluş üyesinin rolü değiştirildi"),
182+ ("team_created", Lang::En) => Some("Team created"),
183+ ("team_created", Lang::Tr) => Some("Takım oluşturuldu"),
184+ ("team_updated", Lang::En) => Some("Team updated"),
185+ ("team_updated", Lang::Tr) => Some("Takım güncellendi"),
186+ ("team_deleted", Lang::En) => Some("Team deleted"),
187+ ("team_deleted", Lang::Tr) => Some("Takım silindi"),
188+ ("team_member_added", Lang::En) => Some("Team member added"),
189+ ("team_member_added", Lang::Tr) => Some("Takıma üye eklendi"),
190+ ("team_member_removed", Lang::En) => Some("Team member removed"),
191+ ("team_member_removed", Lang::Tr) => Some("Takım üyesi çıkarıldı"),
192+ ("team_repo_added", Lang::En) => Some("Repository added to team"),
193+ ("team_repo_added", Lang::Tr) => Some("Takıma depo eklendi"),
194+ ("team_repo_removed", Lang::En) => Some("Repository removed from team"),
195+ ("team_repo_removed", Lang::Tr) => Some("Takımdan depo çıkarıldı"),
196+ ("password_reset_completed", Lang::En) => Some("Password reset completed"),
197+ ("password_reset_completed", Lang::Tr) => Some("Parola sıfırlama tamamlandı"),
198+ ("email_verified", Lang::En) => Some("Email verified"),
199+ ("email_verified", Lang::Tr) => Some("E-posta doğrulandı"),
200+ ("invite_sent", Lang::En) => Some("Invite sent"),
201+ ("invite_sent", Lang::Tr) => Some("Davet gönderildi"),
202+ ("invite_accepted", Lang::En) => Some("Invite accepted"),
203+ ("invite_accepted", Lang::Tr) => Some("Davet kabul edildi"),
204+ ("user_suspended", Lang::En) => Some("User suspended"),
205+ ("user_suspended", Lang::Tr) => Some("Kullanıcı askıya alındı"),
206+ ("user_unsuspended", Lang::En) => Some("User unsuspended"),
207+ ("user_unsuspended", Lang::Tr) => Some("Kullanıcının askısı kaldırıldı"),
208+ ("admin_granted", Lang::En) => Some("Admin access granted"),
209+ ("admin_granted", Lang::Tr) => Some("Yönetici yetkisi verildi"),
210+ ("admin_revoked", Lang::En) => Some("Admin access revoked"),
211+ ("admin_revoked", Lang::Tr) => Some("Yönetici yetkisi alındı"),
212+ ("totp_disabled_by_admin", Lang::En) => {
213+ Some("Two-factor authentication turned off by admin")
214+ }
215+ ("totp_disabled_by_admin", Lang::Tr) => {
216+ Some("İki adımlı doğrulama yönetici tarafından kapatıldı")
217+ }
218+ ("passkey_added", Lang::En) => Some("Passkey added"),
219+ ("passkey_added", Lang::Tr) => Some("Geçiş anahtarı eklendi"),
220+ ("passkey_renamed", Lang::En) => Some("Passkey renamed"),
221+ ("passkey_renamed", Lang::Tr) => Some("Geçiş anahtarı yeniden adlandırıldı"),
222+ ("passkey_deleted", Lang::En) => Some("Passkey deleted"),
223+ ("passkey_deleted", Lang::Tr) => Some("Geçiş anahtarı silindi"),
224+ ("passkeys_removed_by_admin", Lang::En) => Some("Passkeys removed by admin"),
225+ ("passkeys_removed_by_admin", Lang::Tr) => {
226+ Some("Geçiş anahtarları yönetici tarafından kaldırıldı")
227+ }
228+ ("passkey_login", Lang::En) => Some("Signed in with passkey"),
229+ ("passkey_login", Lang::Tr) => Some("Geçiş anahtarıyla giriş yapıldı"),
230+ _ => None,
231+ }
232+}
233+
234+/// The display name of a target kind (what an audit entry was done to), or `None` if unknown.
235+pub fn target_kind_name(lang: Lang, kind: &str) -> Option<&'static str> {
236+ match (kind, lang) {
237+ ("backup", Lang::En) => Some("backup"),
238+ ("backup", Lang::Tr) => Some("yedek"),
239+ ("branch_rule", Lang::En) => Some("branch rule"),
240+ ("branch_rule", Lang::Tr) => Some("dal kuralı"),
241+ ("ci_runner", Lang::En) => Some("CI runner"),
242+ ("ci_runner", Lang::Tr) => Some("CI çalıştırıcısı"),
243+ ("ci_runner_token", Lang::En) => Some("CI runner token"),
244+ ("ci_runner_token", Lang::Tr) => Some("CI çalıştırıcı belirteci"),
245+ ("comment", Lang::En) => Some("comment"),
246+ ("comment", Lang::Tr) => Some("yorum"),
247+ ("discussion", Lang::En) => Some("discussion"),
248+ ("discussion", Lang::Tr) => Some("tartışma"),
249+ ("fsck", Lang::En) => Some("integrity check"),
250+ ("fsck", Lang::Tr) => Some("bütünlük denetimi"),
251+ ("gpg_key", Lang::En) => Some("GPG key"),
252+ ("gpg_key", Lang::Tr) => Some("GPG anahtarı"),
253+ ("invite", Lang::En) => Some("invite"),
254+ ("invite", Lang::Tr) => Some("davet"),
255+ ("issue", Lang::En) => Some("issue"),
256+ ("issue", Lang::Tr) => Some("sorun"),
257+ ("mail", Lang::En) => Some("mail"),
258+ ("mail", Lang::Tr) => Some("e-posta"),
259+ ("mirror", Lang::En) => Some("mirror"),
260+ ("mirror", Lang::Tr) => Some("yansı"),
261+ ("org", Lang::En) => Some("organization"),
262+ ("org", Lang::Tr) => Some("kuruluş"),
263+ ("replication", Lang::En) => Some("replication"),
264+ ("replication", Lang::Tr) => Some("çoğaltma"),
265+ ("repo", Lang::En) => Some("repository"),
266+ ("repo", Lang::Tr) => Some("depo"),
267+ ("server", Lang::En) => Some("server"),
268+ ("server", Lang::Tr) => Some("sunucu"),
269+ ("session", Lang::En) => Some("session"),
270+ ("session", Lang::Tr) => Some("oturum"),
271+ ("snippet", Lang::En) => Some("snippet"),
272+ ("snippet", Lang::Tr) => Some("parçacık"),
273+ ("ssh_key", Lang::En) => Some("SSH key"),
274+ ("ssh_key", Lang::Tr) => Some("SSH anahtarı"),
275+ ("team", Lang::En) => Some("team"),
276+ ("team", Lang::Tr) => Some("takım"),
277+ ("token", Lang::En) => Some("access token"),
278+ ("token", Lang::Tr) => Some("erişim belirteci"),
279+ ("user", Lang::En) => Some("user"),
280+ ("user", Lang::Tr) => Some("kullanıcı"),
281+ _ => None,
282+ }
283+}
284+
285+/// The display name of a key stored in an audit entry's details, or `None` if unknown.
286+pub fn detail_key_name(lang: Lang, key: &str) -> Option<&'static str> {
287+ match (key, lang) {
288+ ("user", Lang::En) => Some("user"),
289+ ("user", Lang::Tr) => Some("kullanıcı"),
290+ ("trigger", Lang::En) => Some("trigger"),
291+ ("trigger", Lang::Tr) => Some("tetikleyici"),
292+ ("to", Lang::En) => Some("to"),
293+ ("to", Lang::Tr) => Some("hedef"),
294+ ("name", Lang::En) => Some("name"),
295+ ("name", Lang::Tr) => Some("ad"),
296+ ("from", Lang::En) => Some("from"),
297+ ("from", Lang::Tr) => Some("kaynak"),
298+ ("role", Lang::En) => Some("role"),
299+ ("role", Lang::Tr) => Some("rol"),
300+ ("mirror_id", Lang::En) => Some("mirror"),
301+ ("mirror_id", Lang::Tr) => Some("yansı"),
302+ ("direction", Lang::En) => Some("direction"),
303+ ("direction", Lang::Tr) => Some("yön"),
304+ ("url", Lang::En) => Some("URL"),
305+ ("url", Lang::Tr) => Some("URL"),
306+ ("reason", Lang::En) => Some("reason"),
307+ ("reason", Lang::Tr) => Some("neden"),
308+ ("hook_id", Lang::En) => Some("webhook"),
309+ ("hook_id", Lang::Tr) => Some("web kancası"),
310+ ("admin", Lang::En) => Some("admin"),
311+ ("admin", Lang::Tr) => Some("yönetici"),
312+ ("theme", Lang::En) => Some("theme"),
313+ ("theme", Lang::Tr) => Some("tema"),
314+ ("set", Lang::En) => Some("set"),
315+ ("set", Lang::Tr) => Some("ayarlanan"),
316+ ("cleared", Lang::En) => Some("cleared"),
317+ ("cleared", Lang::Tr) => Some("temizlenen"),
318+ ("reset", Lang::En) => Some("reset"),
319+ ("reset", Lang::Tr) => Some("sıfırlanan"),
320+ ("runner_id", Lang::En) => Some("runner"),
321+ ("runner_id", Lang::Tr) => Some("çalıştırıcı"),
322+ ("repo_id", Lang::En) => Some("repository"),
323+ ("repo_id", Lang::Tr) => Some("depo"),
324+ ("reassigned_to", Lang::En) => Some("reassigned to"),
325+ ("reassigned_to", Lang::Tr) => Some("devredilen"),
326+ ("language", Lang::En) => Some("language"),
327+ ("language", Lang::Tr) => Some("dil"),
328+ ("full", Lang::En) => Some("full"),
329+ ("full", Lang::Tr) => Some("tam"),
330+ ("field", Lang::En) => Some("field"),
331+ ("field", Lang::Tr) => Some("alan"),
332+ ("avatar", Lang::En) => Some("avatar"),
333+ ("avatar", Lang::Tr) => Some("profil resmi"),
334+ ("updates", Lang::En) => Some("updates"),
335+ ("updates", Lang::Tr) => Some("güncellemeler"),
336+ ("ttl_hours", Lang::En) => Some("valid for hours"),
337+ ("ttl_hours", Lang::Tr) => Some("geçerlilik (saat)"),
338+ ("setup", Lang::En) => Some("setup"),
339+ ("setup", Lang::Tr) => Some("kurulum"),
340+ ("self_service", Lang::En) => Some("self-service"),
341+ ("self_service", Lang::Tr) => Some("kendi kendine"),
342+ ("self", Lang::En) => Some("self"),
343+ ("self", Lang::Tr) => Some("kendisi"),
344+ ("second_factor", Lang::En) => Some("second factor"),
345+ ("second_factor", Lang::Tr) => Some("ikinci adım"),
346+ ("register", Lang::En) => Some("register"),
347+ ("register", Lang::Tr) => Some("kayıt"),
348+ ("port", Lang::En) => Some("port"),
349+ ("port", Lang::Tr) => Some("bağlantı noktası"),
350+ ("page", Lang::En) => Some("page"),
351+ ("page", Lang::Tr) => Some("sayfa"),
352+ ("others", Lang::En) => Some("others"),
353+ ("others", Lang::Tr) => Some("diğerleri"),
354+ ("org", Lang::En) => Some("organization"),
355+ ("org", Lang::Tr) => Some("kuruluş"),
356+ ("mode", Lang::En) => Some("mode"),
357+ ("mode", Lang::Tr) => Some("mod"),
358+ ("members_can_create_repos", Lang::En) => Some("members can create repositories"),
359+ ("members_can_create_repos", Lang::Tr) => Some("üyeler depo oluşturabilir"),
360+ ("invite", Lang::En) => Some("invite"),
361+ ("invite", Lang::Tr) => Some("davet"),
362+ ("import", Lang::En) => Some("import"),
363+ ("import", Lang::Tr) => Some("içe aktarma"),
364+ ("host", Lang::En) => Some("host"),
365+ ("host", Lang::Tr) => Some("sunucu adresi"),
366+ ("fork_of", Lang::En) => Some("fork of"),
367+ ("fork_of", Lang::Tr) => Some("çatal kaynağı"),
368+ ("enabled", Lang::En) => Some("enabled"),
369+ ("enabled", Lang::Tr) => Some("açık"),
370+ ("ecosystem", Lang::En) => Some("ecosystem"),
371+ ("ecosystem", Lang::Tr) => Some("ekosistem"),
372+ ("default_repo_role", Lang::En) => Some("default repository role"),
373+ ("default_repo_role", Lang::Tr) => Some("varsayılan depo rolü"),
374+ ("commit", Lang::En) => Some("commit"),
375+ ("commit", Lang::Tr) => Some("commit"),
376+ ("boot_id", Lang::En) => Some("boot ID"),
377+ ("boot_id", Lang::Tr) => Some("açılış kimliği"),
378+ ("all_repos", Lang::En) => Some("all repositories"),
379+ ("all_repos", Lang::Tr) => Some("tüm depolar"),
380+ ("advisory", Lang::En) => Some("advisory"),
381+ ("advisory", Lang::Tr) => Some("güvenlik uyarısı"),
382+ ("version", Lang::En) => Some("version"),
383+ ("version", Lang::Tr) => Some("sürüm"),
384+ ("security", Lang::En) => Some("security"),
385+ ("security", Lang::Tr) => Some("güvenlik"),
386+ ("secret_changed", Lang::En) => Some("secret changed"),
387+ ("secret_changed", Lang::Tr) => Some("gizli değer değişti"),
388+ ("secret_cleared", Lang::En) => Some("secret cleared"),
389+ ("secret_cleared", Lang::Tr) => Some("gizli değer temizlendi"),
390+ ("password_changed", Lang::En) => Some("password changed"),
391+ ("password_changed", Lang::Tr) => Some("parola değiştirildi"),
392+ ("package", Lang::En) => Some("package"),
393+ ("package", Lang::Tr) => Some("paket"),
394+ ("user_ids", Lang::En) => Some("users"),
395+ ("user_ids", Lang::Tr) => Some("kullanıcılar"),
396+ ("base_light", Lang::En) => Some("light base"),
397+ ("base_light", Lang::Tr) => Some("açık taban"),
398+ ("base_dark", Lang::En) => Some("dark base"),
399+ ("base_dark", Lang::Tr) => Some("koyu taban"),
400+ ("accent_light", Lang::En) => Some("light accent"),
401+ ("accent_light", Lang::Tr) => Some("açık vurgu"),
402+ ("accent_dark", Lang::En) => Some("dark accent"),
403+ ("accent_dark", Lang::Tr) => Some("koyu vurgu"),
404+ ("passkey", Lang::En) => Some("passkey"),
405+ ("passkey", Lang::Tr) => Some("geçiş anahtarı"),
406+ ("ok", Lang::En) => Some("ok"),
407+ ("ok", Lang::Tr) => Some("tamam"),
408+ ("next", Lang::En) => Some("next"),
409+ ("next", Lang::Tr) => Some("sonraki"),
410+ _ => None,
411+ }
412+}
413+
414+#[cfg(test)]
415+mod tests {
416+ use super::*;
417+
418+ const ACTION_IDS: &[&str] = &[
419+ "login_success",
420+ "login_failed",
421+ "login_2fa_failed",
422+ "logout",
423+ "password_changed",
424+ "email_changed",
425+ "password_reset_by_admin",
426+ "totp_enabled",
427+ "totp_disabled",
428+ "recovery_codes_regenerated",
429+ "ssh_key_added",
430+ "ssh_key_removed",
431+ "gpg_key_added",
432+ "gpg_key_deleted",
433+ "token_created",
434+ "token_revoked",
435+ "session_revoked",
436+ "user_created",
437+ "username_changed",
438+ "user_deleted",
439+ "repo_created",
440+ "repo_deleted",
441+ "repo_renamed",
442+ "repo_transferred",
443+ "repo_transfer_initiated",
444+ "repo_transfer_accepted",
445+ "repo_transfer_declined",
446+ "repo_transfer_cancelled",
447+ "repo_visibility_changed",
448+ "collaborator_added",
449+ "collaborator_removed",
450+ "collaborator_role_changed",
451+ "branch_rule_created",
452+ "branch_rule_updated",
453+ "branch_rule_deleted",
454+ "repo_archived",
455+ "repo_unarchived",
456+ "webhook_created",
457+ "webhook_updated",
458+ "webhook_deleted",
459+ "mirror_created",
460+ "mirror_updated",
461+ "mirror_deleted",
462+ "mirror_sync_failed",
463+ "backup_started",
464+ "fsck_started",
465+ "replication_reconcile_started",
466+ "ci_secret_set",
467+ "ci_secret_deleted",
468+ "ci_runner_registered",
469+ "ci_runner_deleted",
470+ "ci_runner_restart_requested",
471+ "ci_runner_config_changed",
472+ "ci_registration_token_created",
473+ "advisory_alert_dismissed",
474+ "advisory_alert_reopened",
475+ "ui_prefs_changed",
476+ "discussions_enabled",
477+ "discussions_disabled",
478+ "discussion_created",
479+ "discussion_edited",
480+ "discussion_deleted",
481+ "discussion_locked",
482+ "discussion_unlocked",
483+ "discussion_answered",
484+ "discussion_comment_created",
485+ "discussion_comment_edited",
486+ "discussion_comment_deleted",
487+ "mail_settings_updated",
488+ "mail_test_queued",
489+ "server_settings_updated",
490+ "server_restarted",
491+ "snippet_created",
492+ "snippet_updated",
493+ "snippet_deleted",
494+ "wiki_page_saved",
495+ "wiki_enabled",
496+ "wiki_disabled",
497+ "wiki_pushed",
498+ "org_created",
499+ "org_deleted",
500+ "org_settings_updated",
501+ "org_member_added",
502+ "org_member_removed",
503+ "org_member_role_changed",
504+ "team_created",
505+ "team_updated",
506+ "team_deleted",
507+ "team_member_added",
508+ "team_member_removed",
509+ "team_repo_added",
510+ "team_repo_removed",
511+ "password_reset_completed",
512+ "email_verified",
513+ "invite_sent",
514+ "invite_accepted",
515+ "user_suspended",
516+ "user_unsuspended",
517+ "admin_granted",
518+ "admin_revoked",
519+ "totp_disabled_by_admin",
520+ "passkey_added",
521+ "passkey_renamed",
522+ "passkey_deleted",
523+ "passkeys_removed_by_admin",
524+ "passkey_login",
525+ ];
526+
527+ #[test]
528+ fn every_action_has_both_names() {
529+ for id in ACTION_IDS {
530+ assert!(
531+ action_name(Lang::En, id).is_some() && action_name(Lang::Tr, id).is_some(),
532+ "{id}"
533+ );
534+ }
535+ }
536+}
crates/forge-web-base/src/i18n/issues.rsmodified+4 -4
@@ -675,18 +675,18 @@ pub fn history_what(lang: Lang, pull: bool, target_kind: &str) -> &'static str {
675675 }
676676 }
677677
678-/// The history page title: `Edit history of a {what} · {suffix}`.
678+/// The history page title: `Edit history of the {what} · {suffix}`.
679679 pub fn history_title(lang: Lang, what: &str, suffix: &str) -> String {
680680 match lang {
681- Lang::En => format!("Edit history of a {what} \u{b7} {suffix}"),
681+ Lang::En => format!("Edit history of the {what} \u{b7} {suffix}"),
682682 Lang::Tr => format!("Düzenleme geçmişi: {what} \u{b7} {suffix}"),
683683 }
684684 }
685685
686-/// The history page heading: `Edit history of {what}`.
686+/// The history page heading: `Edit history of the {what}`.
687687 pub fn history_heading(lang: Lang, what: &str) -> String {
688688 match lang {
689- Lang::En => format!("Edit history of {what}"),
689+ Lang::En => format!("Edit history of the {what}"),
690690 Lang::Tr => format!("Düzenleme geçmişi: {what}"),
691691 }
692692 }
crates/forge-web-base/src/i18n/mod.rsmodified+3 -2
@@ -21,6 +21,7 @@ pub mod accents;
2121 pub mod accounts;
2222 pub mod admin;
2323 pub mod alerts;
24+pub mod audit_names;
2425 pub mod authoring;
2526 pub mod browse;
2627 pub mod code;
@@ -906,8 +907,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
906907 (Added, Tr) => "eklendi",
907908 (LastUsed, En) => "last used",
908909 (LastUsed, Tr) => "son kullanım",
909- (Created, En) => "Created",
910- (Created, Tr) => "Oluşturuldu",
910+ (Created, En) => "created",
911+ (Created, Tr) => "oluşturma",
911912 (SignedIn, En) => "Signed in",
912913 (SignedIn, Tr) => "Giriş",
913914 (LastSeen, En) => "last seen",
crates/forge-web/src/pages/admin_mail.rsmodified+13 -18
@@ -309,28 +309,23 @@ async fn mail_view(
309309 } else {
310310 <div>
311311 for row in queue.rows.into_iter() {
312- <details class="row-open">
313- <summary class="line">
314- <span class="name">(row.subject.as_str())</span>
315- <span class="val">(row.to.as_str()) " · " (row.kind) " · " <span class=(row.state_class)>(row.state)</span></span>
316- </summary>
317- <div class="opened">
318- <p class="hint">(g::t(lang, K::TableQueued)) " " rel_time(lang: lang, stamp: row.created.as_str())</p>
319- <p class="hint">(g::t(lang, K::TableTries)) " " (row.attempts)</p>
312+ <div class="line">
313+ <span class="name">(row.subject.as_str())</span>
314+ <span class="val">(row.to.as_str()) " · " (row.kind) " · " <span class=(row.state_class)>(row.state)</span>
315+ " · " (g::t(lang, K::TableQueued)) " " rel_time(lang: lang, stamp: row.created.as_str())
316+ " · " (g::t(lang, K::TableTries)) " " (row.attempts)
320317 if let Some(sent) = row.sent.as_deref() {
321- <p class="hint">(g::t(lang, K::MailSentAt)) " " rel_time(lang: lang, stamp: sent)</p>
318+ " · " (g::t(lang, K::MailSentAt)) " " rel_time(lang: lang, stamp: sent)
322319 }
323320 if !row.error.is_empty() {
324- <p class="hint">(g::t(lang, K::TableLastError)) " " (row.error.as_str())</p>
321+ " · " (g::t(lang, K::TableLastError)) ": " (row.error.as_str())
325322 }
326- if row.failed {
327- <div class="acts">
328- post_act(label: g::t(lang, K::MailRetryNow), action: "/admin/mail/queue/retry", csrf: csrf.as_str(), fields: vec![("id".to_owned(), row.id.clone()), ("state".to_owned(), filter_param.clone())])
329- confirm_act(lang: lang, label: g::t(lang, K::MailDiscard), action: "/admin/mail/queue/discard", csrf: csrf.as_str(), fields: vec![("id".to_owned(), row.id.clone()), ("state".to_owned(), filter_param.clone())], note: Some(crate::pages::passkeys::s(lang, "The message will not be sent.", "İleti gönderilmez.").to_owned()))
330- </div>
331- }
332- </div>
333- </details>
323+ </span>
324+ if row.failed {
325+ post_act(label: g::t(lang, K::MailRetryNow), action: "/admin/mail/queue/retry", csrf: csrf.as_str(), fields: vec![("id".to_owned(), row.id.clone()), ("state".to_owned(), filter_param.clone())])
326+ confirm_act(lang: lang, label: g::t(lang, K::MailDiscard), action: "/admin/mail/queue/discard", csrf: csrf.as_str(), fields: vec![("id".to_owned(), row.id.clone()), ("state".to_owned(), filter_param.clone())], note: Some(crate::pages::passkeys::s(lang, "The message will not be sent.", "İleti gönderilmez.").to_owned()))
327+ }
328+ </div>
334329 }
335330 </div>
336331 }
crates/forge-web/src/pages/admin_user_detail.rsmodified+43 -19
@@ -4,6 +4,7 @@
44 //! like the rest of the admin area.
55
66 use forge_core::names::normalize_name;
7+use forge_core::store::orgs::OrgMemberRole;
78 use forge_core::store::suspension::{AccountFacts, Suspension};
89 use forge_core::store::user_delete::GHOST_USERNAME;
910 use forge_core::{AuditAction, Store, User};
@@ -26,7 +27,7 @@ use crate::live::{Topic, stream_changes};
2627 use crate::pages::admin_users::admin_only;
2728 use crate::pages::passkeys::s;
2829 use crate::state::AppState;
29-use crate::views::parts::{confirm_act, head, post_act, reveal};
30+use crate::views::parts::{SubPart, confirm_act, head, post_act, reveal};
3031 use crate::views::{alert, enc, rel_time, rel_time_or_never, shell, user_facing_message};
3132
3233 #[query_params(error = bad_request)]
@@ -198,12 +199,10 @@ async fn detail_body(
198199 passkey_count
199200 );
200201 Ok(view! {
201- head(title: target.username.as_str())
202+ head(title: target.username.as_str(),
203+ <a class="button" href=(profile.as_str())>(profile_label)</a>
204+ )
202205 <div class="sheet" data-live=(live.as_str())>
203- <div class="sheet-tools">
204- <a class="act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
205- <a class="act" href=(profile.as_str())>(profile_label)</a>
206- </div>
207206 <p class="hint">
208207 if !email.is_empty() {
209208 (email.as_str()) " · "
@@ -289,7 +288,7 @@ async fn detail_body(
289288 </section>
290289 if !own {
291290 <section class="sec">
292- <h2>(i18n::t(lang, Key::Delete))</h2>
291+ <h2>(i18n::t(lang, Key::DangerZone))</h2>
293292 <p class="hint">(at(lang, A::DeleteHelp))</p>
294293 <div class="acts">
295294 <a class="act danger" href=(delete_href.as_str())>(i18n::t(lang, Key::Delete))</a>
@@ -300,25 +299,50 @@ async fn detail_body(
300299 })
301300 }
302301
303-/// An organization's page: its name, its member count, its profile, and its delete. An
304-/// organization is not a person, so the delete goes through the same POST as a user's.
302+/// An organization's page: its name, its members with a link to each account, its profile, and its
303+/// delete. An organization is not a person, so the delete goes through the same POST as a user's.
305304 #[component]
306-async fn org_body(lang: Lang, csrf: &str, org: User, members: usize) -> Result<impl View> {
305+async fn org_body(
306+ lang: Lang,
307+ csrf: &str,
308+ org: User,
309+ members: Vec<(User, OrgMemberRole)>,
310+) -> Result<impl View> {
307311 let base = format!("/admin/users/{}", enc(&org.id));
308312 let delete_action = format!("{base}/delete");
309313 let profile = format!("/{}", enc(&org.username));
310- let members = members.to_string();
314+ let count = format!("{} {}", og::t(lang, OG::Members), members.len());
311315 let profile_label = s(lang, "Open profile", "Profili aç");
316+ let organization = s(lang, "Organization", "Kuruluş");
317+ let owner = s(lang, "Owner", "Sahip");
318+ let member = s(lang, "Member", "Üye");
319+ let rows: Vec<(String, String, &str)> = members
320+ .into_iter()
321+ .map(|(user, role)| {
322+ let href = format!("/admin/users/{}", enc(&user.id));
323+ let role = match role {
324+ OrgMemberRole::Owner => owner,
325+ OrgMemberRole::Member => member,
326+ };
327+ (href, user.username, role)
328+ })
329+ .collect();
312330 Ok(view! {
313- head(title: org.username.as_str())
331+ head(title: org.username.as_str(), sub: vec![
332+ SubPart::text(organization),
333+ SubPart::text(count.as_str()),
334+ ],
335+ <a class="button" href=(profile.as_str())>(profile_label)</a>
336+ )
314337 <div class="sheet">
315- <div class="sheet-tools">
316- <a class="act" href="/admin/users">(g::t(lang, K::BackToUsers))</a>
317- <a class="act" href=(profile.as_str())>(profile_label)</a>
318- </div>
319- <p class="hint">(og::t(lang, OG::Members)) " " (members.as_str())</p>
320338 <section class="sec">
321- <h2>(i18n::t(lang, Key::Delete))</h2>
339+ <h2>(og::t(lang, OG::Members))</h2>
340+ for (href, name, role) in rows.iter() {
341+ <a class="line" href=(href.as_str())><span class="name">(name.as_str())</span><span class="val">(*role)</span></a>
342+ }
343+ </section>
344+ <section class="sec">
345+ <h2>(i18n::t(lang, Key::DangerZone))</h2>
322346 <div class="acts">
323347 confirm_act(lang: lang, label: g::t(lang, K::DeleteOrgTitle), action: delete_action.as_str(), csrf: csrf)
324348 </div>
@@ -377,7 +401,7 @@ async fn detail_page(cx: &Cx) -> Result<impl View> {
377401 let id = path_param_segment(cx, "user_id").to_owned();
378402 let org = match store.user_by_id(&id).await? {
379403 Some(user) if user.is_org() => {
380- let members = store.org_members(&user.id).await?.len();
404+ let members = store.org_members(&user.id).await?;
381405 Some((user, members))
382406 }
383407 _ => None,
crates/forge-web/src/pages/audit_log.rsmodified+244 -103
@@ -1,9 +1,10 @@
11 //! Pages: the admin audit log (`/admin/audit`, instance admins only, 404 otherwise) and a user's
22 //! own security log (`/settings/security/log`: entries the viewer acted in, or that targeted
3-//! them). Both list newest first, a page of rows at a time, continued with a cursor: 8 rows on the
3+//! them). Both list newest first, a page of rows at a time, with numbered pages: 8 rows on the
44 //! admin page (its filter bar takes the room) and 10 in the own log, sized to fit the window.
5+//! Repeats in a row (same action, actor and target) fold into one row with a count.
56
6-use forge_core::{AuditAction, AuditCursor, AuditEntry, AuditFilter, Store};
7+use forge_core::{AuditAction, AuditEntry, AuditFilter, Store};
78 use topcoat::Result;
89 use topcoat::context::{Cx, app_context};
910 use topcoat::router::response::Response;
@@ -12,12 +13,15 @@ use topcoat::view::{View, component, view};
1213
1314 use crate::auth::require_user;
1415 use crate::i18n::admin::{self as g, K};
15-use crate::i18n::{self, Lang};
16+use crate::i18n::{self, Lang, audit_names};
1617 use crate::live::{Topic, stream_changes};
1718 use crate::pages::admin_users::admin_only;
1819 use crate::pages::issues_list::list_href;
20+use crate::pages::passkeys::s;
21+use crate::pages::settings_security::{security_rail_for, security_sub};
1922 use crate::state::AppState;
20-use crate::views::parts::{SubPart, head};
23+use crate::views::parts::{RailItem, SubPart, head, rail};
24+use crate::views::repo_list::{PageLink, pager, pager_links};
2125 use crate::views::{rel_time, shell};
2226
2327 /// Entries per page of the admin audit log, under its filter bar.
@@ -26,21 +30,113 @@ const ADMIN_PAGE_SIZE: usize = 8;
2630 /// Entries per page of the own security log.
2731 const OWN_PAGE_SIZE: usize = 10;
2832
33+/// Details shorter than this show in the row; longer ones move to the line's hover title.
34+const DETAILS_INLINE_CHARS: usize = 80;
35+
2936 #[query_params(error = bad_request)]
3037 pub(crate) struct AuditQuery {
3138 action: Option<String>,
3239 actor: Option<String>,
40+ /// Old cursor links. Still accepted so old bookmarks load, and ignored.
41+ #[allow(dead_code)]
3342 before: Option<String>,
43+ /// The 1-based page number. Anything unreadable is page 1.
44+ page: Option<String>,
3445 }
3546
36-/// One table row, already formatted for display.
47+/// One table row, already formatted for display. A row can stand for several entries in a row.
3748 struct RowView {
3849 when: String,
3950 actor: String,
51+ /// The action as words: "Ui prefs changed".
52+ name: String,
53+ /// The raw action, for the hover title.
4054 action: String,
55+ /// "kind: name", or the name alone, or empty when the entry has no target name.
4156 target: String,
4257 ip: String,
43- details: String,
58+ /// The details when short enough to show in the row. Empty when they are long.
59+ details_inline: String,
60+ /// The details when too long for the row, for the line's hover title. Empty otherwise.
61+ details_title: String,
62+ /// How many entries this row stands for.
63+ count: usize,
64+}
65+
66+/// "ci_secret_set" as "CI secret set": words, with the short names in capitals.
67+fn action_words(action: &str) -> String {
68+ let words: Vec<String> = action
69+ .split('_')
70+ .enumerate()
71+ .map(|(i, word)| match word {
72+ "ci" | "ui" | "ip" | "ssh" | "gpg" | "oci" | "totp" | "2fa" | "api" | "pat" => {
73+ word.to_uppercase()
74+ }
75+ _ if i == 0 => {
76+ let mut chars = word.chars();
77+ match chars.next() {
78+ Some(first) => first.to_uppercase().chain(chars).collect(),
79+ None => String::new(),
80+ }
81+ }
82+ _ => word.to_owned(),
83+ })
84+ .collect();
85+ words.join(" ")
86+}
87+
88+/// A stored role ("write") in the viewer's language.
89+fn role_word(lang: Lang, role: &str) -> Option<&'static str> {
90+ Some(match role {
91+ "read" => s(lang, "read", "okuma"),
92+ "write" => s(lang, "write", "yazma"),
93+ "admin" => s(lang, "admin", "yönetici"),
94+ "maintain" => s(lang, "maintain", "bakım"),
95+ "triage" => s(lang, "triage", "ön değerlendirme"),
96+ "owner" => s(lang, "owner", "sahip"),
97+ "member" => s(lang, "member", "üye"),
98+ _ => return None,
99+ })
100+}
101+
102+/// An action's name in the viewer's language; an action with no name yet reads as its words.
103+fn action_label(lang: Lang, action: &str) -> String {
104+ audit_names::action_name(lang, action)
105+ .map(str::to_owned)
106+ .unwrap_or_else(|| action_words(action))
107+}
108+
109+/// A flat JSON object as "key value · key value" in the viewer's language, so a row reads as
110+/// text. Anything else (nested values, arrays, broken JSON) stays as it was stored.
111+fn details_words(lang: Lang, data: &str) -> String {
112+ let Ok(serde_json::Value::Object(map)) = serde_json::from_str::<serde_json::Value>(data) else {
113+ return data.to_owned();
114+ };
115+ let mut parts = Vec::with_capacity(map.len());
116+ for (key, value) in map {
117+ let value = match value {
118+ serde_json::Value::String(text) => text,
119+ serde_json::Value::Bool(yes) => s(
120+ lang,
121+ if yes { "yes" } else { "no" },
122+ if yes { "evet" } else { "hayır" },
123+ )
124+ .to_owned(),
125+ serde_json::Value::Number(_) | serde_json::Value::Null => value.to_string(),
126+ _ => return data.to_owned(),
127+ };
128+ // A role is a word of the app's own, so it reads in the viewer's language too.
129+ let value = if key == "role" {
130+ role_word(lang, &value).map(str::to_owned).unwrap_or(value)
131+ } else {
132+ value
133+ };
134+ let key = audit_names::detail_key_name(lang, &key)
135+ .map(str::to_owned)
136+ .unwrap_or_else(|| key.replace('_', " "));
137+ parts.push(format!("{key} {value}"));
138+ }
139+ parts.join(" · ")
44140 }
45141
46142 fn row_view(entry: &AuditEntry, lang: Lang) -> RowView {
@@ -53,46 +149,100 @@ fn row_view(entry: &AuditEntry, lang: Lang) -> RowView {
53149 } else {
54150 entry.target_name.as_str()
55151 };
56- let target = if entry.target_kind.is_empty() {
57- name.to_owned()
152+ let target = match (entry.target_kind.is_empty(), name.is_empty()) {
153+ (_, true) => String::new(),
154+ (true, false) => name.to_owned(),
155+ (false, false) => {
156+ let kind = audit_names::target_kind_name(lang, &entry.target_kind)
157+ .map(str::to_owned)
158+ .unwrap_or_else(|| entry.target_kind.replace('_', " "));
159+ format!("{kind}: {name}")
160+ }
161+ };
162+ let details = if entry.data == "{}" {
163+ String::new()
164+ } else {
165+ details_words(lang, &entry.data)
166+ };
167+ let (details_inline, details_title) = if details.chars().count() < DETAILS_INLINE_CHARS {
168+ (details.clone(), String::new())
58169 } else {
59- format!("{}: {name}", entry.target_kind)
170+ (String::new(), details.clone())
60171 };
61172 RowView {
62173 when: entry.at.clone(),
63174 actor,
175+ name: action_label(lang, entry.action.as_str()),
64176 action: entry.action.as_str().to_owned(),
65177 target,
66178 ip: entry.ip.clone(),
67- details: if entry.data == "{}" {
68- String::new()
69- } else {
70- entry.data.clone()
71- },
179+ details_inline,
180+ details_title,
181+ count: 1,
72182 }
73183 }
74184
75-/// One page of `size` entries, and the cursor for the page after it when there may be one.
185+/// Rows for `entries` (newest first), with consecutive entries of the same action, actor and
186+/// target folded into one row. The row keeps the newest entry's time, IP and details.
187+fn fold_rows(entries: &[AuditEntry], lang: Lang) -> Vec<RowView> {
188+ let mut rows: Vec<(&AuditEntry, RowView)> = Vec::new();
189+ for entry in entries {
190+ if let Some((last, row)) = rows.last_mut() {
191+ let same = last.action == entry.action
192+ && last.actor_id == entry.actor_id
193+ && last.actor_name == entry.actor_name
194+ && last.target_kind == entry.target_kind
195+ && last.target_id == entry.target_id
196+ && last.target_name == entry.target_name;
197+ if same {
198+ row.count += 1;
199+ continue;
200+ }
201+ }
202+ rows.push((entry, row_view(entry, lang)));
203+ }
204+ rows.into_iter().map(|(_, row)| row).collect()
205+}
206+
207+/// The page the query asks for, 1-based. Anything unreadable is page 1.
208+fn requested_page(query: &AuditQuery) -> u64 {
209+ query
210+ .page
211+ .as_deref()
212+ .and_then(|p| p.parse::<u64>().ok())
213+ .unwrap_or(1)
214+ .max(1)
215+}
216+
217+/// One page of `size` entries, and the page that was asked for, clamped to the pages there are,
218+/// with the page count.
76219 async fn fetch_page(
77220 store: &Store,
78221 filter: &AuditFilter,
79- before: Option<&str>,
222+ page: u64,
80223 size: usize,
81-) -> forge_core::Result<(Vec<AuditEntry>, Option<String>)> {
82- let cursor = before.and_then(AuditCursor::decode);
83- let mut entries = store
84- .list_audit(filter, cursor.as_ref(), (size + 1) as u32)
85- .await?;
86- let more = entries.len() > size;
87- entries.truncate(size);
88- let next = if more {
89- entries
90- .last()
91- .map(|entry| AuditCursor::after(entry).encode())
92- } else {
93- None
94- };
95- Ok((entries, next))
224+) -> forge_core::Result<(Vec<AuditEntry>, u64, u64)> {
225+ let total = store.count_audit(filter).await?;
226+ let pages = total.div_ceil(size as u64).max(1);
227+ let page = page.clamp(1, pages);
228+ let offset = ((page - 1) * size as u64) as u32;
229+ let entries = store.list_audit_page(filter, offset, size as u32).await?;
230+ Ok((entries, page, pages))
231+}
232+
233+/// The numbered pager's entries and links for `page` of `pages`, under `href`'s params.
234+fn nav_for(
235+ page: u64,
236+ pages: u64,
237+ base: &str,
238+ params: &[(&str, &str)],
239+) -> (Vec<PageLink>, Option<String>, Option<String>) {
240+ pager_links(page, pages, |n| {
241+ let number = n.to_string();
242+ let mut all: Vec<(&str, &str)> = params.to_vec();
243+ all.push(("page", number.as_str()));
244+ list_href(base, &all)
245+ })
96246 }
97247
98248 #[component]
@@ -102,39 +252,28 @@ async fn audit_table(lang: Lang, rows: Vec<RowView>, show_actor: bool) -> Result
102252 <p class="state">(g::t(lang, K::NoEntries))</p>
103253 } else {
104254 for row in rows.into_iter() {
105- if row.ip.is_empty() && row.details.is_empty() {
106- <div class="line" data-kb-row="">
107- <span class="name"><code>(row.action.as_str())</code></span>
108- <span class="val">
109- rel_time(lang: lang, stamp: row.when.as_str())
110- if show_actor {
111- " · " (row.actor.as_str())
112- }
255+ let count = row.count.to_string();
256+ <div class="line" data-kb-row="" title=(row.details_title.as_str())>
257+ <span class="name" title=(row.action.as_str())>(row.name.as_str())</span>
258+ if row.count > 1 {
259+ <span class="count">"×" (count.as_str())</span>
260+ }
261+ <span class="val">
262+ rel_time(lang: lang, stamp: row.when.as_str())
263+ if show_actor {
264+ " · " (row.actor.as_str())
265+ }
266+ if !row.target.is_empty() {
113267 " · " (row.target.as_str())
114- </span>
115- </div>
116- } else {
117- <details class="row-open" data-kb-row="">
118- <summary class="line">
119- <span class="name"><code>(row.action.as_str())</code></span>
120- <span class="val">
121- rel_time(lang: lang, stamp: row.when.as_str())
122- if show_actor {
123- " · " (row.actor.as_str())
124- }
125- " · " (row.target.as_str())
126- </span>
127- </summary>
128- <div class="opened">
129- if !row.ip.is_empty() {
130- <p class="hint">"IP " (row.ip.as_str())</p>
131- }
132- if !row.details.is_empty() {
133- <p class="hint"><code>(row.details.as_str())</code></p>
134- }
135- </div>
136- </details>
137- }
268+ }
269+ if !row.ip.is_empty() {
270+ " · IP " (row.ip.as_str())
271+ }
272+ if !row.details_inline.is_empty() {
273+ " · " (row.details_inline.as_str())
274+ }
275+ </span>
276+ </div>
138277 }
139278 }
140279 })
@@ -148,8 +287,11 @@ async fn admin_audit_view(
148287 actor: String,
149288 notice: Option<String>,
150289 rows: Vec<RowView>,
151- older_href: Option<String>,
290+ page: u64,
291+ pages: u64,
292+ nav: (Vec<PageLink>, Option<String>, Option<String>),
152293 ) -> Result<impl View> {
294+ let (links, prev, next) = nav;
153295 let sub = vec![SubPart::text(g::t(lang, K::AuditIntro))];
154296 Ok(view! {
155297 head(title: g::t(lang, K::AuditLog), sub: sub)
@@ -166,7 +308,7 @@ async fn admin_audit_view(
166308 <select name="action" data-autosubmit="true">
167309 <option value="" selected=(action.is_empty())>(g::t(lang, K::AllActions))</option>
168310 for known in AuditAction::ALL.iter().copied() {
169- <option value=(known.as_str()) selected=(known.as_str() == action.as_str())>(known.as_str())</option>
311+ <option value=(known.as_str()) selected=(known.as_str() == action.as_str())>(action_label(lang, known.as_str()))</option>
170312 }
171313 </select>
172314 </label>
@@ -176,11 +318,7 @@ async fn admin_audit_view(
176318 <p class="state" role="status">(message.as_str())</p>
177319 }
178320 audit_table(lang: lang, rows: rows, show_actor: true)
179- if let Some(href) = older_href {
180- <div class="acts">
181- <a class="act" href=(href.as_str())>(g::t(lang, K::Older))</a>
182- </div>
183- }
321+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
184322 </div>
185323 })
186324 }
@@ -188,19 +326,26 @@ async fn admin_audit_view(
188326 #[component]
189327 async fn own_log_view(
190328 lang: Lang,
329+ items: Vec<RailItem>,
191330 rows: Vec<RowView>,
192- older_href: Option<String>,
331+ page: u64,
332+ pages: u64,
333+ nav: (Vec<PageLink>, Option<String>, Option<String>),
193334 ) -> Result<impl View> {
194- let sub = vec![SubPart::text(g::t(lang, K::OwnLogIntro))];
335+ let (links, prev, next) = nav;
336+ let sub = vec![SubPart::text(security_sub(lang))];
195337 Ok(view! {
196- head(title: g::t(lang, K::SecurityLogTitle), sub: sub)
197- <div class="sheet">
198- audit_table(lang: lang, rows: rows, show_actor: false)
199- if let Some(href) = older_href {
200- <div class="acts">
201- <a class="act" href=(href.as_str())>(g::t(lang, K::Older))</a>
202- </div>
203- }
338+ head(title: i18n::t(lang, i18n::Key::Security), sub: sub)
339+ <div class="work">
340+ rail(label: i18n::t(lang, i18n::Key::Security), items: items)
341+ <div class="sheet">
342+ <section class="sec">
343+ <h2>(g::t(lang, K::SecurityLogTitle))</h2>
344+ <p class="hint">(g::t(lang, K::OwnLogIntro))</p>
345+ audit_table(lang: lang, rows: rows, show_actor: false)
346+ </section>
347+ pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang)
348+ </div>
204349 </div>
205350 })
206351 }
@@ -229,30 +374,26 @@ async fn admin_audit_page(cx: &Cx) -> Result<impl View> {
229374 }
230375 }
231376 // An unknown action or actor matches nothing, so the notice explains the empty table.
232- let (entries, next) = if notice.is_some() {
233- (Vec::new(), None)
377+ let (entries, page, pages) = if notice.is_some() {
378+ (Vec::new(), 1, 1)
234379 } else {
235- fetch_page(store, &filter, query.before.as_deref(), ADMIN_PAGE_SIZE).await?
380+ fetch_page(store, &filter, requested_page(&query), ADMIN_PAGE_SIZE).await?
236381 };
237382
238- let rows: Vec<RowView> = entries.iter().map(|entry| row_view(entry, lang)).collect();
239- let older_href = next.map(|cursor| {
240- list_href(
241- "/admin/audit",
242- &[
243- ("action", action.as_str()),
244- ("actor", actor.as_str()),
245- ("before", cursor.as_str()),
246- ],
247- )
248- });
383+ let rows = fold_rows(&entries, lang);
384+ let nav = nav_for(
385+ page,
386+ pages,
387+ "/admin/audit",
388+ &[("action", action.as_str()), ("actor", actor.as_str())],
389+ );
249390 let live = list_href(
250391 "/admin/audit/events",
251392 &[("action", action.as_str()), ("actor", actor.as_str())],
252393 );
253394 let title = g::t(lang, K::AuditLog);
254395 Ok(view! {
255- shell(title: title, viewer: Some(&viewer), admin_audit_view(lang: lang, live: live, action: action, actor: actor, notice: notice, rows: rows, older_href: older_href))
396+ shell(title: title, viewer: Some(&viewer), admin_audit_view(lang: lang, live: live, action: action, actor: actor, notice: notice, rows: rows, page: page, pages: pages, nav: nav))
256397 })
257398 }
258399
@@ -272,7 +413,7 @@ async fn first_page_fingerprint(store: &Store, action: &str, actor: &str) -> Res
272413 None => return Ok(String::new()),
273414 }
274415 }
275- let (entries, _) = fetch_page(store, &filter, None, ADMIN_PAGE_SIZE).await?;
416+ let (entries, _, _) = fetch_page(store, &filter, 1, ADMIN_PAGE_SIZE).await?;
276417 Ok(entries
277418 .iter()
278419 .map(|entry| entry.id.as_str())
@@ -307,15 +448,15 @@ async fn own_log_page(cx: &Cx) -> Result<impl View> {
307448 involving_user: Some(viewer.0.id.clone()),
308449 ..Default::default()
309450 };
310- let (entries, next) =
311- fetch_page(store, &filter, query.before.as_deref(), OWN_PAGE_SIZE).await?;
451+ let (entries, page, pages) =
452+ fetch_page(store, &filter, requested_page(&query), OWN_PAGE_SIZE).await?;
312453
313- let rows: Vec<RowView> = entries.iter().map(|entry| row_view(entry, lang)).collect();
314- let older_href =
315- next.map(|cursor| list_href("/settings/security/log", &[("before", cursor.as_str())]));
454+ let rows = fold_rows(&entries, lang);
455+ let nav = nav_for(page, pages, "/settings/security/log", &[]);
456+ let items = security_rail_for(app_context::<AppState>(cx), lang, &viewer, "log").await?;
316457 let title = g::t(lang, K::SecurityLogTitle);
317458 Ok(view! {
318- shell(title: title, viewer: Some(&viewer), own_log_view(lang: lang, rows: rows, older_href: older_href))
459+ shell(title: title, viewer: Some(&viewer), own_log_view(lang: lang, items: items, rows: rows, page: page, pages: pages, nav: nav))
319460 })
320461 }
321462
@@ -477,6 +618,6 @@ mod tests {
477618 let row = row_view(&entry, Lang::En);
478619 assert_eq!(row.actor, "anonymous");
479620 assert_eq!(row.target, "mallory");
480- assert_eq!(row.details, "");
621+ assert_eq!(row.details_inline, "");
481622 }
482623 }
crates/forge-web/src/pages/branches.rsmodified+23 -28
@@ -143,36 +143,31 @@ async fn branch_table(
143143 Ok(view! {
144144 <div>
145145 for row in rows.into_iter() {
146- <details class="row-open" data-kb-row="">
147- <summary class="line">
148- <a class="name" href=(row.href.as_str())>(row.name.as_str())</a>
149- if row.is_default {
150- <span class="hint">(g::t(lang, K::DefaultBadge))</span>
151- }
152- <span class="val">(row.author.as_str()) " · " <time data-rel="true" datetime=(row.iso.as_str())>(row.age.as_str())</time>
153- if let Some(counts) = row.counts {
154- " · " (counts.as_str())
155- } else if row.up_to_date {
156- " · " (b::t(lang, b::K::UpToDate))
157- }
158- </span>
159- </summary>
160- <div class="opened">
146+ <div class="line" data-kb-row="">
147+ <a class="name" href=(row.href.as_str())>(row.name.as_str())</a>
148+ if row.is_default {
149+ <span class="hint">(g::t(lang, K::DefaultBadge))</span>
150+ }
151+ <span class="val">
161152 if let Some(last) = row.last {
162- <p><a href=(last.href.as_str())>commit_line(subject: last.summary.clone())</a></p>
153+ <a href=(last.href.as_str())>commit_line(subject: last.summary.clone())</a> " · "
154+ }
155+ (row.author.as_str()) " · " <time data-rel="true" datetime=(row.iso.as_str())>(row.age.as_str())</time>
156+ if let Some(counts) = row.counts {
157+ " · " (counts.as_str())
158+ } else if row.up_to_date {
159+ " · " (b::t(lang, b::K::UpToDate))
163160 }
164- <div class="acts">
165- if let Some(pr) = row.pr_href {
166- <a class="act" href=(pr.as_str())>(b::t(lang, b::K::NewPr))</a>
167- }
168- if can_delete && !row.is_default {
169- confirm_act(lang: lang, label: b::t(lang, b::K::DeleteBranch), action: delete_action.as_str(), csrf: csrf.as_str(),
170- fields: vec![("name".to_owned(), row.name.clone()), ("oid".to_owned(), row.oid.clone())],
171- note: Some(b::t(lang, b::K::DeleteConfirm).to_owned()))
172- }
173- </div>
174- </div>
175- </details>
161+ </span>
162+ if let Some(pr) = row.pr_href {
163+ <a class="act" href=(pr.as_str())>(b::t(lang, b::K::NewPr))</a>
164+ }
165+ if can_delete && !row.is_default {
166+ confirm_act(lang: lang, label: b::t(lang, b::K::DeleteBranch), action: delete_action.as_str(), csrf: csrf.as_str(),
167+ fields: vec![("name".to_owned(), row.name.clone()), ("oid".to_owned(), row.oid.clone())],
168+ note: Some(b::t(lang, b::K::DeleteConfirm).to_owned()))
169+ }
170+ </div>
176171 }
177172 </div>
178173 })
crates/forge-web/src/pages/ci_job.rsmodified+6 -7
@@ -449,7 +449,7 @@ async fn job_body(
449449 }
450450 </div>
451451 <p class="head-sub">
452- <a href=(job.run_href.as_str())>(g::t(lang, K::RunNumber)) " " (job.run_number)</a>
452+ <a href=(job.run_href.as_str())>(g::t(lang, K::RunNumber))(job.run_number)</a>
453453 <span class="sep" aria-hidden="true">"·"</span>
454454 <span class=(job.state_class.as_str())>(job.state.as_str())</span>
455455 if !job.runner.is_empty() {
@@ -501,13 +501,10 @@ async fn job_body(
501501 }
502502 <pre class="ci-log ci-tl-code" data-live-log="true" data-offset=(log_offset.as_str()) data-first=(first_line.as_str())>(log.as_str())</pre>
503503 if !artifacts.is_empty() {
504- <div class="sec">
504+ <div class="ci-artifacts">
505505 <h2>(g::t(lang, K::Artifacts))</h2>
506506 for artifact in artifacts.iter() {
507- <div class="line">
508- <span class="name"><a href=(artifact.href.as_str())>(artifact.name.as_str())</a></span>
509- <span class="val">(artifact.size.as_str())</span>
510- </div>
507+ <span><a href=(artifact.href.as_str())>(artifact.name.as_str())</a> " " <span class="val">(artifact.size.as_str())</span></span>
511508 }
512509 </div>
513510 }
@@ -614,8 +611,10 @@ async fn job_page(cx: &Cx) -> Result<impl View> {
614611 let dock_owner = ctx.repo.owner_name.clone();
615612 let dock_repo = ctx.repo.name.clone();
616613 let page_title = format!("{title} \u{b7} CI \u{b7} {}", view.name);
614+ // The path bar shows the run the job belongs to, between CI and the job.
615+ let parents = vec![(format!("#{}", view.run_number), view.run_href.clone())];
617616 Ok(view! {
618- shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(),
617+ shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(), parents: parents,
619618 job_body(head: head, lang: lang, job: view, log: log, log_offset: log_offset.to_string(), first_line: first_line.to_string(),
620619 truncated: truncated, artifacts: artifacts, live: live, owner: dock_owner, repo: dock_repo, bars: bars))
621620 })
crates/forge-web/src/pages/merge_queue.rsmodified+22 -26
@@ -383,32 +383,28 @@ async fn queue_body(
383383 } else {
384384 for row in rows.iter() {
385385 if row.remove {
386- <details class="row-open">
387- <summary class="line" data-kb-row="">
388- <span class="name"><a href=(row.pull_href.as_str())>"#"(row.pull_number)" "(row.pull_title.as_str())</a></span>
389- <span class="val">
390- if !row.position.is_empty() {
391- (g::t(lang, K::QueueColPosition)) " " (row.position.as_str()) " · "
392- }
393- <span class=(row.state_class)>(row.state)</span>
394- " · " <code>(row.branch.as_str())</code>
395- " · " (row.by.as_str())
396- " · " rel_time(lang: lang, stamp: row.queued_at.as_str())
397- " · "
398- if let Some(href) = row.run_href.as_ref() {
399- <a href=(href.as_str())>(row.run_label.as_str())</a>
400- } else {
401- <span>(row.run_label.as_str())</span>
402- }
403- if !row.reason.is_empty() {
404- " · " (row.reason.as_str())
405- }
406- </span>
407- </summary>
408- <div class="opened">
409- confirm_act(lang: lang, label: remove_label, action: row.remove_action.as_str(), csrf: csrf.as_str(), note: Some(remove_note.clone()))
410- </div>
411- </details>
386+ <div class="line" data-kb-row="">
387+ <span class="name"><a href=(row.pull_href.as_str())>"#"(row.pull_number)" "(row.pull_title.as_str())</a></span>
388+ <span class="val">
389+ if !row.position.is_empty() {
390+ (g::t(lang, K::QueueColPosition)) " " (row.position.as_str()) " · "
391+ }
392+ <span class=(row.state_class)>(row.state)</span>
393+ " · " <code>(row.branch.as_str())</code>
394+ " · " (row.by.as_str())
395+ " · " rel_time(lang: lang, stamp: row.queued_at.as_str())
396+ " · "
397+ if let Some(href) = row.run_href.as_ref() {
398+ <a href=(href.as_str())>(row.run_label.as_str())</a>
399+ } else {
400+ <span>(row.run_label.as_str())</span>
401+ }
402+ if !row.reason.is_empty() {
403+ " · " (row.reason.as_str())
404+ }
405+ </span>
406+ confirm_act(lang: lang, label: remove_label, action: row.remove_action.as_str(), csrf: csrf.as_str(), note: Some(remove_note.clone()))
407+ </div>
412408 } else {
413409 <div class="line" data-kb-row="">
414410 <span class="name"><a href=(row.pull_href.as_str())>"#"(row.pull_number)" "(row.pull_title.as_str())</a></span>
crates/forge-web/src/pages/packages_oci.rsmodified+9 -16
@@ -151,22 +151,15 @@ pub async fn oci_package_view(page: OciPage) -> Result<impl View> {
151151 if has_tags {
152152 <div>
153153 for (tag, short, full, size, created) in rows.iter() {
154- <details class="row-open" data-kb-row="">
155- <summary class="line">
156- <span class="name"><code>(tag.as_str())</code></span>
157- <span class="val"><code>(short.as_str())</code> " · " (size.as_str()) " · " rel_time(lang: lang, stamp: created.as_str())</span>
158- </summary>
159- <div class="opened">
160- <code class="hint">(full.as_str())</code>
161- if can_delete {
162- <div class="acts">
163- confirm_act(lang: lang, label: pk::t(lang, K::DeleteTag), action: delete_action.as_str(), csrf: csrf.as_str(),
164- fields: vec![("package".to_owned(), package.name.clone()), ("tag".to_owned(), tag.clone())],
165- note: Some(pk::t(lang, K::DeleteTagMessage).to_owned()))
166- </div>
167- }
168- </div>
169- </details>
154+ <div class="line" data-kb-row="">
155+ <span class="name"><code>(tag.as_str())</code></span>
156+ <span class="val"><code>(short.as_str())</code> " · " (size.as_str()) " · " rel_time(lang: lang, stamp: created.as_str()) " · " <code>(full.as_str())</code></span>
157+ if can_delete {
158+ confirm_act(lang: lang, label: pk::t(lang, K::DeleteTag), action: delete_action.as_str(), csrf: csrf.as_str(),
159+ fields: vec![("package".to_owned(), package.name.clone()), ("tag".to_owned(), tag.clone())],
160+ note: Some(pk::t(lang, K::DeleteTagMessage).to_owned()))
161+ }
162+ </div>
170163 }
171164 </div>
172165 } else {
crates/forge-web/src/pages/palette.rsmodified+9 -5
@@ -77,10 +77,6 @@ const SETTINGS_TERMS: &[(&str, &[&str])] = &[
7777 "/settings/tokens",
7878 &["API", "PAT", "Personal access token", "Erişim belirteci"],
7979 ),
80- (
81- "/settings/sessions",
82- &["Devices", "Cihazlar", "Sign out", "Logged in", "Oturumlar"],
83- ),
8480 (
8581 "/settings/security",
8682 &[
@@ -101,6 +97,12 @@ const SETTINGS_TERMS: &[(&str, &[&str])] = &[
10197 "Delete account",
10298 "Hesabı sil",
10399 "Security log",
100+ "Sessions",
101+ "Devices",
102+ "Cihazlar",
103+ "Sign out",
104+ "Logged in",
105+ "Oturumlar",
104106 ],
105107 ),
106108 (
@@ -224,7 +226,9 @@ fn term_in_lang(term: &str, lang: Lang) -> bool {
224226 return true;
225227 }
226228 let turkish = term.chars().any(|c| "çğıöşüÇĞİÖŞÜ".contains(c))
227- || TURKISH_WORDS.iter().any(|word| word.eq_ignore_ascii_case(term));
229+ || TURKISH_WORDS
230+ .iter()
231+ .any(|word| word.eq_ignore_ascii_case(term));
228232 turkish == matches!(lang, Lang::Tr)
229233 }
230234
crates/forge-web/src/pages/refs.rsmodified+7 -12
@@ -114,18 +114,13 @@ async fn refs_table(rows: Vec<RefRow>, lang: Lang) -> Result<impl View> {
114114 <div class="sheet">
115115 for row in rows.into_iter() {
116116 if let Some(last) = row.last {
117- <details class="row-open" data-kb-row="">
118- <summary class="line">
119- <a class="name" href=(row.href)>(row.name)</a>
120- if row.is_default {
121- <span class="hint">(g::t(lang, K::DefaultBadge))</span>
122- }
123- <span class="val"><time datetime=(last.iso.clone()) title=(last.absolute)>(last.age)</time></span>
124- </summary>
125- <div class="opened">
126- <p><a href=(last.href)>commit_line(subject: last.summary.clone())</a></p>
127- </div>
128- </details>
117+ <div class="line" data-kb-row="">
118+ <a class="name" href=(row.href)>(row.name)</a>
119+ if row.is_default {
120+ <span class="hint">(g::t(lang, K::DefaultBadge))</span>
121+ }
122+ <span class="val"><a href=(last.href)>commit_line(subject: last.summary.clone())</a> " · " <time datetime=(last.iso.clone()) title=(last.absolute)>(last.age)</time></span>
123+ </div>
129124 } else {
130125 <div class="line" data-kb-row="">
131126 <a class="name" href=(row.href)>(row.name)</a>
crates/forge-web/src/pages/repo.rsmodified+2 -4
@@ -34,9 +34,7 @@ use crate::pages::tree::{
3434 use crate::state::AppState;
3535 use crate::views::parts::{SubPart, head_sub};
3636 use crate::views::repo_list::badge_class;
37-use crate::views::{
38- now_unix, ref_selector, relative_time, repo_href, repo_tabs, shell,
39-};
37+use crate::views::{now_unix, ref_selector, relative_time, repo_href, repo_tabs, shell};
4038
4139 path_param!(owner);
4240 path_param!(repo);
@@ -63,7 +61,7 @@ pub fn ssh_clone_url(config: &Config, owner: &str, name: &str) -> String {
6361 }
6462
6563 /// The title a repo page shows when it gives none: the tab it is on.
66-fn tab_title(lang: Lang, active: &str, repo: &str) -> String {
64+pub(crate) fn tab_title(lang: Lang, active: &str, repo: &str) -> String {
6765 match active {
6866 "issues" => g::t(lang, K::TabIssues).to_owned(),
6967 "pulls" => g::t(lang, K::TabPulls).to_owned(),
crates/forge-web/src/pages/repo_secrets.rsmodified+7 -13
@@ -241,19 +241,13 @@ async fn secrets_body(
241241 <span class="val">rel_time(lang: lang, stamp: row.updated_at.as_str())</span>
242242 </div>
243243 } else {
244- <details class="row-open">
245- <summary class="line">
246- <span class="name"><code>(row.name.as_str())</code></span>
247- <span class="val">rel_time(lang: lang, stamp: row.updated_at.as_str())</span>
248- </summary>
249- <div class="opened">
250- <div class="acts">
251- confirm_act(lang: lang, label: g::t(lang, K::Delete), action: delete_action.as_str(), csrf: csrf.as_str(),
252- fields: vec![("name".to_owned(), row.name.clone())],
253- note: Some(passkeys::s(lang, "Jobs that use it fail until it is set again.", "Onu kullanan işler, yeniden ayarlanana kadar başarısız olur.").to_owned()))
254- </div>
255- </div>
256- </details>
244+ <div class="line">
245+ <span class="name"><code>(row.name.as_str())</code></span>
246+ <span class="val">rel_time(lang: lang, stamp: row.updated_at.as_str())</span>
247+ confirm_act(lang: lang, label: g::t(lang, K::Delete), action: delete_action.as_str(), csrf: csrf.as_str(),
248+ fields: vec![("name".to_owned(), row.name.clone())],
249+ note: Some(passkeys::s(lang, "Jobs that use it fail until it is set again.", "Onu kullanan işler, yeniden ayarlanana kadar başarısız olur.").to_owned()))
250+ </div>
257251 }
258252 }
259253 </div>
crates/forge-web/src/pages/repo_security.rsmodified+11 -18
@@ -136,24 +136,17 @@ async fn security_body(
136136 }
137137 <div>
138138 for row in rows.iter() {
139- <details class="row-open" data-kb-row="">
140- <summary class="line">
141- <span class="name">(row.advisory.as_str())</span>
142- <span class="val"><code>(row.package.as_str())</code> " " <code>(row.version.as_str())</code> " · " (row.severity.as_str()) " · " <span class=(row.state_class)>(row.state_text)</span> " · " rel_time(lang: lang, stamp: row.created_at.as_str())</span>
143- </summary>
144- <div class="opened">
145- <p class="hint"><a href=(row.osv_href.as_str()) rel="noopener noreferrer">(crate::pages::passkeys::s(lang, "Details on osv.dev", "osv.dev'de ayrıntılar"))</a></p>
146- <p class="hint">(row.summary.as_str())</p>
147- <div class="acts">
148- if row.open {
149- post_act(label: g::t(lang, K::Dismiss), action: row.dismiss_action.as_str(), csrf: csrf.as_str(), fields: row.fields.clone())
150- }
151- if row.dismissed {
152- post_act(label: g::t(lang, K::Reopen), action: row.reopen_action.as_str(), csrf: csrf.as_str(), fields: row.fields.clone())
153- }
154- </div>
155- </div>
156- </details>
139+ <div class="line" data-kb-row="">
140+ <span class="name" title=(row.summary.as_str())>(row.advisory.as_str())</span>
141+ <span class="val"><code>(row.package.as_str())</code> " " <code>(row.version.as_str())</code> " · " (row.severity.as_str()) " · " <span class=(row.state_class)>(row.state_text)</span> " · " rel_time(lang: lang, stamp: row.created_at.as_str())</span>
142+ <a class="act" href=(row.osv_href.as_str()) rel="noopener noreferrer">(crate::pages::passkeys::s(lang, "osv.dev", "osv.dev"))</a>
143+ if row.open {
144+ post_act(label: g::t(lang, K::Dismiss), action: row.dismiss_action.as_str(), csrf: csrf.as_str(), fields: row.fields.clone())
145+ }
146+ if row.dismissed {
147+ post_act(label: g::t(lang, K::Reopen), action: row.reopen_action.as_str(), csrf: csrf.as_str(), fields: row.fields.clone())
148+ }
149+ </div>
157150 }
158151 </div>
159152 </section>
crates/forge-web/src/pages/settings_appearance.rsmodified+6 -7
@@ -345,7 +345,7 @@ async fn colour_row(row: ColourRow) -> Result<impl View> {
345345 <label class="colour-choice">
346346 <input type="radio" name=(field) value=(value.as_str()) checked=(stripe.custom) data-hue-custom="true" data-autosubmit="true">
347347 <span class=(custom_swatch) aria-hidden="true"></span>
348- <span class="sr-only">(custom_label)</span>
348+ <span class="custom-word">(custom_label)</span>
349349 </label>
350350 <div class="tune">
351351 <input type="range" class="hue-stripe" min="0" max="359" value=(hue_value.as_str()) aria-label=(hue_label) data-hue-stripe="true" data-autosubmit="true">
@@ -735,9 +735,7 @@ mod tests {
735735 "base: empty"
736736 );
737737
738- for id in [
739- "sage", "spark", "ocean", "plum", "rose", "gold", "ember", "hue-0", "hue-359",
740- ] {
738+ for id in ["sage", "ocean", "plum", "rose", "ember", "hue-0", "hue-359"] {
741739 assert_eq!(
742740 accent_choice(Lang::En, Some(id), "sage").unwrap(),
743741 id,
@@ -748,9 +746,7 @@ mod tests {
748746 "accent upper case {id}"
749747 );
750748 }
751- for id in [
752- "fern", "spark", "graphite", "dusk", "ink", "anvil", "hue-120",
753- ] {
749+ for id in ["fern", "graphite", "dusk", "ink", "anvil", "hue-120"] {
754750 assert_eq!(
755751 base_choice(Lang::Tr, Some(id), "fern").unwrap(),
756752 id,
@@ -766,6 +762,8 @@ mod tests {
766762 "teal",
767763 "moss",
768764 "terracotta",
765+ "spark",
766+ "gold",
769767 "hue-360",
770768 "hue-07",
771769 "hue-",
@@ -782,6 +780,7 @@ mod tests {
782780 "blush",
783781 "pine",
784782 "slate-blue",
783+ "spark",
785784 "hue-360",
786785 "hue-07",
787786 ] {
crates/forge-web/src/pages/settings_gpg.rsmodified+7 -14
@@ -14,10 +14,10 @@ use topcoat::view::{View, component, view};
1414 use crate::audit::{self, Actor, Target};
1515 use crate::auth::{require_csrf, require_user};
1616 use crate::i18n::{self, Key, Lang, t};
17-use crate::signatures;
18-use crate::state::AppState;
1917 use crate::pages::passkeys::s;
2018 use crate::pages::settings_keys::{AddQuery, KeyKind, KeysDraft, keys_page_view};
19+use crate::signatures;
20+use crate::state::AppState;
2121 use crate::views::parts::confirm_act;
2222 use crate::views::{added_status, alert, user_facing_message};
2323
@@ -75,18 +75,11 @@ pub(crate) async fn gpg_section(
7575 <p class="state">(t(lang, Key::NoGpgKeys))</p>
7676 }
7777 for key in keys.into_iter() {
78- <details class="row-open">
79- <summary class="line">
80- <span class="name">(key.emails.join(", "))</span>
81- <span class="val">added_status(lang: lang, added: Some(key.created_at.as_str()), used: None)</span>
82- </summary>
83- <div class="opened">
84- <code class="hint">(key.fingerprint.clone())</code>
85- <div class="acts">
86- confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/gpg/delete", csrf: csrf, fields: vec![("id".to_owned(), key.id.clone())])
87- </div>
88- </div>
89- </details>
78+ <div class="line">
79+ <span class="name">(key.emails.join(", "))</span>
80+ <span class="val"><code>(key.fingerprint.clone())</code> " · " added_status(lang: lang, added: Some(key.created_at.as_str()), used: None)</span>
81+ confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/gpg/delete", csrf: csrf, fields: vec![("id".to_owned(), key.id.clone())])
82+ </div>
9083 }
9184 })
9285 }
crates/forge-web/src/pages/settings_keys.rsmodified+20 -18
@@ -15,10 +15,10 @@ use topcoat::view::{View, component, view};
1515 use crate::audit::{self, Actor, Target};
1616 use crate::auth::{require_csrf, require_user};
1717 use crate::i18n::{self, Key, Lang, t, unsupported_key_type};
18-use crate::state::AppState;
18+use crate::pages::passkeys::s;
1919 use crate::pages::settings_gpg::gpg_section;
2020 use crate::pages::settings_tokens::tokens_section;
21-use crate::pages::passkeys::s;
21+use crate::state::AppState;
2222 use crate::views::parts::{RailItem, SubPart, confirm_act, head, rail};
2323 use crate::views::{added_status, alert, shell, user_facing_message};
2424
@@ -189,8 +189,16 @@ impl KeyKind {
189189 fn about(self, lang: Lang) -> &'static str {
190190 match self {
191191 KeyKind::Ssh => s(lang, "Push and pull over SSH", "SSH ile gönder ve çek"),
192- KeyKind::Gpg => s(lang, "Verify the commits you sign", "İmzaladığın commit'leri doğrula"),
193- KeyKind::Tokens => s(lang, "Sign in from the command line and from scripts", "Komut satırından ve betiklerden giriş yap"),
192+ KeyKind::Gpg => s(
193+ lang,
194+ "Verify the commits you sign",
195+ "İmzaladığın commit'leri doğrula",
196+ ),
197+ KeyKind::Tokens => s(
198+ lang,
199+ "Sign in from the command line and from scripts",
200+ "Komut satırından ve betiklerden giriş yap",
201+ ),
194202 }
195203 }
196204 }
@@ -237,8 +245,10 @@ pub(crate) async fn keys_page_view(
237245 || draft.ssh_error.is_some()
238246 || draft.gpg_error.is_some()
239247 || draft.token_error.is_some();
248+ // The path bar names the Keys tab between Settings and the kind, as every tab's page does.
249+ let parents = vec![(pk_title(lang).to_owned(), "/settings/keys".to_owned())];
240250 Ok(view! {
241- shell(title: kind.title(lang), viewer: Some(viewer),
251+ shell(title: kind.title(lang), viewer: Some(viewer), parents: parents,
242252 head(title: kind.title(lang), sub: sub,
243253 <a class="button primary" href=(add_href)>(kind.add_label(lang))</a>
244254 )
@@ -308,19 +318,11 @@ async fn ssh_section(
308318 <p class="state">(t(lang, Key::NoSshKeys))</p>
309319 }
310320 for key in keys.into_iter() {
311- <details class="row-open">
312- <summary class="line">
313- <span class="name">(key.title.clone())</span>
314- <span class="val mono">(key.fingerprint.chars().take(15).collect::<String>())</span>
315- <span class="val">added_status(lang: lang, added: Some(key.created_at.as_str()), used: key.last_used_at.as_deref())</span>
316- </summary>
317- <div class="opened">
318- <code class="hint">(key.algorithm.clone()) " " (key.fingerprint.clone())</code>
319- <div class="acts">
320- confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/keys/delete", csrf: csrf, fields: vec![("id".to_owned(), key.id.clone())])
321- </div>
322- </div>
323- </details>
321+ <div class="line">
322+ <span class="name">(key.title.clone())</span>
323+ <span class="val"><code>(key.algorithm.clone()) " " (key.fingerprint.clone())</code> " · " added_status(lang: lang, added: Some(key.created_at.as_str()), used: key.last_used_at.as_deref())</span>
324+ confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/keys/delete", csrf: csrf, fields: vec![("id".to_owned(), key.id.clone())])
325+ </div>
324326 }
325327 })
326328 }
crates/forge-web/src/pages/settings_notifications.rsmodified+11 -18
@@ -126,24 +126,17 @@ async fn notifications_body(page: NotificationsPage) -> Result<impl View> {
126126 <p class="state">(push_text::t(lang, push_text::K::DevicesEmpty))</p>
127127 }
128128 for device in devices.into_iter() {
129- <details class="row-open">
130- <summary class="line">
131- <span class="name">(device.agent_label.as_str())</span>
132- <span class="val">(push_text::added_label(lang)) " " rel_time(lang: lang, stamp: device.created_at.as_str())</span>
133- </summary>
134- <div class="opened">
135- <p class="hint">
136- if let Some(stamp) = device.last_success_at.as_deref() {
137- (push_text::last_delivered_label(lang)) " " rel_time(lang: lang, stamp: stamp)
138- } else {
139- (push_text::t(lang, push_text::K::NeverDelivered))
140- }
141- </p>
142- <div class="acts">
143- confirm_act(lang: lang, label: push_text::t(lang, push_text::K::RemoveDevice), action: "/settings/notifications/push/remove", csrf: csrf.as_str(), fields: vec![("id".to_owned(), device.id.clone())])
144- </div>
145- </div>
146- </details>
129+ <div class="line">
130+ <span class="name">(device.agent_label.as_str())</span>
131+ <span class="val">(push_text::added_label(lang)) " " rel_time(lang: lang, stamp: device.created_at.as_str()) " · "
132+ if let Some(stamp) = device.last_success_at.as_deref() {
133+ (push_text::last_delivered_label(lang)) " " rel_time(lang: lang, stamp: stamp)
134+ } else {
135+ (push_text::t(lang, push_text::K::NeverDelivered))
136+ }
137+ </span>
138+ confirm_act(lang: lang, label: push_text::t(lang, push_text::K::RemoveDevice), action: "/settings/notifications/push/remove", csrf: csrf.as_str(), fields: vec![("id".to_owned(), device.id.clone())])
139+ </div>
147140 }
148141 </section>
149142 </div>
crates/forge-web/src/pages/settings_security.rsmodified+192 -107
@@ -26,9 +26,10 @@ use crate::i18n::packages::{self as pk, K as PK};
2626 use crate::i18n::releases_ci::{self as rc, K as RC};
2727 use crate::i18n::{self, Key, Lang, password_too_long, password_too_short, t};
2828 use crate::pages::passkeys::{PasskeyPanel, build_panel, passkeys_panel, s};
29+use crate::pages::settings_sessions::session_label;
2930 use crate::state::AppState;
3031 use crate::throttle::{self, LOGIN_USER_LIMIT, TWO_FACTOR_USER_LIMIT};
31-use crate::views::parts::{RailItem, SubPart, head, post_act, rail, reveal};
32+use crate::views::parts::{RailItem, SubPart, confirm_act, head, post_act, rail, reveal};
3233 use crate::views::{added_status, alert, rel_time, shell, user_facing_message};
3334
3435 /// Shortest and longest new passwords, in characters.
@@ -186,12 +187,106 @@ struct SecurityPage {
186187 passkeys: PasskeyPanel,
187188 /// Repositories still owned by the user. Deletion is refused while there are any.
188189 owned_repos: Vec<String>,
189- /// Web sessions open on the account, the count the Sessions topic shows.
190- session_count: usize,
190+ /// Web sessions open on the account, listed by the Sessions topic.
191+ sessions: Vec<Session>,
192+ /// The id of the session that is viewing the page.
193+ current_session_id: String,
191194 /// The topic asked for in the address, when no error or notice picks one.
192195 part: Option<String>,
193196 }
194197
198+/// The rail's kinds of security, one per topic. `active` names the topic that is shown, or
199+/// "log" for the security log page, which the last item opens.
200+pub(crate) fn security_rail_items(
201+ lang: Lang,
202+ active: &str,
203+ two_factor_on: bool,
204+ passkey_count: usize,
205+ session_count: usize,
206+) -> Vec<RailItem> {
207+ let two_factor_val = if two_factor_on {
208+ t(lang, Key::PillOn)
209+ } else {
210+ t(lang, Key::PillOff)
211+ };
212+ vec![
213+ RailItem {
214+ name: t(lang, Key::Password).to_owned(),
215+ val: String::new(),
216+ href: "/settings/security?part=password".to_owned(),
217+ current: active == "password",
218+ },
219+ RailItem {
220+ name: t(lang, Key::Email).to_owned(),
221+ val: String::new(),
222+ href: "/settings/security?part=email".to_owned(),
223+ current: active == "email",
224+ },
225+ RailItem {
226+ name: t(lang, Key::TwoFactorAuth).to_owned(),
227+ val: two_factor_val.to_owned(),
228+ href: "/settings/security?part=two-factor".to_owned(),
229+ current: active == "two-factor",
230+ },
231+ RailItem {
232+ name: s(lang, "Passkeys", "Geçiş anahtarları").to_owned(),
233+ val: passkey_count.to_string(),
234+ href: "/settings/security?part=passkeys".to_owned(),
235+ current: active == "passkeys",
236+ },
237+ RailItem {
238+ name: t(lang, Key::Sessions).to_owned(),
239+ val: session_count.to_string(),
240+ href: "/settings/security?part=sessions".to_owned(),
241+ current: active == "sessions",
242+ },
243+ RailItem {
244+ name: t(lang, Key::SecurityLog).to_owned(),
245+ val: String::new(),
246+ href: "/settings/security/log".to_owned(),
247+ current: active == "log",
248+ },
249+ RailItem {
250+ name: t(lang, Key::DangerZone).to_owned(),
251+ val: String::new(),
252+ href: "/settings/security?part=danger".to_owned(),
253+ current: active == "danger",
254+ },
255+ ]
256+}
257+
258+/// The Security tab's head line, shared by the topics and the security log.
259+pub(crate) fn security_sub(lang: Lang) -> &'static str {
260+ s(
261+ lang,
262+ "Sign-in, email, two-factor, passkeys and sessions",
263+ "Giriş, e-posta, iki adımlı doğrulama, geçiş anahtarları ve oturumlar",
264+ )
265+}
266+
267+/// The rail for a page outside the topics (the security log), with live counts.
268+pub(crate) async fn security_rail_for(
269+ state: &AppState,
270+ lang: Lang,
271+ viewer: &(User, Session),
272+ active: &str,
273+) -> forge_core::Result<Vec<RailItem>> {
274+ let two_factor_on = state
275+ .store
276+ .totp_state(&viewer.0.id)
277+ .await?
278+ .is_some_and(|totp| totp.enabled);
279+ let passkey_count = state.store.list_passkeys(&viewer.0.id).await?.len();
280+ let session_count = state.store.list_sessions(&viewer.0.id).await?.len();
281+ Ok(security_rail_items(
282+ lang,
283+ active,
284+ two_factor_on,
285+ passkey_count,
286+ session_count,
287+ ))
288+}
289+
195290 #[component]
196291 async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
197292 let SecurityPage {
@@ -213,11 +308,17 @@ async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
213308 delete_error,
214309 passkeys,
215310 owned_repos,
216- session_count,
311+ sessions,
312+ current_session_id,
217313 part,
218314 } = page;
219315 let two_factor_on = two_factor.is_some();
220316 let passkey_count = passkeys.items.len();
317+ let session_count = sessions.len();
318+ let others = sessions
319+ .iter()
320+ .filter(|session| session.id != current_session_id)
321+ .count();
221322 let pending_set = pending.is_some();
222323 let password_open = password_error.is_some();
223324 let email_open = email_error.is_some();
@@ -234,19 +335,25 @@ async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
234335 let disable_open = disable_error.is_some();
235336 let delete_open = delete_error.is_some();
236337 let delete_blocked = !owned_repos.is_empty();
237- let sessions_line = format!("{session_count} {}", s(lang, "active", "etkin"));
238- let two_factor_val = if two_factor_on {
239- t(lang, Key::PillOn)
240- } else {
241- t(lang, Key::PillOff)
242- };
243338 // One topic shows at a time: the one with an error or fresh codes, else the one asked for.
244- const TOPICS: [&str; 6] = ["password", "email", "two-factor", "passkeys", "sessions", "danger"];
339+ const TOPICS: [&str; 6] = [
340+ "password",
341+ "email",
342+ "two-factor",
343+ "passkeys",
344+ "sessions",
345+ "danger",
346+ ];
245347 let active: &'static str = if password_open {
246348 "password"
247349 } else if email_open {
248350 "email"
249- } else if regenerate_open || disable_open || setup_error.is_some() || codes.is_some() || (pending_set && part.is_none()) {
351+ } else if regenerate_open
352+ || disable_open
353+ || setup_error.is_some()
354+ || codes.is_some()
355+ || (pending_set && part.is_none())
356+ {
250357 "two-factor"
251358 } else if delete_open {
252359 "danger"
@@ -255,47 +362,9 @@ async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
255362 .and_then(|asked| TOPICS.into_iter().find(|topic| *topic == asked))
256363 .unwrap_or("password")
257364 };
258- // The kinds of security, one per topic. Each shows its topic in the sheet.
259- let items: Vec<RailItem> = vec![
260- RailItem {
261- name: t(lang, Key::Password).to_owned(),
262- val: String::new(),
263- href: "?part=password".to_owned(),
264- current: active == "password",
265- },
266- RailItem {
267- name: t(lang, Key::Email).to_owned(),
268- val: String::new(),
269- href: "?part=email".to_owned(),
270- current: active == "email",
271- },
272- RailItem {
273- name: t(lang, Key::TwoFactorAuth).to_owned(),
274- val: two_factor_val.to_owned(),
275- href: "?part=two-factor".to_owned(),
276- current: active == "two-factor",
277- },
278- RailItem {
279- name: s(lang, "Passkeys", "Geçiş anahtarları").to_owned(),
280- val: passkey_count.to_string(),
281- href: "?part=passkeys".to_owned(),
282- current: active == "passkeys",
283- },
284- RailItem {
285- name: t(lang, Key::Sessions).to_owned(),
286- val: session_count.to_string(),
287- href: "?part=sessions".to_owned(),
288- current: active == "sessions",
289- },
290- RailItem {
291- name: t(lang, Key::DangerZone).to_owned(),
292- val: String::new(),
293- href: "?part=danger".to_owned(),
294- current: active == "danger",
295- },
296- ];
365+ let items = security_rail_items(lang, active, two_factor_on, passkey_count, session_count);
297366 Ok(view! {
298- head(title: t(lang, Key::Security), sub: vec![SubPart::text(s(lang, "Sign-in, email, two-factor, passkeys and sessions", "Giriş, e-posta, iki adımlı doğrulama, geçiş anahtarları ve oturumlar"))])
367+ head(title: t(lang, Key::Security), sub: vec![SubPart::text(security_sub(lang))])
299368 if let Some(message) = notice {
300369 <p class="state" role="status">(message)</p>
301370 }
@@ -307,30 +376,26 @@ async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
307376 if let Some(stamp) = password_changed {
308377 <p class="state">(i18n::last_changed_label(lang)) " " rel_time(lang: lang, stamp: stamp.as_str())</p>
309378 }
310- <div class="acts">
311- reveal(label: t(lang, Key::ChangeAction), open: password_open,
312- if let Some(message) = password_error {
313- alert(message: message.as_str())
314- }
315- <form data-hard="true" method="post" action="/settings/security/password" class="fields">
316- <input type="hidden" name="csrf" value=(csrf)>
317- <div class="field">
318- <label for="current-password">(t(lang, Key::CurrentPassword))</label>
319- <input id="current-password" type="password" name="current_password" autocomplete="current-password" required=(true)>
320- </div>
321- <div class="field">
322- <label for="new-password">(t(lang, Key::NewPassword))</label>
323- <input id="new-password" type="password" name="new_password" autocomplete="new-password" minlength="10" maxlength="1024" required=(true)>
324- <p class="hint">(t(lang, Key::NewPasswordHint))</p>
325- </div>
326- <div class="field">
327- <label for="confirm-password">(t(lang, Key::ConfirmNewPassword))</label>
328- <input id="confirm-password" type="password" name="confirm_password" autocomplete="new-password" required=(true)>
329- </div>
330- <button type="submit" class="primary">(t(lang, Key::ChangePassword))</button>
331- </form>
332- )
333- </div>
379+ if let Some(message) = password_error {
380+ alert(message: message.as_str())
381+ }
382+ <form data-hard="true" method="post" action="/settings/security/password" class="fields">
383+ <input type="hidden" name="csrf" value=(csrf)>
384+ <div class="field">
385+ <label for="current-password">(t(lang, Key::CurrentPassword))</label>
386+ <input id="current-password" type="password" name="current_password" autocomplete="current-password" required=(true)>
387+ </div>
388+ <div class="field">
389+ <label for="new-password">(t(lang, Key::NewPassword))</label>
390+ <input id="new-password" type="password" name="new_password" autocomplete="new-password" minlength="10" maxlength="1024" required=(true)>
391+ <p class="hint">(t(lang, Key::NewPasswordHint))</p>
392+ </div>
393+ <div class="field">
394+ <label for="confirm-password">(t(lang, Key::ConfirmNewPassword))</label>
395+ <input id="confirm-password" type="password" name="confirm_password" autocomplete="new-password" required=(true)>
396+ </div>
397+ <button type="submit" class="primary">(t(lang, Key::ChangePassword))</button>
398+ </form>
334399 </section>
335400 <section class="sec" id="email">
336401 <h2>(t(lang, Key::Email))</h2>
@@ -339,28 +404,26 @@ async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
339404 } else {
340405 <p class="state"><span class="security-email">(stored_email.as_str())</span> (" · ")(email_status.as_str()) if let Some(stamp) = email_sent { " " rel_time(lang: lang, stamp: stamp.as_str()) }</p>
341406 }
342- <div class="acts">
343- reveal(label: t(lang, Key::ChangeAction), open: email_open,
344- if let Some(message) = email_error {
345- alert(message: message.as_str())
346- }
347- <form method="post" action="/settings/security/email" class="fields">
348- <input type="hidden" name="csrf" value=(csrf)>
349- <div class="field">
350- <label for="email-address">(t(lang, Key::Email))</label>
351- <input id="email-address" type="email" name="email" autocomplete="email" maxlength="254" required=(true) value=(email.as_str())>
352- </div>
353- <div class="field">
354- <label for="email-current-password">(t(lang, Key::CurrentPassword))</label>
355- <input id="email-current-password" type="password" name="current_password" autocomplete="current-password" required=(true)>
356- </div>
357- <button type="submit" class="primary">(t(lang, Key::SaveEmail))</button>
358- </form>
359- )
360- if show_resend {
407+ if let Some(message) = email_error {
408+ alert(message: message.as_str())
409+ }
410+ <form method="post" action="/settings/security/email" class="fields">
411+ <input type="hidden" name="csrf" value=(csrf)>
412+ <div class="field">
413+ <label for="email-address">(t(lang, Key::Email))</label>
414+ <input id="email-address" type="email" name="email" autocomplete="email" maxlength="254" required=(true) value=(email.as_str())>
415+ </div>
416+ <div class="field">
417+ <label for="email-current-password">(t(lang, Key::CurrentPassword))</label>
418+ <input id="email-current-password" type="password" name="current_password" autocomplete="current-password" required=(true)>
419+ </div>
420+ <button type="submit" class="primary">(t(lang, Key::SaveEmail))</button>
421+ </form>
422+ if show_resend {
423+ <div class="acts">
361424 post_act(label: t(lang, Key::VerifyResend), action: "/settings/security/email/resend", csrf: csrf)
362- }
363- </div>
425+ </div>
426+ }
364427 </section>
365428 <section class="sec" id="two-factor">
366429 <h2>(t(lang, Key::TwoFactorAuth))</h2>
@@ -458,12 +521,28 @@ async fn security_body(page: SecurityPage, csrf: &str) -> Result<impl View> {
458521 passkeys_panel(lang: lang, csrf: csrf, panel: passkeys)
459522 <section class="sec" id="sessions">
460523 <h2>(t(lang, Key::Sessions))</h2>
461- <p class="state">(sessions_line.as_str())</p>
462- <p class="hint">(t(lang, Key::SecurityLog))(t(lang, Key::SecurityLogRest))</p>
463- <div class="acts">
464- <a class="act" href="/settings/sessions">(s(lang, "Review", "Gözden geçir"))</a>
465- <a class="act" href="/settings/security/log">(t(lang, Key::SecurityLog))</a>
466- </div>
524+ if others > 0 {
525+ <div class="acts">
526+ confirm_act(lang: lang, label: t(lang, Key::RevokeAllOthers), action: "/settings/sessions/revoke-others", csrf: csrf, note: Some(s(lang, "Every other browser is signed out at once. This one stays signed in.", "Diğer tüm tarayıcılarda oturum hemen kapanır. Bu tarayıcıda oturum açık kalır.").to_owned()))
527+ </div>
528+ }
529+ for session in sessions.into_iter() {
530+ <div class="line">
531+ <span class="name">(session_label(lang, &session))</span>
532+ <span class="val">
533+ if session.id == current_session_id {
534+ (t(lang, Key::ThisSession)) " · "
535+ }
536+ if let Some(ip) = session.last_ip.as_deref() {
537+ (ip) " · "
538+ }
539+ (i18n::dated_label(lang, Key::LastSeen)) " " rel_time(lang: lang, stamp: session.last_seen.as_str()) " · " (t(lang, Key::SignedIn)) " " rel_time(lang: lang, stamp: session.created_at.as_str())
540+ </span>
541+ if session.id != current_session_id {
542+ confirm_act(lang: lang, label: t(lang, Key::Revoke), action: "/settings/sessions/revoke", csrf: csrf, fields: vec![("id".to_owned(), session.id.clone())], note: Some(s(lang, "This browser is signed out at once.", "Bu tarayıcıda oturum hemen kapanır.").to_owned()))
543+ }
544+ </div>
545+ }
467546 </section>
468547 <section class="sec" id="danger">
469548 <h2>(t(lang, Key::DangerZone))</h2>
@@ -625,7 +704,8 @@ async fn build_page(
625704 pending,
626705 password_changed,
627706 two_factor,
628- session_count: state.store.list_sessions(&viewer.0.id).await?.len(),
707+ sessions: state.store.list_sessions(&viewer.0.id).await?,
708+ current_session_id: viewer.1.id.clone(),
629709 part: shown.part,
630710 })
631711 }
@@ -1708,7 +1788,11 @@ mod tests {
17081788 assert!(page.body.contains("Added "), "{}", page.body);
17091789 assert!(page.body.contains("1 of 10 recovery codes unused"));
17101790 assert!(page.body.contains("Running low"));
1711- assert!(page.body.contains("<p class=\"state\">On · "), "{}", page.body);
1791+ assert!(
1792+ page.body.contains("<p class=\"state\">On · "),
1793+ "{}",
1794+ page.body
1795+ );
17121796
17131797 let bad = format!(
17141798 "csrf={CSRF}&current_password=nope&code={}",
@@ -1729,8 +1813,9 @@ mod tests {
17291813 .expect("turn-off panel should stay open");
17301814 assert!(
17311815 opened.contains("Turn off")
1732- && opened.split("<details").next().is_some_and(|panel| panel
1733- .contains("action=\"/settings/security/2fa/disable\"")),
1816+ && opened.split("<details").next().is_some_and(
1817+ |panel| panel.contains("action=\"/settings/security/2fa/disable\"")
1818+ ),
17341819 "the open panel should be the turn-off form: {opened}"
17351820 );
17361821 assert!(
crates/forge-web/src/pages/settings_sessions.rsmodified+38 -163
@@ -1,22 +1,19 @@
1-//! Page: web sessions (`/settings/sessions`). Revoke one or all other sessions, and a detail page
2-//! per session (`/settings/sessions/{id}`).
1+//! Page: web sessions. The list and the per-session facts live in Security's Sessions topic
2+//! (`/settings/security?part=sessions`); `/settings/sessions` and `/settings/sessions/{id}` only
3+//! redirect there. This module keeps the revoke actions, which that topic posts to.
34
45 use forge_core::{AuditAction, Session};
56 use serde::Deserialize;
67 use topcoat::Result;
78 use topcoat::context::{Cx, app_context};
89 use topcoat::router::content::Form;
9-use topcoat::router::error::{SeeOther, not_found, see_other};
10-use topcoat::router::{page, path_param_segment, route};
11-use topcoat::view::{View, component, view};
10+use topcoat::router::error::{SeeOther, see_other};
11+use topcoat::router::route;
1212
1313 use crate::audit::{self, Actor, Target};
1414 use crate::auth::{logout, require_csrf, require_user};
15-use crate::i18n::{self, Key, Lang, t};
16-use crate::pages::passkeys::s;
15+use crate::i18n::{Key, Lang, t};
1716 use crate::state::AppState;
18-use crate::views::parts::{SubPart, confirm_act, head};
19-use crate::views::{rel_time, shell};
2017 use crate::web_push::agent_label_in;
2118
2219 #[derive(Deserialize)]
@@ -34,151 +31,23 @@ struct CsrfForm {
3431 }
3532
3633 /// A short title for a session: "Chrome on Linux", or the unknown-browser label.
37-fn session_label(lang: Lang, session: &Session) -> String {
38- session
39- .user_agent
40- .as_deref()
41- .map_or_else(|| t(lang, Key::UnknownBrowser).to_owned(), |agent| agent_label_in(lang, agent))
34+pub(crate) fn session_label(lang: Lang, session: &Session) -> String {
35+ session.user_agent.as_deref().map_or_else(
36+ || t(lang, Key::UnknownBrowser).to_owned(),
37+ |agent| agent_label_in(lang, agent),
38+ )
4239 }
4340
44-#[component]
45-async fn sessions_view(
46- lang: Lang,
47- csrf: &str,
48- current_id: &str,
49- sessions: Vec<Session>,
50-) -> Result<impl View> {
51- let others = sessions.iter().filter(|s| s.id != current_id).count();
52- Ok(view! {
53- head(title: t(lang, Key::Sessions), sub: vec![SubPart::text(s(lang, "Where you are signed in", "Oturum açık olduğun yerler"))])
54- <div class="sheet fit">
55- if others > 0 {
56- <div class="acts">
57- confirm_act(lang: lang, label: t(lang, Key::RevokeAllOthers), action: "/settings/sessions/revoke-others", csrf: csrf, note: Some(s(lang, "Every other browser is signed out at once. This one stays signed in.", "Diğer tüm tarayıcılarda oturum hemen kapanır. Bu tarayıcıda oturum açık kalır.").to_owned()))
58- </div>
59- }
60- for session in sessions.into_iter() {
61- <details class="row-open">
62- <summary class="line">
63- <span class="name">(session_label(lang, &session))</span>
64- <span class="val">
65- if session.id == current_id {
66- (t(lang, Key::ThisSession)) " · "
67- }
68- (i18n::dated_label(lang, Key::LastSeen)) " " rel_time(lang: lang, stamp: session.last_seen.as_str())
69- </span>
70- </summary>
71- <div class="opened">
72- session_details(lang: lang, csrf: csrf, session: session.clone(), current: session.id == current_id)
73- <div class="acts">
74- <a class="act" href=(format!("/settings/sessions/{}", session.id))>(s(lang, "Open page", "Sayfayı aç"))</a>
75- </div>
76- </div>
77- </details>
78- }
79- </div>
80- })
41+#[route(GET "/settings/sessions")]
42+async fn sessions_page(cx: &Cx) -> Result<SeeOther> {
43+ require_user(cx).await?;
44+ Ok(see_other("/settings/security?part=sessions"))
8145 }
8246
83-/// The facts about one session, shared by its row on the list and its detail page: the badge
84-/// when it is the current session, the key/value grid, and the revoke action for any other one.
85-#[component]
86-async fn session_details(
87- lang: Lang,
88- csrf: &str,
89- session: Session,
90- current: bool,
91-) -> Result<impl View> {
92- let user_agent = session
93- .user_agent
94- .clone()
95- .unwrap_or_else(|| t(lang, Key::UnknownBrowser).to_owned());
96- // Sessions from before IP recording have no sign-in address.
97- let sign_in_ip = session
98- .ip
99- .clone()
100- .unwrap_or_else(|| t(lang, Key::NotRecorded).to_owned());
101- let last_ip = session
102- .last_ip
103- .clone()
104- .unwrap_or_else(|| t(lang, Key::NotRecorded).to_owned());
105- let id = session.id.clone();
106- Ok(view! {
107- if current {
108- <p class="state">(t(lang, Key::ThisSession))</p>
109- }
110- <dl class="kv-grid">
111- <div><dt>(t(lang, Key::UserAgent))</dt><dd>(user_agent.as_str())</dd></div>
112- <div><dt>(t(lang, Key::SignInIp))</dt><dd>(sign_in_ip.as_str())</dd></div>
113- <div><dt>(t(lang, Key::LastIp))</dt><dd>(last_ip.as_str())</dd></div>
114- <div><dt>(t(lang, Key::SignedIn))</dt><dd>rel_time(lang: lang, stamp: session.created_at.as_str())</dd></div>
115- <div><dt>(t(lang, Key::LastSeenAt))</dt><dd>rel_time(lang: lang, stamp: session.last_seen.as_str())</dd></div>
116- <div><dt>(t(lang, Key::ExpiresAt))</dt><dd>rel_time(lang: lang, stamp: session.expires_at.as_str())</dd></div>
117- </dl>
118- if !current {
119- <div class="acts">
120- confirm_act(lang: lang, label: t(lang, Key::Revoke), action: "/settings/sessions/revoke", csrf: csrf, fields: vec![("id".to_owned(), id)], note: Some(s(lang, "This browser is signed out at once.", "Bu tarayıcıda oturum hemen kapanır.").to_owned()))
121- </div>
122- }
123- })
124-}
125-
126-#[component]
127-async fn session_detail_view(
128- lang: Lang,
129- csrf: &str,
130- session: Session,
131- current: bool,
132-) -> Result<impl View> {
133- let label = session_label(lang, &session);
134- Ok(view! {
135- head(title: label.as_str())
136- <div class="sheet fit">
137- <div class="sheet-tools">
138- <a class="act" href="/settings/sessions">(t(lang, Key::BackToSessions))</a>
139- </div>
140- <section class="sec">
141- <p class="hint">(i18n::dated_label(lang, Key::LastSeen)) " " rel_time(lang: lang, stamp: session.last_seen.as_str())</p>
142- session_details(lang: lang, csrf: csrf, session: session.clone(), current: current)
143- </section>
144- </div>
145- })
146-}
147-
148-#[page("/settings/sessions")]
149-async fn sessions_page(cx: &Cx) -> Result<impl View> {
150- let viewer = require_user(cx).await?;
151- let lang = i18n::lang(cx, Some(&viewer.0));
152- let sessions = app_context::<AppState>(cx)
153- .store
154- .list_sessions(&viewer.0.id)
155- .await?;
156- let csrf = viewer.1.csrf_token.clone();
157- let current_id = viewer.1.id.clone();
158- Ok(view! {
159- shell(title: t(lang, Key::Sessions), viewer: Some(&viewer), sessions_view(lang: lang, csrf: csrf.as_str(), current_id: current_id.as_str(), sessions: sessions))
160- })
161-}
162-
163-#[page("/settings/sessions/{id}")]
164-async fn session_page(cx: &Cx) -> Result<impl View> {
165- let viewer = require_user(cx).await?;
166- let lang = i18n::lang(cx, Some(&viewer.0));
167- let id = path_param_segment(cx, "id").to_owned();
168- // Only the signed-in user's own sessions are shown; anything else is not found.
169- let sessions = app_context::<AppState>(cx)
170- .store
171- .list_sessions(&viewer.0.id)
172- .await?;
173- let Some(session) = sessions.into_iter().find(|s| s.id == id) else {
174- return Err(not_found().into());
175- };
176- let current = session.id == viewer.1.id;
177- let csrf = viewer.1.csrf_token.clone();
178- let title = session_label(lang, &session);
179- Ok(view! {
180- shell(title: title.as_str(), viewer: Some(&viewer), session_detail_view(lang: lang, csrf: csrf.as_str(), session: session, current: current))
181- })
47+#[route(GET "/settings/sessions/{id}")]
48+async fn session_page(cx: &Cx) -> Result<SeeOther> {
49+ require_user(cx).await?;
50+ Ok(see_other("/settings/security?part=sessions"))
18251 }
18352
18453 #[route(POST "/settings/sessions/revoke")]
@@ -220,7 +89,7 @@ async fn sessions_revoke(cx: &Cx, Form(form): Form<RevokeForm>) -> Result<SeeOth
22089 )
22190 .await;
22291 }
223- Ok(see_other("/settings/sessions"))
92+ Ok(see_other("/settings/security?part=sessions"))
22493 }
22594
22695 #[route(POST "/settings/sessions/revoke-others")]
@@ -249,7 +118,7 @@ async fn sessions_revoke_others(cx: &Cx, Form(form): Form<CsrfForm>) -> Result<S
249118 )
250119 .await;
251120 }
252- Ok(see_other("/settings/sessions"))
121+ Ok(see_other("/settings/security?part=sessions"))
253122 }
254123
255124 #[cfg(test)]
@@ -263,7 +132,7 @@ mod tests {
263132 const CSRF: &str = "sessions-test-csrf";
264133
265134 #[tokio::test]
266- async fn sessions_list_renders_a_row_open_per_session() {
135+ async fn sessions_list_moves_to_the_security_sessions_topic() {
267136 let dir = tempfile::tempdir().expect("tempdir");
268137 let state = crate::test_support::test_state(dir.path()).await;
269138 let store = state.store.clone();
@@ -273,12 +142,6 @@ mod tests {
273142 .await
274143 .expect("tahinli");
275144 crate::test_support::create_session(&store, &tahinli.id, "tahinli-token", CSRF).await;
276- let current = store
277- .list_sessions(&tahinli.id)
278- .await
279- .expect("sessions")
280- .pop()
281- .expect("one session");
282145
283146 let req = Request::builder()
284147 .method("GET")
@@ -287,13 +150,25 @@ mod tests {
287150 .body(Body::empty())
288151 .expect("request");
289152 let res = router.handle(req).await;
153+ assert_eq!(res.status().as_u16(), 303);
154+ assert_eq!(
155+ res.headers().get("location").and_then(|v| v.to_str().ok()),
156+ Some("/settings/security?part=sessions")
157+ );
158+ let _ = to_bytes(res.into_body(), usize::MAX).await;
159+
160+ let req = Request::builder()
161+ .method("GET")
162+ .uri("/settings/security?part=sessions")
163+ .header("cookie", format!("__Host-{SESSION_COOKIE}=tahinli-token"))
164+ .body(Body::empty())
165+ .expect("request");
166+ let res = router.handle(req).await;
290167 assert_eq!(res.status().as_u16(), 200);
291168 let body = to_bytes(res.into_body(), usize::MAX).await.expect("body");
292169 let html = String::from_utf8_lossy(&body);
293- assert!(html.contains("<details class=\"row-open\">"));
294- assert!(html.contains("<div class=\"opened\">"));
295- assert!(html.contains("<dl class=\"kv-grid\">"));
296- assert!(html.contains(&format!("href=\"/settings/sessions/{}\"", current.id)));
170+ assert!(html.contains("<div class=\"line\">"));
171+ assert!(html.contains("This session"));
297172 }
298173
299174 #[tokio::test]
crates/forge-web/src/pages/settings_tokens.rsmodified+5 -12
@@ -130,18 +130,11 @@ pub(crate) async fn tokens_section(
130130 <p class="state">(t(lang, Key::NoAccessTokens))</p>
131131 }
132132 for token in tokens.into_iter() {
133- <details class="row-open">
134- <summary class="line">
135- <span class="name">(token.name.clone())</span>
136- <span class="val">(i18n::dated_label(lang, Key::LastUsed)) " " rel_time_or_never(lang: lang, stamp: token.last_used_at.as_deref()) ", " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time_or_never(lang: lang, stamp: token.expires_at.as_deref())</span>
137- </summary>
138- <div class="opened">
139- <p class="hint">(i18n::dated_label(lang, Key::Created)) " " rel_time(lang: lang, stamp: token.created_at.as_str())</p>
140- <div class="acts">
141- confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/tokens/delete", csrf: csrf, fields: vec![("id".to_owned(), token.id.clone())], note: Some(delete_message(lang).to_owned()))
142- </div>
143- </div>
144- </details>
133+ <div class="line">
134+ <span class="name">(token.name.clone())</span>
135+ <span class="val">(i18n::dated_label(lang, Key::LastUsed)) " " rel_time_or_never(lang: lang, stamp: token.last_used_at.as_deref()) " · " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time_or_never(lang: lang, stamp: token.expires_at.as_deref()) " · " (i18n::dated_label(lang, Key::Created)) " " rel_time(lang: lang, stamp: token.created_at.as_str())</span>
136+ confirm_act(lang: lang, label: t(lang, Key::Delete), action: "/settings/tokens/delete", csrf: csrf, fields: vec![("id".to_owned(), token.id.clone())], note: Some(delete_message(lang).to_owned()))
137+ </div>
145138 }
146139 })
147140 }
crates/forge-web/src/views/mod.rsmodified+231 -40
@@ -149,11 +149,39 @@ fn crumb_label(part: &str) -> String {
149149 }
150150 }
151151
152-/// The path bar for a request path, as `(label, href)` pairs. The root and the top-level pages
153-/// return no segments: their page head already shows the name, so the bar only holds its hint. A
154-/// repo path shows the owner, the repo and, for a `tree` or `blob` path, one segment per path
155-/// part. The last segment never links. Labels are decoded.
156-fn path_segments(path: &str, title: &str) -> Vec<(String, Option<String>)> {
152+/// The word a path bar shows for the last step of a path below an item, such as `edit` or `files`.
153+fn step_label(lang: Lang, word: &str) -> String {
154+ match word {
155+ "new" => s(lang, "New", "Yeni").to_owned(),
156+ "edit" => s(lang, "Edit", "Düzenle").to_owned(),
157+ "history" => s(lang, "History", "Geçmiş").to_owned(),
158+ "revisions" => s(lang, "Revisions", "Sürümler").to_owned(),
159+ "files" => s(lang, "Files", "Dosyalar").to_owned(),
160+ "commits" => g::t(lang, K::TabCommits).to_owned(),
161+ other => crumb_label(other),
162+ }
163+}
164+
165+/// The name of a repo section in the path bar, for a page under it. `None` for a word that is no
166+/// section, such as `scrub`.
167+fn repo_section_label(lang: Lang, kind: &str) -> Option<String> {
168+ match kind {
169+ "issues" | "pulls" | "ci" | "commits" | "branches" | "tags" | "releases"
170+ | "discussions" | "wiki" | "security" | "settings" => {
171+ Some(crate::pages::repo::tab_title(lang, kind, ""))
172+ }
173+ "milestones" => Some(s(lang, "Milestones", "Kilometre taşları").to_owned()),
174+ "labels" => Some(s(lang, "Labels", "Etiketler").to_owned()),
175+ _ => None,
176+ }
177+}
178+
179+/// The path bar for a request path, as `(label, href)` pairs: every place above the page links,
180+/// so a page is always one click from the one it belongs to. The root and the top-level pages
181+/// return no segments (their section names them). A repo path shows the owner, the repo, then for
182+/// a page under a section the section, the item (`#12`) and the page; a `tree` or `blob` path has
183+/// one segment per path part. The last segment never links. Labels are decoded.
184+fn path_segments(lang: Lang, path: &str, title: &str) -> Vec<(String, Option<String>)> {
157185 let parts: Vec<String> = path
158186 .trim_matches('/')
159187 .split('/')
@@ -163,6 +191,42 @@ fn path_segments(path: &str, title: &str) -> Vec<(String, Option<String>)> {
163191 let Some(owner) = parts.first() else {
164192 return Vec::new();
165193 };
194+ // The page's own name: the part of its title after the last " · ", when there is one.
195+ let titled = title.rsplit_once(" · ").map(|(_, last)| last.to_owned());
196+ match parts
197+ .iter()
198+ .map(String::as_str)
199+ .collect::<Vec<_>>()
200+ .as_slice()
201+ {
202+ ["snippets", id, rest @ ..] => {
203+ let mut segments = vec![(
204+ cm::t(lang, CK::Snippets).to_owned(),
205+ Some("/snippets".to_owned()),
206+ )];
207+ match rest {
208+ // A snippet's own page is named by its title.
209+ [] => segments.push((title.to_owned(), None)),
210+ // A page under a snippet goes back to the snippet, then names its step. The revisions
211+ // page is titled by the snippet; the edit page by what it does.
212+ [.., last] => {
213+ let back = if *last == "revisions" {
214+ title.to_owned()
215+ } else {
216+ s(lang, "Snippet", "Parçacık").to_owned()
217+ };
218+ segments.push((back, Some(format!("/snippets/{}", enc(id)))));
219+ segments.push((step_label(lang, last), None));
220+ }
221+ }
222+ return segments;
223+ }
224+ ["org", name, rest @ ..] if *name != "new" && !rest.is_empty() => {
225+ let page = titled.unwrap_or_else(|| step_label(lang, rest[rest.len() - 1]));
226+ return vec![((*name).to_owned(), Some(user_href(name))), (page, None)];
227+ }
228+ _ => {}
229+ }
166230 if owner.starts_with('-') || TOP_LEVEL_PAGES.contains(&owner.as_str()) {
167231 return Vec::new();
168232 }
@@ -182,27 +246,115 @@ fn path_segments(path: &str, title: &str) -> Vec<(String, Option<String>)> {
182246 }
183247 // The repo's home: the repo name is the last segment already.
184248 [] => {}
185- // Titles read "owner/repo · Page": the path bar has the repo already. A page titled by
186- // the repo alone is named by its route.
187- [_, ..] => {
188- // A title ending in the repo plus a word ("Install · owner/repo wiki") reads by
189- // the part before it.
249+ [kind, rest @ ..] => {
250+ // Titles read "owner/repo · Page": the path bar has the repo already. A page titled by
251+ // the repo alone is named by its route. A title ending in the repo plus a word
252+ // ("Install · owner/repo wiki") reads by the part before it.
190253 let full = format!("{owner}/{repo}");
191254 let mut tail = title.rsplit(" · ");
192255 let named = match tail.next() {
193256 Some(last) if last == full => None,
194257 Some(last) if last.starts_with(&format!("{full} ")) => tail.next(),
195258 last => last,
259+ }
260+ .map(str::to_owned);
261+ let section = if kind == "commit" {
262+ "commits"
263+ } else {
264+ kind.as_str()
196265 };
197- let page = match named {
198- Some(page) => page.to_owned(),
199- None => parts[2..]
200- .iter()
201- .map(|part| crumb_label(part))
202- .collect::<Vec<_>>()
203- .join("/"),
204- };
205- segments.push((page, None));
266+ match (repo_section_label(lang, section), rest) {
267+ // Files at one commit, from the home page's timeline: under that commit.
268+ (None, [oid]) if kind == "scrub" => {
269+ let short: String = oid.chars().take(7).collect();
270+ segments.push((
271+ g::t(lang, K::TabCommits).to_owned(),
272+ Some(repo_href(owner, repo, "commits", "")),
273+ ));
274+ segments.push((short, Some(repo_href(owner, repo, "commit", oid))));
275+ segments.push((step_label(lang, "files"), None));
276+ }
277+ // Compare and search: their word, then what is compared.
278+ (None, rest) if matches!(kind.as_str(), "compare" | "search") => {
279+ let word = if kind == "compare" {
280+ s(lang, "Compare", "Karşılaştır")
281+ } else {
282+ s(lang, "Search", "Ara")
283+ };
284+ if rest.is_empty() {
285+ segments.push((word.to_owned(), None));
286+ } else {
287+ segments
288+ .push((word.to_owned(), Some(repo_href(owner, repo, kind, ""))));
289+ segments.push((rest.join("/"), None));
290+ }
291+ }
292+ // A section's own page, or a word that is no section: one segment.
293+ (None, _) | (Some(_), []) => {
294+ let page = named.unwrap_or_else(|| {
295+ parts[2..]
296+ .iter()
297+ .map(|part| crumb_label(part))
298+ .collect::<Vec<_>>()
299+ .join("/")
300+ });
301+ segments.push((page, None));
302+ }
303+ (Some(label), rest) => {
304+ segments.push((label, Some(repo_href(owner, repo, section, ""))));
305+ let item = rest[0].as_str();
306+ let numbered = matches!(section, "issues" | "pulls" | "discussions")
307+ && item.bytes().all(|b| b.is_ascii_digit());
308+ match (section, rest) {
309+ ("ci", [runs, number]) if runs == "runs" => {
310+ segments.push((format!("#{number}"), None));
311+ }
312+ _ if numbered && rest.len() == 1 => {
313+ segments.push((format!("#{item}"), None));
314+ }
315+ _ if numbered => {
316+ segments.push((
317+ format!("#{item}"),
318+ Some(repo_href(owner, repo, section, item)),
319+ ));
320+ // The step, by its word: an edit history ends in an id, so its
321+ // word is History; a comment's edit is Edit.
322+ let step = if rest.iter().any(|part| part == "history") {
323+ "history"
324+ } else {
325+ rest[rest.len() - 1].as_str()
326+ };
327+ segments.push((step_label(lang, step), None));
328+ }
329+ ("wiki", [dash, new]) if dash == "-" && new == "new" => {
330+ segments.push((s(lang, "New page", "Yeni sayfa").to_owned(), None));
331+ }
332+ ("wiki" | "settings", [page, more @ ..])
333+ if !more.is_empty() && page != "-" =>
334+ {
335+ let page_label = match page.as_str() {
336+ "hooks" => {
337+ i18n::integrations::t(lang, i18n::integrations::K::Webhooks)
338+ .to_owned()
339+ }
340+ other => crumb_label(other),
341+ };
342+ segments.push((
343+ page_label,
344+ Some(repo_href(owner, repo, section, page)),
345+ ));
346+ let last = more[more.len() - 1].as_str();
347+ segments.push((step_label(lang, last), None));
348+ }
349+ _ => {
350+ let page = named.unwrap_or_else(|| {
351+ step_label(lang, rest[rest.len() - 1].as_str())
352+ });
353+ segments.push((page, None));
354+ }
355+ }
356+ }
357+ }
206358 }
207359 }
208360 }
@@ -398,7 +550,7 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View>
398550 <img class="avatar corner-avatar" src=(corner.avatar.as_str()) alt="" width="32" height="32">
399551 </summary>
400552 <div class="corner-menu">
401- <p class="corner-who" title=(corner.username.as_str())>(corner.name.as_str())</p>
553+ <a class="corner-who" href=(profile_href.as_str()) title=(profile_label)>(corner.name.as_str())</a>
402554 <a class="corner-link corner-bell" href="/notifications" title=(bell_label) aria-expanded="false">
403555 <span>(bell_title)</span>
404556 if corner.unread > 0 {
@@ -430,7 +582,6 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View>
430582 }
431583 </div>
432584 <div class="corner-sep"></div>
433- <a class="corner-link" href=(profile_href.as_str())>(profile_label)</a>
434585 <a class="corner-link" href="/settings/profile">(settings_label)</a>
435586 if corner.is_admin {
436587 <a class="corner-link" href="/admin/users">(admin_label)</a>
@@ -470,6 +621,7 @@ pub async fn shell(
470621 title: &str,
471622 viewer: Option<&(User, Session)>,
472623 #[default] extra_stylesheet: Option<&str>,
624+ #[default] parents: Vec<(String, String)>,
473625 #[default] child: Child<'_>,
474626 ) -> Result<impl View> {
475627 let full_title = format!("{title} \u{b7} forge");
@@ -573,17 +725,32 @@ pub async fn shell(
573725 let palette_label = br::t(lang, br::K::PaletteOpen).to_owned();
574726 let explore_label = t(lang, Key::Explore);
575727 // The path bar: one segment per part of the request path, the last one unlinked.
576- let mut segments = path_segments(uri(__cx).path(), title);
728+ let mut segments = path_segments(lang, uri(__cx).path(), title);
577729 // A page with no place of its own in the path, such as settings, names its section and itself.
730+ // A page below one of the section's tabs (an account under Users) names that tab too.
578731 if segments.is_empty() {
579732 if let Some(section) = &section {
580733 let first = section.items.first().map(|item| item.href.clone());
581734 if section.title != title {
582735 segments.push((section.title.clone(), first));
583736 }
737+ let path = uri(__cx).path();
738+ if let Some(item) = section.items.iter().find(|item| {
739+ path.strip_prefix(item.href.as_str())
740+ .is_some_and(|below| below.starts_with('/'))
741+ }) {
742+ segments.push((item.label.to_owned(), Some(item.href.clone())));
743+ }
584744 }
585745 segments.push((title.to_owned(), None));
586746 }
747+ // Places the path does not show, such as a job's run, go just before the page itself.
748+ if !parents.is_empty() {
749+ let at = segments.len().saturating_sub(1);
750+ for (offset, (label, href)) in parents.into_iter().enumerate() {
751+ segments.insert(at + offset, (label, Some(href)));
752+ }
753+ }
587754 let path_attr = segments
588755 .iter()
589756 .map(|(label, _)| label.as_str())
@@ -821,7 +988,10 @@ pub fn page_width(path: &str) -> &'static str {
821988 ["settings" | "admin", ..] | ["new", ..] | ["org", "new"] | ["org", _, "settings", ..] => {
822989 "col"
823990 }
824- ["login" | "register" | "forgot" | "reset" | "setup" | "invite", ..] => "col",
991+ [
992+ "login" | "register" | "forgot" | "reset" | "setup" | "invite",
993+ ..,
994+ ] => "col",
825995 [_, _, section, ..] => match *section {
826996 "settings" | "new" | "edit" | "fork" | "transfer" | "rename" => "col",
827997 "tree" | "blob" | "blame" | "commit" | "compare" | "ci" | "raw" | "edit-file"
@@ -973,8 +1143,16 @@ pub fn section_for(lang: Lang, path: &str) -> Option<Section> {
9731143 let first = parts.next()?;
9741144 let second = parts.next().unwrap_or("");
9751145 let (key, title, items) = match first {
976- "admin" => ("admin", ad::t(lang, AK::AdminArea).to_owned(), admin_items(lang)),
977- "settings" => ("settings", o::t(lang, OK::Settings).to_owned(), settings_items(lang)),
1146+ "admin" => (
1147+ "admin",
1148+ ad::t(lang, AK::AdminArea).to_owned(),
1149+ admin_items(lang),
1150+ ),
1151+ "settings" => (
1152+ "settings",
1153+ o::t(lang, OK::Settings).to_owned(),
1154+ settings_items(lang),
1155+ ),
9781156 _ => return None,
9791157 };
9801158 let second = match second {
@@ -1619,7 +1797,7 @@ mod tests {
16191797 #[test]
16201798 fn path_segments_follow_the_request_path() {
16211799 assert_eq!(
1622- path_segments("/tahinli/forge/blob/main/src/main.rs", "main.rs"),
1800+ path_segments(Lang::En, "/tahinli/forge/blob/main/src/main.rs", "main.rs"),
16231801 vec![
16241802 ("tahinli".to_owned(), Some("/tahinli".to_owned())),
16251803 ("forge".to_owned(), Some("/tahinli/forge".to_owned())),
@@ -1631,24 +1809,37 @@ mod tests {
16311809 ]
16321810 );
16331811 assert_eq!(
1634- path_segments("/tahinli/forge", "tahinli/forge"),
1812+ path_segments(Lang::En, "/tahinli/forge", "tahinli/forge"),
16351813 vec![
16361814 ("tahinli".to_owned(), Some("/tahinli".to_owned())),
16371815 ("forge".to_owned(), None),
16381816 ]
16391817 );
1640- let (last, _) = path_segments("/tahinli/forge/issues", "tahinli/forge · Issues").remove(2);
1818+ let (last, _) =
1819+ path_segments(Lang::En, "/tahinli/forge/issues", "tahinli/forge · Issues").remove(2);
16411820 assert_eq!(last, "Issues");
1642- let (last, _) = path_segments("/tahinli/forge/commits/main", "tahinli/forge").remove(2);
1643- assert_eq!(last, "commits/main");
1644- assert!(path_segments("/explore", "Explore").is_empty());
1645- assert!(path_segments("/", "Home").is_empty());
1821+ let crumbs = path_segments(Lang::En, "/tahinli/forge/commits/main", "tahinli/forge");
1822+ assert_eq!(
1823+ crumbs[2],
1824+ (
1825+ "Commits".to_owned(),
1826+ Some("/tahinli/forge/commits".to_owned())
1827+ )
1828+ );
1829+ assert_eq!(crumbs[3], ("main".to_owned(), None));
1830+ let crumbs = path_segments(Lang::En, "/tahinli/forge/issues/4/edit", "tahinli/forge");
1831+ let labels: Vec<&str> = crumbs.iter().map(|(label, _)| label.as_str()).collect();
1832+ assert_eq!(labels, ["tahinli", "forge", "Issues", "#4", "Edit"]);
1833+ assert_eq!(crumbs[3].1.as_deref(), Some("/tahinli/forge/issues/4"));
1834+ assert!(path_segments(Lang::En, "/explore", "Explore").is_empty());
1835+ assert!(path_segments(Lang::En, "/", "Home").is_empty());
16461836 let (last, _) = path_segments(
1837+ Lang::En,
16471838 "/tahinli/forge/commit/0123456789abcdef0123456789abcdef01234567",
16481839 "tahinli/forge",
16491840 )
1650- .remove(2);
1651- assert_eq!(last, "commit/0123456");
1841+ .remove(3);
1842+ assert_eq!(last, "0123456");
16521843 }
16531844
16541845 #[test]
@@ -1725,7 +1916,7 @@ mod tests {
17251916 );
17261917 }
17271918
1728- /// Renders `/settings/sessions` (a page that uses the shell) for a freshly signed-in user.
1919+ /// Renders `/settings/security` (a page that uses the shell) for a freshly signed-in user.
17291920 async fn menu_html(
17301921 router: &topcoat::router::Router,
17311922 store: &forge_core::Store,
@@ -1744,7 +1935,7 @@ mod tests {
17441935 crate::test_support::create_session(store, &user.id, token, "menu-csrf").await;
17451936 let req = Request::builder()
17461937 .method("GET")
1747- .uri("/settings/sessions")
1938+ .uri("/settings/security")
17481939 .header("cookie", format!("__Host-{SESSION_COOKIE}={token}"))
17491940 .body(Body::empty())
17501941 .expect("request");
@@ -1848,7 +2039,7 @@ mod shell_tests {
18482039 &page[at..at + len + 1]
18492040 }
18502041
1851- /// The `<html>` tag of `/settings/sessions` for a signed-in user whose stored colours are the
2042+ /// The `<html>` tag of `/settings/security` for a signed-in user whose stored colours are the
18522043 /// four ids given, in the order light accent, dark accent, light base, dark base.
18532044 async fn html_tag_for_colours(
18542045 router: &topcoat::router::Router,
@@ -1870,7 +2061,7 @@ mod shell_tests {
18702061 crate::test_support::create_session(store, &user.id, token, "colour-csrf").await;
18712062 let req = Request::builder()
18722063 .method("GET")
1873- .uri("/settings/sessions")
2064+ .uri("/settings/security")
18742065 .header("cookie", format!("__Host-{SESSION_COOKIE}={token}"))
18752066 .body(Body::empty())
18762067 .unwrap();
@@ -1932,12 +2123,12 @@ mod shell_tests {
19322123 &store,
19332124 "hued",
19342125 "hued-token",
1935- ["hue-215", "hue-7", "hue-300", "spark"],
2126+ ["hue-215", "hue-7", "hue-300", "ink"],
19362127 )
19372128 .await;
19382129 assert!(hued.contains("data-accent-light=\"hue-215\""), "{hued}");
19392130 assert!(hued.contains("data-accent-dark=\"hue-7\""), "{hued}");
19402131 assert!(hued.contains("data-base-light=\"hue-300\""), "{hued}");
1941- assert!(hued.contains("data-base-dark=\"spark\""), "{hued}");
2132+ assert!(hued.contains("data-base-dark=\"ink\""), "{hued}");
19422133 }
19432134 }
docs/ui-language.mdmodified+34 -8
@@ -46,15 +46,20 @@ Sections never go in the rail: they go in `.tabs`.
4646 ## Rows
4747
4848 `<a class="line" data-kb-row=""><span class="name">..</span><span class="val">..</span></a>` when the item
49-has its own page. When it opens in place:
49+has its own page. Otherwise the row shows everything at once: its facts in the one `.val`, joined with
50+" · ", and its actions right after them on the same line. A confirm opens in place of its word, on the row.
5051
5152 ```html
52-<details class="row-open">
53- <summary class="line"><span class="name">laptop</span><span class="val">SHA256:9fK2c1Qx</span></summary>
54- <div class="opened">..</div>
55-</details>
53+<div class="line">
54+ <span class="name">laptop</span><span class="val">SHA256:9fK2c1Qx · added 3 days ago</span>
55+ confirm_act(..Delete..)
56+</div>
5657 ```
5758
59+`<details class="row-open">` only for a row whose hidden part is an edit form (a rename, a role). Never a
60+row that opens to show facts or a single action, never a link to a page that shows the same row again:
61+one click to see, one to act.
62+
5863 Details come right after the title on one line. Nothing is pushed to the far end of a row:
5964 no `margin-left:auto`, no `justify-content:space-between`, no second column at the right.
6065
@@ -96,7 +101,11 @@ label. Errors are `alert` at the top of the form they belong to, which stays ope
96101
97102 Every search bar is live: `data-live-search` on a real GET form's input in `.plain-search`. It sits in the
98103 tools row or above the rail's list. Filters are the rail, or `.tabs` when there are only a few. Pagers
99-appear only when another page exists, as one `nav.pager` row (Newer, the page, Older) under the list. An empty list is `.state` with one line and its action as `.act`.
104+appear only when another page exists, as one `nav.pager` row (Newer, the page, Older) under the list, on
105+the sheet's inset with a hairline above. A long log (the audit log) numbers its pages in the same row
106+(`nav.pager.pager-numbered`), the current page held like a pressed tool. An empty list is `.state` with
107+one line and its action as `.act`. A log reads as text: action words, then facts joined with " · ", never
108+raw JSON; repeats in a row fold into one line with "×N".
100109
101110 ## Menus
102111
@@ -108,8 +117,13 @@ triangles. It never leaves the window, on a phone either.
108117
109118 Tokens only: `--bg`, `--surface`, `--surface-2`, `--text`, `--muted`, `--border`, `--border-strong`, `--accent`,
110119 `--accent-soft`, `--bad`, `--danger-bg`, `--add-bg`, `--del-bg`. Accent marks the one live or selected
111-thing. Running colour is the accent. Passed is neutral. Failed is `--bad`. Cancelled is grey, never red.
112-Added is blue and deleted is rose. Graphs use the same set: neutral marks, accent for now.
120+thing. In CI, running is the accent, passed is `--ok` green and failed is `--bad`, everywhere a result
121+shows (ticks, step strips, timeline, history bars). `--ok` takes the accent's lightness and strength
122+with a green hue, so results sit with whichever accent is chosen. Cancelled is grey, never red. Added
123+is blue and deleted is rose.
124+
125+A colour choice offers five presets and a Custom chip (its swatch and the word), on the same columns
126+in every row.
113127
114128 ## Type
115129
@@ -132,3 +146,15 @@ Turkish page shows no English, an English page no Turkish.
132146 - A setting must visibly change something, or it goes.
133147 - A phone (390px) is one column: no sideways scroll, tabs scroll inside their row.
134148 - Pages fit one screen where they can: use tabs and the rail, not stacked unrelated topics.
149+
150+## Fixed places
151+
152+- Every head on a page with tabs is one height (a 38px title line and one sub line), so the tabs and the
153+ sheet never move when you switch tabs.
154+- The path bar names every place above the page as a link: section, item (`#12`), page. A page whose
155+ parent is not in its address (a job's run) passes it to `shell(parents: ..)`. No page needs the browser's
156+ Back button.
157+- A form of one field puts its submit beside the field.
158+- Every control has one focus ring: 2px in `--focus`, inside its own edge (`outline-offset: -2px`), so
159+ no sheet, row or scrolling list cuts it.
160+- A tab's own pages sit in its rail: the Security log is a Security rail item, not a page of its own.
style/_one.scssmodified+183 -7
@@ -2260,10 +2260,13 @@ main > .diff-section,
22602260 display: contents;
22612261 }
22622262
2263+// Log or Timeline: the current one held like a pressed tool inside the sheet, as a sort choice is,
2264+// with no underline or accent of its own.
22632265 #ci-view-log:checked ~ .ci-logbar .ci-tl-tab-log,
22642266 #ci-view-timeline:checked ~ .ci-logbar .ci-tl-tab-timeline {
2265- background: var(--accent-soft);
2266- color: var(--accent);
2267+ background: var(--surface-2);
2268+ color: var(--text);
2269+ box-shadow: none;
22672270 font-weight: 500; // the same as its neighbours, so choosing never shifts the row
22682271 }
22692272
@@ -3042,18 +3045,17 @@ details:not([open])::details-content {
30423045 align-self: center;
30433046 }
30443047
3045-// Colour rows: the swatches sit on nine fixed columns, the most any row has, so the sliders and the hex
3046-// box of Background and Accent start on one edge whatever each row holds. Hue, vividness and hex
3047-// follow on one line, each its own width; a note about a lightened hex goes under them.
3048+// Colour rows: five presets on fixed columns, then the Custom chip, then hue, vividness and hex,
3049+// so Background and Accent line up column for column. A note about a lightened hex goes under them.
30483050 .colour-choices {
30493051 display: grid;
3050- grid-template-columns: repeat(9, 30px) auto;
3052+ grid-template-columns: repeat(5, 30px) auto auto;
30513053 align-items: center;
30523054 gap: 8px;
30533055 }
30543056
30553057 .colour-choices > .tune {
3056- grid-column: 10;
3058+ grid-column: 7;
30573059 display: flex;
30583060 flex-wrap: wrap;
30593061 align-items: center;
@@ -3097,3 +3099,177 @@ details:not([open])::details-content {
30973099 margin: 0;
30983100 }
30993101 }
3102+
3103+// Every head of a page with tabs is one height: a 38px title line (as tall as the button beside a
3104+// title) and one sub line, so switching tabs never moves the tabs or what is under them.
3105+.head-title {
3106+ min-height: 38px;
3107+}
3108+
3109+main:has(> nav.tabs) > .head {
3110+ min-height: 64px;
3111+}
3112+
3113+// A focus ring sits inside what has it, so a list that scrolls on its own never cuts it off.
3114+:is(.rail-item, .line, summary, nav.tabs a, .tabs a, .sub a, .choice label):focus-visible {
3115+ outline-offset: -2px;
3116+}
3117+
3118+// A row's actions follow its text on the same line. A confirm opens in place of its word: the
3119+// question, then the danger button and Keep it, all on the row.
3120+.line {
3121+ flex-wrap: wrap;
3122+}
3123+
3124+.line > :is(details.reveal, .act-form, a.act, button.act) {
3125+ flex: none;
3126+ align-self: center;
3127+}
3128+
3129+.line > details.reveal[open] > summary {
3130+ display: none;
3131+}
3132+
3133+.line > details.reveal > form.opened {
3134+ display: flex;
3135+ flex-direction: row;
3136+ flex-wrap: wrap;
3137+ align-items: center;
3138+ gap: 8px;
3139+ margin: 0;
3140+ padding: 0;
3141+
3142+ > .hint {
3143+ margin: 0;
3144+ }
3145+
3146+ > .acts.asks {
3147+ margin: 0;
3148+ }
3149+}
3150+
3151+// The account menu's name is its profile link: a menu row in the name's weight.
3152+a.corner-who {
3153+ display: flex;
3154+ align-items: center;
3155+ min-height: 34px;
3156+ box-sizing: border-box;
3157+ border-radius: 12px;
3158+ color: var(--text);
3159+ font-weight: 600;
3160+ text-decoration: none;
3161+
3162+ &:hover {
3163+ background: var(--surface-2);
3164+ }
3165+}
3166+
3167+// Run alerts: the previews stand on the switch's middle line, as tall as its choices.
3168+.sound-row > .act.play {
3169+ align-self: center;
3170+ height: 32px;
3171+ border-radius: 16px;
3172+}
3173+
3174+// The custom colour reads as a word with its swatch, not as one more circle.
3175+.colour-choice:has(> .custom-word) {
3176+ display: inline-flex;
3177+ flex-direction: row;
3178+ align-items: center;
3179+ gap: 8px;
3180+ width: auto;
3181+ height: 32px;
3182+ padding: 0 12px 0 4px;
3183+ border-radius: 16px;
3184+ background: var(--surface-2);
3185+ color: var(--text);
3186+ font-size: 14px;
3187+ cursor: pointer;
3188+
3189+ > .hue-swatch {
3190+ width: 24px;
3191+ height: 24px;
3192+ }
3193+
3194+ > .custom-word {
3195+ max-width: none;
3196+ overflow: visible;
3197+ font-size: 14px;
3198+ font-weight: 400;
3199+ color: var(--text);
3200+ }
3201+}
3202+
3203+// A form of one field sends from beside it: the field, then its button on the same line.
3204+form.fields:has(> .field + button[type="submit"]):not(:has(> :not(.field, button[type="submit"], input[type="hidden"]))):not(:has(> .field ~ .field)) {
3205+ flex-direction: row;
3206+ flex-wrap: wrap;
3207+ align-items: flex-start;
3208+ column-gap: 8px;
3209+
3210+ > .field {
3211+ flex: none;
3212+ }
3213+
3214+ > button[type="submit"] {
3215+ margin: 0;
3216+ }
3217+}
3218+
3219+// Numbered pages are the same row as every pager: on the sheet's inset with a hairline above, the
3220+// numbers quiet words, the current one held like a pressed tool at the same weight, so moving
3221+// between pages never shifts the row.
3222+nav.pager.pager-numbered {
3223+ display: flex;
3224+ flex-wrap: wrap;
3225+ align-items: center;
3226+ gap: 4px;
3227+ margin: 0;
3228+ padding: 8px 18px;
3229+ border-top: 1px solid var(--border);
3230+ font-size: 14px;
3231+
3232+ .pager-page,
3233+ .pager-step {
3234+ color: var(--muted);
3235+ font-weight: 500;
3236+ }
3237+
3238+ > :first-child {
3239+ margin-left: -8px;
3240+ }
3241+
3242+ .current {
3243+ background: var(--surface-2);
3244+ color: var(--text);
3245+ font-weight: 500;
3246+ }
3247+
3248+ a:hover {
3249+ color: var(--text);
3250+ }
3251+}
3252+
3253+// A commit subject among a row's facts stays inline with the facts after it.
3254+.line .val .commit-line {
3255+ display: inline-flex;
3256+ max-width: 40ch;
3257+ vertical-align: bottom;
3258+}
3259+
3260+// Passed is green everywhere, but a green with the accent's lightness and strength, so CI results
3261+// sit with the chosen accent instead of beside it. A grey accent still gets a readable green.
3262+@supports (color: oklch(from red l c h)) {
3263+ :root:root:root {
3264+ --ok: oklch(from var(--accent) l clamp(0.09, c, 0.15) 158);
3265+ }
3266+}
3267+
3268+// One focus ring for every control: 2px in the focus colour, drawn inside the control's own edge,
3269+// so a sheet's or a row's edge never clips it and it looks the same on a button, a quiet action, a
3270+// pager number or a tab.
3271+:is(button, .button, a.act, .act, nav.pager a, .ci-tl-tab, .corner-who):focus-visible {
3272+ outline: 2px solid var(--focus);
3273+ outline-offset: -2px;
3274+ box-shadow: none;
3275+}
style/_one_ci.scssmodified+96 -0
@@ -356,3 +356,99 @@ main:has(> .ci-job) > .sheet {
356356 .ci-job .ci-dock {
357357 padding: 12px 18px;
358358 }
359+
360+// Log lines: the number column fits five digits on one line in the log's own font, so a number
361+// never wraps under itself and every line is one line tall.
362+.ci-log .ll {
363+ grid-template-columns: 7ch minmax(0, 1fr);
364+ column-gap: 2ch;
365+}
366+
367+.ci-log .ln {
368+ width: auto;
369+ padding-right: 0;
370+ white-space: nowrap;
371+}
372+
373+// A group's name is a line like the others, with its number, and keeps a hairline under it while
374+// it sticks.
375+.ci-log details.lg > summary {
376+ display: grid;
377+}
378+
379+// A run or job page fills the window under the top bar, whatever stands between them (a banner,
380+// a notice): the page is a column, and the log takes the room left.
381+body:has(> .shell main > :is(.ci-run, .ci-job)) {
382+ height: 100dvh;
383+ min-height: 600px;
384+
385+ > .shell {
386+ flex: 1 1 0;
387+ min-height: 0;
388+ }
389+
390+ .shell-body {
391+ min-height: 0;
392+ }
393+}
394+
395+.shell-body > main:has(> :is(.ci-run, .ci-job)) {
396+ flex: 1 1 0;
397+ height: auto;
398+ min-height: 0;
399+}
400+
401+// Artifacts are one line of links under the log, not a list that pushes the page past the window.
402+.ci-job .ci-artifacts {
403+ display: flex;
404+ flex: none;
405+ flex-wrap: wrap;
406+ align-items: baseline;
407+ gap: 4px 16px;
408+ padding: 10px 18px;
409+ border-top: 1px solid var(--border);
410+ font-size: 14px;
411+
412+ > h2 {
413+ margin: 0;
414+ color: var(--muted);
415+ font-size: 13px;
416+ font-weight: 600;
417+ }
418+
419+ .val {
420+ color: var(--muted);
421+ font-size: 13px;
422+ }
423+}
424+
425+// The state in a head's sub line is its word in its colour after a dot, on the line's middle, not a
426+// box that stands taller than the text around it.
427+.head-sub .ci-state {
428+ display: inline-flex;
429+ align-items: center;
430+ gap: 6px;
431+ height: auto;
432+ padding: 0;
433+ border: 0;
434+ background: none;
435+ font-size: 14px;
436+ line-height: 20px;
437+}
438+
439+.head-sub .ci-state::before {
440+ margin-right: 0;
441+}
442+
443+// The Timeline tab is the chart and one line a job: what ran where and for how long, with its Re-run.
444+// The output lives in the Log tab, so no tail of it repeats here.
445+.ci-tl-panel-timeline {
446+ :is(.ci-job-head, .ci-job-last, .ci-job-tail, .ci-chev) {
447+ display: none;
448+ }
449+
450+ .ci-job-list {
451+ margin-top: 8px;
452+ border-top: 1px solid var(--border);
453+ }
454+}
style/_one_people.scssmodified+46 -0
@@ -305,3 +305,49 @@
305305 .snippet-form .snippet-tabs {
306306 flex: 0 1 auto;
307307 }
308+
309+// A snippet's files are one row on the control column: the file chips, Add file, then how many of
310+// how many, the way every control starts on the fields' edge.
311+.snippet-form > .snippet-files {
312+ display: flex;
313+ flex-direction: row;
314+ flex-wrap: wrap;
315+ align-items: center;
316+ column-gap: 8px;
317+ row-gap: 6px;
318+ padding-left: calc(var(--label-w, 130px) + 16px);
319+
320+ > .snippet-tabbar {
321+ display: contents;
322+ }
323+
324+ .snippet-tabs {
325+ order: 1;
326+ margin: 0;
327+ padding: 0;
328+ }
329+
330+ > .acts {
331+ order: 2;
332+ margin: 0;
333+ }
334+
335+ .snippet-count {
336+ order: 3;
337+ margin: 0;
338+ }
339+
340+ > fieldset {
341+ order: 4;
342+ flex: 1 1 100%;
343+ margin: 0 0 0 calc(-1 * (var(--label-w, 130px) + 16px));
344+ }
345+
346+ @media (max-width: 700px) {
347+ padding-left: 0;
348+
349+ > fieldset {
350+ margin-left: 0;
351+ }
352+ }
353+}