forge
Explore
Log in

Don't you dare go Hollow

The sidebar links to New organization for those the instance lets create one

Browse files at this commit

2596bea3292bf5f8655eb286f7961c8a780df03dAhmet Kaan GümüşParent: 910da97
All checks have passed
Show checks
  • 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
Show full message
✨ 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
crates/forge-web/src/i18n/misc.rsmodified+4 -0
@@ -88,6 +88,7 @@ pub enum K {
88 // Notifications: inbox page.88 // Notifications: inbox page.
89 MarkAllAsRead,89 MarkAllAsRead,
90 MarkAllRead,90 MarkAllRead,
91+ ClearNotifications,
91 MarkRead,92 MarkRead,
92 NoNotificationsYet,93 NoNotificationsYet,
93 NoUnreadNotifications,94 NoUnreadNotifications,
@@ -256,6 +257,7 @@ const ALL: &[K] = &[
256 K::NotReceivingThread,257 K::NotReceivingThread,
257 K::MarkAllAsRead,258 K::MarkAllAsRead,
258 K::MarkAllRead,259 K::MarkAllRead,
260+ K::ClearNotifications,
259 K::MarkRead,261 K::MarkRead,
260 K::NoNotificationsYet,262 K::NoNotificationsYet,
261 K::NoUnreadNotifications,263 K::NoUnreadNotifications,
@@ -492,6 +494,8 @@ pub fn t(lang: Lang, key: K) -> &'static str {
492 (MarkAllAsRead, Tr) => "Tümünü okundu olarak işaretle",494 (MarkAllAsRead, Tr) => "Tümünü okundu olarak işaretle",
493 (MarkAllRead, En) => "Mark all read",495 (MarkAllRead, En) => "Mark all read",
494 (MarkAllRead, Tr) => "Tümünü okundu işaretle",496 (MarkAllRead, Tr) => "Tümünü okundu işaretle",
497+ (ClearNotifications, En) => "Clear",
498+ (ClearNotifications, Tr) => "Temizle",
495 (MarkRead, En) => "Mark read",499 (MarkRead, En) => "Mark read",
496 (MarkRead, Tr) => "Okundu işaretle",500 (MarkRead, Tr) => "Okundu işaretle",
497 (NoNotificationsYet, En) => "No notifications yet.",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 ApiError::Unauthorized(what) => write!(f, "access denied: {what}"),48 ApiError::Unauthorized(what) => write!(f, "access denied: {what}"),
49 ApiError::RateLimited { wait_secs } => write!(49 ApiError::RateLimited { wait_secs } => write!(
50 f,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 ApiError::TooLarge => write!(f, "the file is larger than the allowed size"),54 ApiError::TooLarge => write!(f, "the file is larger than the allowed size"),
54 ApiError::Http(msg) => write!(f, "request failed: {msg}"),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 pub type ApiResult<T> = Result<T, ApiError>;76 pub type ApiResult<T> = Result<T, ApiError>;
61 77
62 #[derive(Debug, Clone, PartialEq, Eq, Default)]78 #[derive(Debug, Clone, PartialEq, Eq, Default)]
@@ -1427,6 +1443,15 @@ mod tests {
1427 assert!(valid_path("grp/sub/proj", 2, 20));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 #[test]1455 #[test]
1431 fn rate_limit_waits_follow_the_headers() {1456 fn rate_limit_waits_follow_the_headers() {
1432 assert_eq!(rate_wait(Some("30"), None, None, 100), Some(30));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 assert!(!text.contains("HEAD-MARK"));752 assert!(!text.contains("HEAD-MARK"));
753 assert!(text.contains("Showing the last 512 KiB"));753 assert!(text.contains("Showing the last 512 KiB"));
754 assert!(754 assert!(
755- page.body.len() < 530 * 1024,755+ page.body.len() < 540 * 1024,
756 "page is {} bytes",756 "page is {} bytes",
757 page.body.len()757 page.body.len()
758 );758 );
crates/forge-web/src/pages/commit.rsmodified+14 -1
@@ -31,6 +31,7 @@ path_param!(oid);
31 /// Author, committer or parent line data.31 /// Author, committer or parent line data.
32 struct Person {32 struct Person {
33 name: String,33 name: String,
34+ email: String,
34 relative: String,35 relative: String,
35 absolute: String,36 absolute: String,
36 iso: String,37 iso: String,
@@ -145,6 +146,7 @@ async fn commit_page(cx: &Cx) -> Result<impl View> {
145 let now = now_secs();146 let now = now_secs();
146 let author = Person {147 let author = Person {
147 name: info.author_name.clone(),148 name: info.author_name.clone(),
149+ email: info.author_email.clone(),
148 relative: relative_time(lang, info.author_time, now),150 relative: relative_time(lang, info.author_time, now),
149 absolute: format_in_tz(info.author_time, &tz),151 absolute: format_in_tz(info.author_time, &tz),
150 iso: iso_time(info.author_time),152 iso: iso_time(info.author_time),
@@ -153,6 +155,7 @@ async fn commit_page(cx: &Cx) -> Result<impl View> {
153 info.committer_name != info.author_name || info.committer_email != info.author_email;155 info.committer_name != info.author_name || info.committer_email != info.author_email;
154 let committer = Person {156 let committer = Person {
155 name: info.committer_name.clone(),157 name: info.committer_name.clone(),
158+ email: info.committer_email.clone(),
156 relative: relative_time(lang, info.committer_time, now),159 relative: relative_time(lang, info.committer_time, now),
157 absolute: format_in_tz(info.committer_time, &tz),160 absolute: format_in_tz(info.committer_time, &tz),
158 iso: iso_time(info.committer_time),161 iso: iso_time(info.committer_time),
@@ -225,6 +228,8 @@ async fn commit_page(cx: &Cx) -> Result<impl View> {
225 };228 };
226 let mut header = ctx.head(state, "commits").await?;229 let mut header = ctx.head(state, "commits").await?;
227 header.live = ref_live::live_url(&owner_name, &repo_name);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 Ok(view! {233 Ok(view! {
229 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),234 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
230 repo_head(head: header)235 repo_head(head: header)
@@ -244,6 +249,9 @@ async fn commit_page(cx: &Cx) -> Result<impl View> {
244 checks_summary(summary: summary, lang: StatusLang(lang))249 checks_summary(summary: summary, lang: StatusLang(lang))
245 }250 }
246 <div class="muted commit-author-line">(g::t(lang, K::AuthorLabel)) <strong>(author.name.as_str())</strong>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 if has_coauthors {255 if has_coauthors {
248 (g::t(lang, K::CoAuthorAnd))256 (g::t(lang, K::CoAuthorAnd))
249 for c in coauthors.iter() {257 for c in coauthors.iter() {
@@ -285,7 +293,11 @@ async fn commit_page(cx: &Cx) -> Result<impl View> {
285 " · " <time data-rel="true" datetime=(author.iso.as_str()) title=(author.absolute.as_str())>(author.relative.as_str())</time>293 " · " <time data-rel="true" datetime=(author.iso.as_str()) title=(author.absolute.as_str())>(author.relative.as_str())</time>
286 </div>294 </div>
287 if committer_differs {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 if is_root {302 if is_root {
291 <p class="muted">(g::t(lang, K::RootCommit))</p>303 <p class="muted">(g::t(lang, K::RootCommit))</p>
@@ -357,6 +369,7 @@ mod tests {
357 )369 )
358 .await;370 .await;
359 assert_eq!(status, 200);371 assert_eq!(status, 200);
372+ assert!(String::from_utf8_lossy(&body).contains("tester@example.com"));
360 let html = doc(&body);373 let html = doc(&body);
361 374
362 let rows = rows(&html, "tr.diff-line");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 pub(crate) struct CommitRow {107 pub(crate) struct CommitRow {
108 pub summary: String,108 pub summary: String,
109 pub author: String,109 pub author: String,
110+ pub email: String,
110 pub commit_href: String,111 pub commit_href: String,
111 pub tree_href: String,112 pub tree_href: String,
112 pub short: String,113 pub short: String,
@@ -156,6 +157,7 @@ impl CommitRow {
156 Self {157 Self {
157 summary: emojify(&info.summary).into_owned(),158 summary: emojify(&info.summary).into_owned(),
158 author: info.author_name.clone(),159 author: info.author_name.clone(),
160+ email: info.author_email.clone(),
159 commit_href: format!("/{owner}/{repo}/commit/{}", info.oid),161 commit_href: format!("/{owner}/{repo}/commit/{}", info.oid),
160 tree_href: format!("/{owner}/{repo}/tree/{}", info.oid),162 tree_href: format!("/{owner}/{repo}/tree/{}", info.oid),
161 short: short_oid(&info.oid).to_owned(),163 short: short_oid(&info.oid).to_owned(),
@@ -299,6 +301,9 @@ async fn commits_page(cx: &Cx) -> Result<impl View> {
299 <a class="commit-summary" href=(row.commit_href.as_str())>(row.summary.as_str())</a>301 <a class="commit-summary" href=(row.commit_href.as_str())>(row.summary.as_str())</a>
300 <div class="commit-meta muted small">302 <div class="commit-meta muted small">
301 <span class="commit-author">(row.author.as_str())</span>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 if lang == Lang::Tr {307 if lang == Lang::Tr {
303 <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>308 <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
304 <span>(g::t(lang, K::Committed))</span>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 <a class="commit-summary" href=(row.commit_href.as_str())>(row.summary.as_str())</a>348 <a class="commit-summary" href=(row.commit_href.as_str())>(row.summary.as_str())</a>
349 <div class="commit-meta muted small">349 <div class="commit-meta muted small">
350 <span class="commit-author">(row.author.as_str())</span>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 if lang == i18n::Lang::Tr {354 if lang == i18n::Lang::Tr {
352 <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>355 <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time>
353 <span>(g::t(lang, K::Committed))</span>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 fn updated_at(&self) -> &str {152 fn updated_at(&self) -> &str {
162 match self {153 match self {
163 Entry::Issue(note) => &note.updated_at,154 Entry::Issue(note) => &note.updated_at,
@@ -373,26 +364,12 @@ async fn list_entries(
373 Ok(entries)364 Ok(entries)
374 }365 }
375 366
376-/// The bell's popover rows: the viewer's newest entries, unread ones first, then read ones, each367+/// The bell's popover rows: the viewer's newest unread entries, newest first. Read entries are
377-/// newest first. Entries the viewer can no longer read are left out and stay as they are.368+/// left out, and so are entries the viewer can no longer read.
378 async fn peek_rows(state: &AppState, user: &User, lang: Lang, now: i64) -> Result<Vec<RowView>> {369 async fn peek_rows(state: &AppState, user: &User, lang: Lang, now: i64) -> Result<Vec<RowView>> {
379 let tz = user.timezone.clone();370 let tz = user.timezone.clone();
380 let mut entries = list_entries(state, user, true, PEEK_SIZE).await?;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;372+ entries.sort_by(|a, b| b.updated_at().cmp(a.updated_at()));
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- });
396 let mut readable = HashMap::new();373 let mut readable = HashMap::new();
397 let mut rows = Vec::new();374 let mut rows = Vec::new();
398 for entry in &entries {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 HTML549+/// `GET /notifications/peek`: the bell's popover, the viewer's newest unread notifications as an HTML
573 /// fragment. Anonymous viewers get a bare 401.550 /// fragment. Anonymous viewers get a bare 401.
574 #[route(GET "/notifications/peek")]551 #[route(GET "/notifications/peek")]
575 async fn peek(cx: &Cx) -> Result<Response> {552 async fn peek(cx: &Cx) -> Result<Response> {
@@ -585,8 +562,8 @@ async fn peek(cx: &Cx) -> Result<Response> {
585 fragment.first().await?.into_response(cx)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 empty565+/// The bell's popover list of unread rows: each row opens through its open route, which marks it
589-/// list says the viewer is all caught up.566+/// read. An empty list says the viewer is all caught up.
590 #[component]567 #[component]
591 async fn peek_list(lang: Lang, rows: Vec<RowView>) -> Result<impl View> {568 async fn peek_list(lang: Lang, rows: Vec<RowView>) -> Result<impl View> {
592 let empty = rows.is_empty();569 let empty = rows.is_empty();
@@ -598,11 +575,7 @@ async fn peek_list(lang: Lang, rows: Vec<RowView>) -> Result<impl View> {
598 for row in rows.into_iter() {575 for row in rows.into_iter() {
599 <li>576 <li>
600 <a class="bell-item" href=(row.open_href.as_str())>577 <a class="bell-item" href=(row.open_href.as_str())>
601- if row.unread {578+ <span class="bell-dot unread" aria-hidden="true"></span>
602- <span class="bell-dot unread" aria-hidden="true"></span>
603- } else {
604- <span class="bell-dot" aria-hidden="true"></span>
605- }
606 <span class="bell-text">579 <span class="bell-text">
607 <span class="bell-line">(row.title_line.as_str())</span>580 <span class="bell-line">(row.title_line.as_str())</span>
608 <span class="bell-meta muted">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 /// Whether `user` may create an organization under the instance's policy.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 match state.live().orgs.creation {37 match state.live().orgs.creation {
38 OrgCreation::All => true,38 OrgCreation::All => true,
39 OrgCreation::Admin => user.is_admin,39 OrgCreation::Admin => user.is_admin,
crates/forge-web/src/views/mod.rsmodified+29 -5
@@ -105,9 +105,12 @@ struct SideRepo {
105 href: String,105 href: String,
106 }106 }
107 107
108-/// The global nav item for a request path: `dashboard` for `/`, otherwise the first segment when108+/// The global nav item for a request path: `dashboard` for `/`, `new-org` for `/org/new`, otherwise
109-/// it is a global page. Empty for repo pages and everything else.109+/// the first segment when it is a global page. Empty for repo pages and everything else.
110 fn nav_key(path: &str) -> &'static str {110 fn nav_key(path: &str) -> &'static str {
111+ if path.trim_matches('/') == "org/new" {
112+ return "new-org";
113+ }
111 match path.trim_matches('/').split('/').next().unwrap_or("") {114 match path.trim_matches('/').split('/').next().unwrap_or("") {
112 "" => "dashboard",115 "" => "dashboard",
113 "explore" => "explore",116 "explore" => "explore",
@@ -357,6 +360,8 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View>
357 let logout_label = t(lang, Key::LogOut);360 let logout_label = t(lang, Key::LogOut);
358 let bell_title = i18n::t(lang, Key::Notifications);361 let bell_title = i18n::t(lang, Key::Notifications);
359 let open_label = mi::t(lang, MK::OpenNotifications);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 let loading_label = mi::t(lang, MK::PeekLoading);365 let loading_label = mi::t(lang, MK::PeekLoading);
361 let error_label = mi::t(lang, MK::PeekError);366 let error_label = mi::t(lang, MK::PeekError);
362 Ok(view! {367 Ok(view! {
@@ -407,7 +412,13 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View>
407 <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>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 <div class="bell-pop" popover="auto" role="dialog" aria-label=(bell_title) data-loading=(loading_label) data-error=(error_label)>413 <div class="bell-pop" popover="auto" role="dialog" aria-label=(bell_title) data-loading=(loading_label) data-error=(error_label)>
409 <div class="bell-box">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 <div class="bell-list"></div>422 <div class="bell-list"></div>
412 <a class="button bell-open" href="/notifications">(open_label)</a>423 <a class="button bell-open" href="/notifications">(open_label)</a>
413 </div>424 </div>
@@ -454,6 +465,11 @@ pub async fn shell(
454 },465 },
455 None => (0, (Vec::new(), 0), InboxKinds::default(), no_runs(), Vec::new()),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 let unread_badge = (unread > 0).then(|| unread.to_string());473 let unread_badge = (unread > 0).then(|| unread.to_string());
458 let side_repos: Vec<SideRepo> = listed474 let side_repos: Vec<SideRepo> = listed
459 .iter()475 .iter()
@@ -684,7 +700,7 @@ pub async fn shell(
684 if let Some(section) = section_menu {700 if let Some(section) = section_menu {
685 section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live)701 section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live)
686 } else {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 if let Some(corner) = corner_panel {705 if let Some(corner) = corner_panel {
690 profile_corner(lang: lang, corner: corner)706 profile_corner(lang: lang, corner: corner)
@@ -790,7 +806,7 @@ pub async fn shell(
790 if let Some(section) = section {806 if let Some(section) = section {
791 section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live)807 section_nav(title: section.title.as_str(), back: section.back, items: section.items, current: section.current, live: section.live)
792 } else {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 if let Some(corner) = corner_aside {811 if let Some(corner) = corner_aside {
796 profile_corner(lang: lang, corner: corner)812 profile_corner(lang: lang, corner: corner)
@@ -836,6 +852,7 @@ async fn side_nav(
836 profile_repos_href: &str,852 profile_repos_href: &str,
837 unread: Option<String>,853 unread: Option<String>,
838 repos: Vec<SideRepo>,854 repos: Vec<SideRepo>,
855+ can_create_org: bool,
839 ) -> Result<impl View> {856 ) -> Result<impl View> {
840 let dashboard = current == "dashboard";857 let dashboard = current == "dashboard";
841 let explore = current == "explore";858 let explore = current == "explore";
@@ -843,6 +860,7 @@ async fn side_nav(
843 let notifications = current == "notifications";860 let notifications = current == "notifications";
844 let snippets = current == "snippets";861 let snippets = current == "snippets";
845 let new_repo = current == "new";862 let new_repo = current == "new";
863+ let new_org = current == "new-org";
846 let settings = current == "settings";864 let settings = current == "settings";
847 let empty = repos.is_empty();865 let empty = repos.is_empty();
848 Ok(view! {866 Ok(view! {
@@ -874,6 +892,12 @@ async fn side_nav(
874 <svg class="ico" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 8v8M8 12h8"/></svg>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 (t(lang, Key::NewRepository))893 (t(lang, Key::NewRepository))
876 </a>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 <a class=(side_class(settings)) href="/settings/profile" aria-current=(settings.then_some("page"))>901 <a class=(side_class(settings)) href="/settings/profile" aria-current=(settings.then_some("page"))>
878 <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>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 (o::t(lang, OK::Settings))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 let tahinli = login(&http, "tahinli", PW).await;490 let tahinli = login(&http, "tahinli", PW).await;
491 let root_session = login(&http, "root", PW).await;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 assert_eq!(509 assert_eq!(
494 http.get("/org/new", Some(&tahinli)).await.status,510 http.get("/org/new", Some(&tahinli)).await.status,
495 403,511 403,
style/_import.scssmodified+4 -0
@@ -11,6 +11,10 @@
11 border-bottom: 1px solid var(--border);11 border-bottom: 1px solid var(--border);
12 }12 }
13 13
14+.import-tabs + .alert {
15+ max-width: 960px;
16+}
17+
14 .import-tab {18 .import-tab {
15 margin-bottom: -1px;19 margin-bottom: -1px;
16 padding: 8px 14px;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 // The full commit hash in its copy box: one line, truncated with an ellipsis when the screen is1260 // The full commit hash in its copy box: one line, truncated with an ellipsis when the screen is
1256 // narrow, so the hash never breaks in the middle. The Copy button always copies the whole hash.1261 // narrow, so the hash never breaks in the middle. The Copy button always copies the whole hash.
1257 .commit-info .commit-full-oid {1262 .commit-info .commit-full-oid {
style/_shell.scssmodified+20 -3
@@ -821,17 +821,33 @@ a.chip {
821 }821 }
822 822
823 .bell-head {823 .bell-head {
824+ display: flex;
825+ align-items: center;
826+ justify-content: space-between;
827+ gap: 8px;
824 padding: 10px 14px 8px;828 padding: 10px 14px 8px;
825 border-bottom: 1px solid var(--border);829 border-bottom: 1px solid var(--border);
826 font-size: 14px;830 font-size: 14px;
827 font-weight: 600;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 .bell-list {845 .bell-list {
831 flex: 1 1 auto;846 flex: 1 1 auto;
832 min-height: 0;847 min-height: 0;
833 overflow-y: auto;848 overflow-y: auto;
834 padding: 4px;849 padding: 4px;
850+ border-bottom: 1px solid var(--border);
835 }851 }
836 852
837 .bell-rows {853 .bell-rows {
@@ -897,9 +913,10 @@ a.chip {
897 }913 }
898 914
899 .bell-open {915 .bell-open {
900- display: block;916+ flex: none;
901- margin: 4px;917+ align-self: stretch;
902- text-align: center;918+ justify-content: center;
919+ margin: 8px;
903 text-decoration: none;920 text-decoration: none;
904 }921 }
905 922