special-case zero for comment count
authorM. Taylor Saotome-Westlake <ultimatelyuntruethought@gmail.com>
Sun, 18 Sep 2022 01:05:16 +0000 (18:05 -0700)
committerM. Taylor Saotome-Westlake <ultimatelyuntruethought@gmail.com>
Sun, 18 Sep 2022 01:05:16 +0000 (18:05 -0700)
Maybe tweaking some JavaScript will help me feel less gross.

theme/static/js/comment_counts.js

index 1a3d281..ced469a 100644 (file)
@@ -18,6 +18,9 @@ function placeCommentCounts() {
             for (let [i, container] of containers.entries()) {
                 let a = document.createElement('a');
                 let count = counts[i];
+                if count === 0 {
+                    count = "no";
+                }
                 let pluralizer = count === 1 ? "" : "s";
                 let text = document.createTextNode(`${count} comment${pluralizer}`);
                 a.appendChild(text);