chiark / gitweb /
Only display _nonzero_ follow-request counts.
authorSimon Tatham <anakin@pobox.com>
Sat, 3 Feb 2024 12:09:25 +0000 (12:09 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 3 Feb 2024 12:09:25 +0000 (12:09 +0000)
Ahem. Of course I initially tested this in the difficult case, and
forgot to check the easy one :-)

src/menu.rs

index 25a197eb6428ea3c50b233ff5bd9eeb57ce36fdc..8c24e08efa994b65036f948fb1cc6f95e0570bd9 100644 (file)
@@ -270,19 +270,21 @@ pub fn main_menu(client: &mut Client) -> Box<dyn ActivityState> {
         .and_then(|ac| ac.source)
         .map(|s| s.follow_requests_count)
     {
-        menu.add_info_coloured(
-            ColouredString::uniform(
-                &format!(
-                    "You have {} pending follow request{}!",
-                    n,
-                    if n == 1 { "" } else { "s" },
+        if n > 0 {
+            menu.add_info_coloured(
+                ColouredString::uniform(
+                    &format!(
+                        "You have {} pending follow request{}!",
+                        n,
+                        if n == 1 { "" } else { "s" },
+                    ),
+                    'F',
+                ) + ColouredString::general(
+                    " View with [ESC][Y][L][R]",
+                    " HHHHHHHHHHHKKKHHKHHKHHKH",
                 ),
-                'F',
-            ) + ColouredString::general(
-                " View with [ESC][Y][L][R]",
-                " HHHHHHHHHHHKKKHHKHHKHHKH",
-            ),
-        );
+            );
+        }
     }
 
     Box::new(menu.finalise())