diff options
| author | Fuwn <[email protected]> | 2022-04-01 01:25:46 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-01 01:25:46 -0700 |
| commit | 09ca2160763df78df9f1386b96507e3427f0c3bc (patch) | |
| tree | 4c1678ba9f2f49c6e59ce53d0cb6928826514aab /src/lib.rs | |
| parent | feat: variable max amount of comments (diff) | |
| download | windmark-comments-09ca2160763df78df9f1386b96507e3427f0c3bc.tar.xz windmark-comments-09ca2160763df78df9f1386b96507e3427f0c3bc.zip | |
feat: display number of comments out of max
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -165,7 +165,13 @@ pub fn module(router: &mut windmark::Router) { router.set_footer(Box::new(|_| { format!( - "## COMMENTS\n=> /api/post-comment Make a comment!\n{}", + "## COMMENTS ({}/{})\n=> /api/post-comment Make a comment!\n{}", + if let Ok(comments) = COMMENTS.lock() { + (*comments).len().to_string() + } else { + "?".to_string() + }, + MAX_COMMENTS.load(Ordering::SeqCst), if let Ok(comments) = COMMENTS.lock() { let comments = (*comments) .iter() |