The sidebar links to New organization for those the instance lets create one
Browse files at this commit2596bea3292bf5f8655eb286f7961c8a780df03dParent: 910da97- feat
- the sidebar links to New organization for those the instance lets create one
- commit pages, the commit list and compare show the email stored in git next to the name
- the bell's popover lists unread notifications only and has a Clear action that marks all read, with Open notifications as a full-width footer
- fix
- the error box above the new repo and import forms matches their width, and the importer's rate limit message says the wait in minutes and hours
13 changed files +135 -46
- crates/forge-web/src/i18n/misc.rs +4 -0
- crates/forge-web/src/importer/api.rs +26 -1
- crates/forge-web/src/pages/ci_tests.rs +1 -1
- crates/forge-web/src/pages/commit.rs +14 -1
- crates/forge-web/src/pages/commits.rs +5 -0
- crates/forge-web/src/pages/compare.rs +3 -0
- crates/forge-web/src/pages/notifications.rs +7 -34
- crates/forge-web/src/pages/org_new.rs +1 -1
- crates/forge-web/src/views/mod.rs +29 -5
- crates/forge-web/tests/e2e/orgs_ui_e2e.rs +16 -0
- style/_import.scss +4 -0
- style/_repo.scss +5 -0
- style/_shell.scss +20 -3
crates/forge-web/src/i18n/misc.rsmodified+4 -0
| @@ -88,6 +88,7 @@ pub enum K { | ||
| 88 | 88 | // Notifications: inbox page. |
| 89 | 89 | MarkAllAsRead, |
| 90 | 90 | MarkAllRead, |
| 91 | + ClearNotifications, | |
| 91 | 92 | MarkRead, |
| 92 | 93 | NoNotificationsYet, |
| 93 | 94 | NoUnreadNotifications, |
| @@ -256,6 +257,7 @@ const ALL: &[K] = &[ | ||
| 256 | 257 | K::NotReceivingThread, |
| 257 | 258 | K::MarkAllAsRead, |
| 258 | 259 | K::MarkAllRead, |
| 260 | + K::ClearNotifications, | |
| 259 | 261 | K::MarkRead, |
| 260 | 262 | K::NoNotificationsYet, |
| 261 | 263 | K::NoUnreadNotifications, |
| @@ -492,6 +494,8 @@ pub fn t(lang: Lang, key: K) -> &'static str { | ||
| 492 | 494 | (MarkAllAsRead, Tr) => "Tümünü okundu olarak işaretle", |
| 493 | 495 | (MarkAllRead, En) => "Mark all read", |
| 494 | 496 | (MarkAllRead, Tr) => "Tümünü okundu işaretle", |
| 497 | + (ClearNotifications, En) => "Clear", | |
| 498 | + (ClearNotifications, Tr) => "Temizle", | |
| 495 | 499 | (MarkRead, En) => "Mark read", |
| 496 | 500 | (MarkRead, Tr) => "Okundu işaretle", |
| 497 | 501 | (NoNotificationsYet, En) => "No notifications yet.", |
crates/forge-web/src/importer/api.rsmodified+26 -1
| @@ -48,7 +48,8 @@ impl fmt::Display for ApiError { | ||
| 48 | 48 | ApiError::Unauthorized(what) => write!(f, "access denied: {what}"), |
| 49 | 49 | ApiError::RateLimited { wait_secs } => write!( |
| 50 | 50 | f, |
| 51 | - "the rate limit is used up and resets in {wait_secs} seconds; retry then, nothing imported is lost" | |
| 51 | + "the rate limit is used up and resets in {}; retry then, nothing imported is lost", | |
| 52 | + wait_text(*wait_secs) | |
| 52 | 53 | ), |
| 53 | 54 | ApiError::TooLarge => write!(f, "the file is larger than the allowed size"), |
| 54 | 55 | ApiError::Http(msg) => write!(f, "request failed: {msg}"), |
| @@ -57,6 +58,21 @@ impl fmt::Display for ApiError { | ||
| 57 | 58 | } |
| 58 | 59 | } |
| 59 | 60 | |
| 61 | +/// `secs` as a reader would say it, rounded up to the minute so a retry at that time is not early. | |
| 62 | +fn wait_text(secs: u64) -> String { | |
| 63 | + let plural = |n: u64| if n == 1 { "" } else { "s" }; | |
| 64 | + if secs < 60 { | |
| 65 | + return format!("{secs} second{}", plural(secs)); | |
| 66 | + } | |
| 67 | + let minutes = secs.div_ceil(60); | |
| 68 | + let (hours, rest) = (minutes / 60, minutes % 60); | |
| 69 | + match (hours, rest) { | |
| 70 | + (0, m) => format!("{m} minute{}", plural(m)), | |
| 71 | + (h, 0) => format!("{h} hour{}", plural(h)), | |
| 72 | + (h, m) => format!("{h} hour{} {m} minute{}", plural(h), plural(m)), | |
| 73 | + } | |
| 74 | +} | |
| 75 | + | |
| 60 | 76 | pub type ApiResult<T> = Result<T, ApiError>; |
| 61 | 77 | |
| 62 | 78 | #[derive(Debug, Clone, PartialEq, Eq, Default)] |
| @@ -1427,6 +1443,15 @@ mod tests { | ||
| 1427 | 1443 | assert!(valid_path("grp/sub/proj", 2, 20)); |
| 1428 | 1444 | } |
| 1429 | 1445 | |
| 1446 | + #[test] | |
| 1447 | + fn wait_text_reads_naturally() { | |
| 1448 | + assert_eq!(wait_text(45), "45 seconds"); | |
| 1449 | + assert_eq!(wait_text(60), "1 minute"); | |
| 1450 | + assert_eq!(wait_text(3188), "54 minutes"); | |
| 1451 | + assert_eq!(wait_text(3600), "1 hour"); | |
| 1452 | + assert_eq!(wait_text(3661), "1 hour 2 minutes"); | |
| 1453 | + } | |
| 1454 | + | |
| 1430 | 1455 | #[test] |
| 1431 | 1456 | fn rate_limit_waits_follow_the_headers() { |
| 1432 | 1457 | assert_eq!(rate_wait(Some("30"), None, None, 100), Some(30)); |
crates/forge-web/src/pages/ci_tests.rsmodified+1 -1
| @@ -752,7 +752,7 @@ async fn job_page_log_tail() { | ||
| 752 | 752 | assert!(!text.contains("HEAD-MARK")); |
| 753 | 753 | assert!(text.contains("Showing the last 512 KiB")); |
| 754 | 754 | assert!( |
| 755 | - page.body.len() < 530 * 1024, | |
| 755 | + page.body.len() < 540 * 1024, | |
| 756 | 756 | "page is {} bytes", |
| 757 | 757 | page.body.len() |
| 758 | 758 | ); |
crates/forge-web/src/pages/commit.rsmodified+14 -1
| @@ -31,6 +31,7 @@ path_param!(oid); | ||
| 31 | 31 | /// Author, committer or parent line data. |
| 32 | 32 | struct Person { |
| 33 | 33 | name: String, |
| 34 | + email: String, | |
| 34 | 35 | relative: String, |
| 35 | 36 | absolute: String, |
| 36 | 37 | iso: String, |
| @@ -145,6 +146,7 @@ async fn commit_page(cx: &Cx) -> Result<impl View> { | ||
| 145 | 146 | let now = now_secs(); |
| 146 | 147 | let author = Person { |
| 147 | 148 | name: info.author_name.clone(), |
| 149 | + email: info.author_email.clone(), | |
| 148 | 150 | relative: relative_time(lang, info.author_time, now), |
| 149 | 151 | absolute: format_in_tz(info.author_time, &tz), |
| 150 | 152 | iso: iso_time(info.author_time), |
| @@ -153,6 +155,7 @@ async fn commit_page(cx: &Cx) -> Result<impl View> { | ||
| 153 | 155 | info.committer_name != info.author_name || info.committer_email != info.author_email; |
| 154 | 156 | let committer = Person { |
| 155 | 157 | name: info.committer_name.clone(), |
| 158 | + email: info.committer_email.clone(), | |
| 156 | 159 | relative: relative_time(lang, info.committer_time, now), |
| 157 | 160 | absolute: format_in_tz(info.committer_time, &tz), |
| 158 | 161 | iso: iso_time(info.committer_time), |
| @@ -225,6 +228,8 @@ async fn commit_page(cx: &Cx) -> Result<impl View> { | ||
| 225 | 228 | }; |
| 226 | 229 | let mut header = ctx.head(state, "commits").await?; |
| 227 | 230 | header.live = ref_live::live_url(&owner_name, &repo_name); |
| 231 | + let author_mailto = format!("mailto:{}", author.email); | |
| 232 | + let committer_mailto = format!("mailto:{}", committer.email); | |
| 228 | 233 | Ok(view! { |
| 229 | 234 | shell(title: title.as_str(), viewer: ctx.viewer.as_ref(), |
| 230 | 235 | repo_head(head: header) |
| @@ -244,6 +249,9 @@ async fn commit_page(cx: &Cx) -> Result<impl View> { | ||
| 244 | 249 | checks_summary(summary: summary, lang: StatusLang(lang)) |
| 245 | 250 | } |
| 246 | 251 | <div class="muted commit-author-line">(g::t(lang, K::AuthorLabel)) <strong>(author.name.as_str())</strong> |
| 252 | + if !author.email.is_empty() { | |
| 253 | + " " <a class="commit-email" href=(author_mailto.as_str())>(author.email.as_str())</a> | |
| 254 | + } | |
| 247 | 255 | if has_coauthors { |
| 248 | 256 | (g::t(lang, K::CoAuthorAnd)) |
| 249 | 257 | for c in coauthors.iter() { |
| @@ -285,7 +293,11 @@ async fn commit_page(cx: &Cx) -> Result<impl View> { | ||
| 285 | 293 | " · " <time data-rel="true" datetime=(author.iso.as_str()) title=(author.absolute.as_str())>(author.relative.as_str())</time> |
| 286 | 294 | </div> |
| 287 | 295 | if committer_differs { |
| 288 | - <p class="muted">(g::t(lang, K::CommitterLabel)) <strong>(committer.name.as_str())</strong> " · " <time data-rel="true" datetime=(committer.iso.as_str()) title=(committer.absolute.as_str())>(committer.relative.as_str())</time></p> | |
| 296 | + <p class="muted">(g::t(lang, K::CommitterLabel)) <strong>(committer.name.as_str())</strong> | |
| 297 | + if !committer.email.is_empty() { | |
| 298 | + " " <a class="commit-email" href=(committer_mailto.as_str())>(committer.email.as_str())</a> | |
| 299 | + } | |
| 300 | + " · " <time data-rel="true" datetime=(committer.iso.as_str()) title=(committer.absolute.as_str())>(committer.relative.as_str())</time></p> | |
| 289 | 301 | } |
| 290 | 302 | if is_root { |
| 291 | 303 | <p class="muted">(g::t(lang, K::RootCommit))</p> |
| @@ -357,6 +369,7 @@ mod tests { | ||
| 357 | 369 | ) |
| 358 | 370 | .await; |
| 359 | 371 | assert_eq!(status, 200); |
| 372 | + assert!(String::from_utf8_lossy(&body).contains("tester@example.com")); | |
| 360 | 373 | let html = doc(&body); |
| 361 | 374 | |
| 362 | 375 | let rows = rows(&html, "tr.diff-line"); |
crates/forge-web/src/pages/commits.rsmodified+5 -0
| @@ -107,6 +107,7 @@ pub(crate) fn short_oid(oid: &str) -> &str { | ||
| 107 | 107 | pub(crate) struct CommitRow { |
| 108 | 108 | pub summary: String, |
| 109 | 109 | pub author: String, |
| 110 | + pub email: String, | |
| 110 | 111 | pub commit_href: String, |
| 111 | 112 | pub tree_href: String, |
| 112 | 113 | pub short: String, |
| @@ -156,6 +157,7 @@ impl CommitRow { | ||
| 156 | 157 | Self { |
| 157 | 158 | summary: emojify(&info.summary).into_owned(), |
| 158 | 159 | author: info.author_name.clone(), |
| 160 | + email: info.author_email.clone(), | |
| 159 | 161 | commit_href: format!("/{owner}/{repo}/commit/{}", info.oid), |
| 160 | 162 | tree_href: format!("/{owner}/{repo}/tree/{}", info.oid), |
| 161 | 163 | short: short_oid(&info.oid).to_owned(), |
| @@ -299,6 +301,9 @@ async fn commits_page(cx: &Cx) -> Result<impl View> { | ||
| 299 | 301 | <a class="commit-summary" href=(row.commit_href.as_str())>(row.summary.as_str())</a> |
| 300 | 302 | <div class="commit-meta muted small"> |
| 301 | 303 | <span class="commit-author">(row.author.as_str())</span> |
| 304 | + if !row.email.is_empty() { | |
| 305 | + <span class="commit-email">(row.email.as_str())</span> | |
| 306 | + } | |
| 302 | 307 | if lang == Lang::Tr { |
| 303 | 308 | <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time> |
| 304 | 309 | <span>(g::t(lang, K::Committed))</span> |
crates/forge-web/src/pages/compare.rsmodified+3 -0
| @@ -348,6 +348,9 @@ async fn compare_view( | ||
| 348 | 348 | <a class="commit-summary" href=(row.commit_href.as_str())>(row.summary.as_str())</a> |
| 349 | 349 | <div class="commit-meta muted small"> |
| 350 | 350 | <span class="commit-author">(row.author.as_str())</span> |
| 351 | + if !row.email.is_empty() { | |
| 352 | + <span class="commit-email">(row.email.as_str())</span> | |
| 353 | + } | |
| 351 | 354 | if lang == i18n::Lang::Tr { |
| 352 | 355 | <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time> |
| 353 | 356 | <span>(g::t(lang, K::Committed))</span> |
crates/forge-web/src/pages/notifications.rsmodified+7 -34
| @@ -149,15 +149,6 @@ impl Entry { | ||
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - fn unread(&self) -> bool { | |
| 153 | - match self { | |
| 154 | - Entry::Issue(note) => note.unread, | |
| 155 | - Entry::Discussion(note) => note.unread, | |
| 156 | - Entry::Advisory(note) => note.unread, | |
| 157 | - Entry::Admin(note) => note.unread, | |
| 158 | - } | |
| 159 | - } | |
| 160 | - | |
| 161 | 152 | fn updated_at(&self) -> &str { |
| 162 | 153 | match self { |
| 163 | 154 | Entry::Issue(note) => ¬e.updated_at, |
| @@ -373,26 +364,12 @@ async fn list_entries( | ||
| 373 | 364 | Ok(entries) |
| 374 | 365 | } |
| 375 | 366 | |
| 376 | -/// The bell's popover rows: the viewer's newest entries, unread ones first, then read ones, each | |
| 377 | -/// newest first. Entries the viewer can no longer read are left out and stay as they are. | |
| 367 | +/// The bell's popover rows: the viewer's newest unread entries, newest first. Read entries are | |
| 368 | +/// left out, and so are entries the viewer can no longer read. | |
| 378 | 369 | async fn peek_rows(state: &AppState, user: &User, lang: Lang, now: i64) -> Result<Vec<RowView>> { |
| 379 | 370 | let tz = user.timezone.clone(); |
| 380 | 371 | let mut entries = list_entries(state, user, true, PEEK_SIZE).await?; |
| 381 | - // Under PEEK_SIZE unread entries in all, every list was read to its end, so none is missing; | |
| 382 | - // the read ones come from the newest of each list. | |
| 383 | - if entries.len() < PEEK_SIZE as usize { | |
| 384 | - entries.extend( | |
| 385 | - list_entries(state, user, false, PEEK_SIZE) | |
| 386 | - .await? | |
| 387 | - .into_iter() | |
| 388 | - .filter(|entry| !entry.unread()), | |
| 389 | - ); | |
| 390 | - } | |
| 391 | - entries.sort_by(|a, b| { | |
| 392 | - b.unread() | |
| 393 | - .cmp(&a.unread()) | |
| 394 | - .then_with(|| b.updated_at().cmp(a.updated_at())) | |
| 395 | - }); | |
| 372 | + entries.sort_by(|a, b| b.updated_at().cmp(a.updated_at())); | |
| 396 | 373 | let mut readable = HashMap::new(); |
| 397 | 374 | let mut rows = Vec::new(); |
| 398 | 375 | for entry in &entries { |
| @@ -569,7 +546,7 @@ async fn inbox(cx: &Cx) -> Result<impl View> { | ||
| 569 | 546 | }) |
| 570 | 547 | } |
| 571 | 548 | |
| 572 | -/// `GET /notifications/peek`: the bell's popover, the viewer's newest notifications as an HTML | |
| 549 | +/// `GET /notifications/peek`: the bell's popover, the viewer's newest unread notifications as an HTML | |
| 573 | 550 | /// fragment. Anonymous viewers get a bare 401. |
| 574 | 551 | #[route(GET "/notifications/peek")] |
| 575 | 552 | async fn peek(cx: &Cx) -> Result<Response> { |
| @@ -585,8 +562,8 @@ async fn peek(cx: &Cx) -> Result<Response> { | ||
| 585 | 562 | fragment.first().await?.into_response(cx) |
| 586 | 563 | } |
| 587 | 564 | |
| 588 | -/// The bell's popover list: each row opens through its open route, which marks it read. An empty | |
| 589 | -/// list says the viewer is all caught up. | |
| 565 | +/// The bell's popover list of unread rows: each row opens through its open route, which marks it | |
| 566 | +/// read. An empty list says the viewer is all caught up. | |
| 590 | 567 | #[component] |
| 591 | 568 | async fn peek_list(lang: Lang, rows: Vec<RowView>) -> Result<impl View> { |
| 592 | 569 | let empty = rows.is_empty(); |
| @@ -598,11 +575,7 @@ async fn peek_list(lang: Lang, rows: Vec<RowView>) -> Result<impl View> { | ||
| 598 | 575 | for row in rows.into_iter() { |
| 599 | 576 | <li> |
| 600 | 577 | <a class="bell-item" href=(row.open_href.as_str())> |
| 601 | - if row.unread { | |
| 602 | - <span class="bell-dot unread" aria-hidden="true"></span> | |
| 603 | - } else { | |
| 604 | - <span class="bell-dot" aria-hidden="true"></span> | |
| 605 | - } | |
| 578 | + <span class="bell-dot unread" aria-hidden="true"></span> | |
| 606 | 579 | <span class="bell-text"> |
| 607 | 580 | <span class="bell-line">(row.title_line.as_str())</span> |
| 608 | 581 | <span class="bell-meta muted"> |
crates/forge-web/src/pages/org_new.rsmodified+1 -1
| @@ -33,7 +33,7 @@ struct NewOrgForm { | ||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /// Whether `user` may create an organization under the instance's policy. |
| 36 | -fn may_create_org(state: &AppState, user: &User) -> bool { | |
| 36 | +pub(crate) fn may_create_org(state: &AppState, user: &User) -> bool { | |
| 37 | 37 | match state.live().orgs.creation { |
| 38 | 38 | OrgCreation::All => true, |
| 39 | 39 | OrgCreation::Admin => user.is_admin, |
crates/forge-web/src/views/mod.rsmodified+29 -5
| @@ -105,9 +105,12 @@ struct SideRepo { | ||
| 105 | 105 | href: String, |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | -/// The global nav item for a request path: `dashboard` for `/`, otherwise the first segment when | |
| 109 | -/// it is a global page. Empty for repo pages and everything else. | |
| 108 | +/// The global nav item for a request path: `dashboard` for `/`, `new-org` for `/org/new`, otherwise | |
| 109 | +/// the first segment when it is a global page. Empty for repo pages and everything else. | |
| 110 | 110 | fn nav_key(path: &str) -> &'static str { |
| 111 | + if path.trim_matches('/') == "org/new" { | |
| 112 | + return "new-org"; | |
| 113 | + } | |
| 111 | 114 | match path.trim_matches('/').split('/').next().unwrap_or("") { |
| 112 | 115 | "" => "dashboard", |
| 113 | 116 | "explore" => "explore", |
| @@ -357,6 +360,8 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> | ||
| 357 | 360 | let logout_label = t(lang, Key::LogOut); |
| 358 | 361 | let bell_title = i18n::t(lang, Key::Notifications); |
| 359 | 362 | let open_label = mi::t(lang, MK::OpenNotifications); |
| 363 | + let clear_label = mi::t(lang, MK::ClearNotifications); | |
| 364 | + let clear_title = mi::t(lang, MK::MarkAllRead); | |
| 360 | 365 | let loading_label = mi::t(lang, MK::PeekLoading); |
| 361 | 366 | let error_label = mi::t(lang, MK::PeekError); |
| 362 | 367 | Ok(view! { |
| @@ -407,7 +412,13 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> | ||
| 407 | 412 | <a class="corner-bell" href="/notifications" title=(bell_label) aria-label=(bell_label) aria-expanded="false"><svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg></a> |
| 408 | 413 | <div class="bell-pop" popover="auto" role="dialog" aria-label=(bell_title) data-loading=(loading_label) data-error=(error_label)> |
| 409 | 414 | <div class="bell-box"> |
| 410 | - <div class="bell-head">(bell_title)</div> | |
| 415 | + <div class="bell-head"> | |
| 416 | + <span>(bell_title)</span> | |
| 417 | + <form method="post" action="/notifications/mark_all_read" class="bell-clear"> | |
| 418 | + <input type="hidden" name="csrf" value=(corner.csrf.as_str())> | |
| 419 | + <button type="submit" class="link-button" title=(clear_title)>(clear_label)</button> | |
| 420 | + </form> | |
| 421 | + </div> | |
| 411 | 422 | <div class="bell-list"></div> |
| 412 | 423 | <a class="button bell-open" href="/notifications">(open_label)</a> |
| 413 | 424 | </div> |
| @@ -454,6 +465,11 @@ pub async fn shell( | ||
| 454 | 465 | }, |
| 455 | 466 | None => (0, (Vec::new(), 0), InboxKinds::default(), no_runs(), Vec::new()), |
| 456 | 467 | }; |
| 468 | + // The sidebar offers New organization only to those the instance's policy lets create one. | |
| 469 | + let can_create_org = match (viewer, try_app_context::<AppState>(__cx)) { | |
| 470 | + (Some((user, _)), Some(state)) => crate::pages::org_new::may_create_org(state, user), | |
| 471 | + _ => false, | |
| 472 | + }; | |
| 457 | 473 | let unread_badge = (unread > 0).then(|| unread.to_string()); |
| 458 | 474 | let side_repos: Vec<SideRepo> = listed |
| 459 | 475 | .iter() |
| @@ -684,7 +700,7 @@ pub async fn shell( | ||
| 684 | 700 | if let Some(section) = section_menu { |
| 685 | 701 | section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live) |
| 686 | 702 | } else { |
| 687 | - side_nav(lang: lang, current: current, profile_repos_href: profile_repos_href.as_str(), unread: unread_menu, repos: side_repos_menu) | |
| 703 | + side_nav(lang: lang, current: current, profile_repos_href: profile_repos_href.as_str(), unread: unread_menu, repos: side_repos_menu, can_create_org: can_create_org) | |
| 688 | 704 | } |
| 689 | 705 | if let Some(corner) = corner_panel { |
| 690 | 706 | profile_corner(lang: lang, corner: corner) |
| @@ -790,7 +806,7 @@ pub async fn shell( | ||
| 790 | 806 | if let Some(section) = section { |
| 791 | 807 | section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live) |
| 792 | 808 | } else { |
| 793 | - side_nav(lang: lang, current: current, profile_repos_href: profile_repos_href.as_str(), unread: unread_aside, repos: side_repos) | |
| 809 | + side_nav(lang: lang, current: current, profile_repos_href: profile_repos_href.as_str(), unread: unread_aside, repos: side_repos, can_create_org: can_create_org) | |
| 794 | 810 | } |
| 795 | 811 | if let Some(corner) = corner_aside { |
| 796 | 812 | profile_corner(lang: lang, corner: corner) |
| @@ -836,6 +852,7 @@ async fn side_nav( | ||
| 836 | 852 | profile_repos_href: &str, |
| 837 | 853 | unread: Option<String>, |
| 838 | 854 | repos: Vec<SideRepo>, |
| 855 | + can_create_org: bool, | |
| 839 | 856 | ) -> Result<impl View> { |
| 840 | 857 | let dashboard = current == "dashboard"; |
| 841 | 858 | let explore = current == "explore"; |
| @@ -843,6 +860,7 @@ async fn side_nav( | ||
| 843 | 860 | let notifications = current == "notifications"; |
| 844 | 861 | let snippets = current == "snippets"; |
| 845 | 862 | let new_repo = current == "new"; |
| 863 | + let new_org = current == "new-org"; | |
| 846 | 864 | let settings = current == "settings"; |
| 847 | 865 | let empty = repos.is_empty(); |
| 848 | 866 | Ok(view! { |
| @@ -874,6 +892,12 @@ async fn side_nav( | ||
| 874 | 892 | <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 8v8M8 12h8"/></svg> |
| 875 | 893 | (t(lang, Key::NewRepository)) |
| 876 | 894 | </a> |
| 895 | + if can_create_org { | |
| 896 | + <a class=(side_class(new_org)) href="/org/new" aria-current=(new_org.then_some("page"))> | |
| 897 | + <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 21V5l8-2v18"/><path d="M12 9l8 2v10"/><path d="M2 21h20"/><path d="M8 8v.01M8 12v.01M8 16v.01M16 14v.01M16 18v.01"/></svg> | |
| 898 | + (o::t(lang, OK::NewOrganization)) | |
| 899 | + </a> | |
| 900 | + } | |
| 877 | 901 | <a class=(side_class(settings)) href="/settings/profile" aria-current=(settings.then_some("page"))> |
| 878 | 902 | <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.3 5.3l2.1 2.1M16.6 16.6l2.1 2.1M5.3 18.7l2.1-2.1M16.6 7.4l2.1-2.1"/></svg> |
| 879 | 903 | (o::t(lang, OK::Settings)) |
crates/forge-web/tests/e2e/orgs_ui_e2e.rsmodified+16 -0
| @@ -490,6 +490,22 @@ async fn org_creation_can_be_limited_to_admins() { | ||
| 490 | 490 | let tahinli = login(&http, "tahinli", PW).await; |
| 491 | 491 | let root_session = login(&http, "root", PW).await; |
| 492 | 492 | |
| 493 | + assert!( | |
| 494 | + !http | |
| 495 | + .get("/", Some(&tahinli)) | |
| 496 | + .await | |
| 497 | + .body | |
| 498 | + .contains("href=\"/org/new\""), | |
| 499 | + "a person who may not create orgs sees no New organization link" | |
| 500 | + ); | |
| 501 | + assert!( | |
| 502 | + http.get("/", Some(&root_session)) | |
| 503 | + .await | |
| 504 | + .body | |
| 505 | + .contains("href=\"/org/new\""), | |
| 506 | + "an admin sees the New organization link" | |
| 507 | + ); | |
| 508 | + | |
| 493 | 509 | assert_eq!( |
| 494 | 510 | http.get("/org/new", Some(&tahinli)).await.status, |
| 495 | 511 | 403, |
style/_import.scssmodified+4 -0
| @@ -11,6 +11,10 @@ | ||
| 11 | 11 | border-bottom: 1px solid var(--border); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | +.import-tabs + .alert { | |
| 15 | + max-width: 960px; | |
| 16 | +} | |
| 17 | + | |
| 14 | 18 | .import-tab { |
| 15 | 19 | margin-bottom: -1px; |
| 16 | 20 | padding: 8px 14px; |
style/_repo.scssmodified+5 -0
| @@ -1252,6 +1252,11 @@ html.tree-resizing .repo-split::before { | ||
| 1252 | 1252 | } |
| 1253 | 1253 | } |
| 1254 | 1254 | |
| 1255 | +.commit-email { | |
| 1256 | + overflow-wrap: anywhere; | |
| 1257 | + font-size: 0.9em; | |
| 1258 | +} | |
| 1259 | + | |
| 1255 | 1260 | // The full commit hash in its copy box: one line, truncated with an ellipsis when the screen is |
| 1256 | 1261 | // narrow, so the hash never breaks in the middle. The Copy button always copies the whole hash. |
| 1257 | 1262 | .commit-info .commit-full-oid { |
style/_shell.scssmodified+20 -3
| @@ -821,17 +821,33 @@ a.chip { | ||
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | .bell-head { |
| 824 | + display: flex; | |
| 825 | + align-items: center; | |
| 826 | + justify-content: space-between; | |
| 827 | + gap: 8px; | |
| 824 | 828 | padding: 10px 14px 8px; |
| 825 | 829 | border-bottom: 1px solid var(--border); |
| 826 | 830 | font-size: 14px; |
| 827 | 831 | font-weight: 600; |
| 828 | 832 | } |
| 829 | 833 | |
| 834 | +.bell-clear { | |
| 835 | + display: none; | |
| 836 | + margin: 0; | |
| 837 | + font-size: 13px; | |
| 838 | + font-weight: 400; | |
| 839 | +} | |
| 840 | + | |
| 841 | +.bell-box:has(.bell-item) .bell-clear { | |
| 842 | + display: block; | |
| 843 | +} | |
| 844 | + | |
| 830 | 845 | .bell-list { |
| 831 | 846 | flex: 1 1 auto; |
| 832 | 847 | min-height: 0; |
| 833 | 848 | overflow-y: auto; |
| 834 | 849 | padding: 4px; |
| 850 | + border-bottom: 1px solid var(--border); | |
| 835 | 851 | } |
| 836 | 852 | |
| 837 | 853 | .bell-rows { |
| @@ -897,9 +913,10 @@ a.chip { | ||
| 897 | 913 | } |
| 898 | 914 | |
| 899 | 915 | .bell-open { |
| 900 | - display: block; | |
| 901 | - margin: 4px; | |
| 902 | - text-align: center; | |
| 916 | + flex: none; | |
| 917 | + align-self: stretch; | |
| 918 | + justify-content: center; | |
| 919 | + margin: 8px; | |
| 903 | 920 | text-decoration: none; |
| 904 | 921 | } |
| 905 | 922 |