aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-04-01 01:25:46 -0700
committerFuwn <[email protected]>2022-04-01 01:25:46 -0700
commit09ca2160763df78df9f1386b96507e3427f0c3bc (patch)
tree4c1678ba9f2f49c6e59ce53d0cb6928826514aab
parentfeat: variable max amount of comments (diff)
downloadwindmark-comments-09ca2160763df78df9f1386b96507e3427f0c3bc.tar.xz
windmark-comments-09ca2160763df78df9f1386b96507e3427f0c3bc.zip
feat: display number of comments out of max
-rw-r--r--src/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c5b1016..bf6bd15 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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()