thunderbird-patch-review
Simple email patch review tool for Thunderbird
git clone git://mccd.space/thunderbird-patch-reviewcommit 3fb59dbcbd1bc4c5b9287e276cad3a050c5b9c55
parent ca7e115497a69d92921b760c41ae4f6dbe332f94
Author: Pi Agent <agent@pi.local>
Date: Sat, 18 Jul 2026 22:39:57 +0200
review: refresh the title before button-pluralization in updateCount
Reorder updateCount so renderSeriesTitle() runs first, independently of the
Send review button-text line; if the latter ever threw (e.g. a sparse
state.comments making Object.keys(state.comments[i]) fail), the title
counter would stay stale until a patch switch. Guard both the array access
and the firstChild text-node write.
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/extension/review/review.js b/extension/review/review.js
@@ -480,10 +480,15 @@ function updateCount() {
const canSend = total > 0 || state.isSourcehut;
$("#btn-send").disabled = !canSend;
$("#send-split").querySelector(".menu-toggle").disabled = !canSend;
- // One reply per commented patch — pluralize the button to match.
- const commented = state.series.filter((_, i) => Object.keys(state.comments[i]).length).length;
- $("#btn-send").firstChild.nodeValue = commented === 1 ? "Send review" : "Send reviews";
+ // The title is independent of the button-pluralization below; update it
+ // first so a failure in the latter cannot leave the count stale.
renderSeriesTitle();
+ // One reply per commented patch — pluralize the button to match.
+ const commented = state.series.filter((_, i) => Object.keys(state.comments[i] || {}).length).length;
+ const send = $("#btn-send");
+ if (send.firstChild && send.firstChild.nodeType === 3) {
+ send.firstChild.nodeValue = commented === 1 ? "Send review" : "Send reviews";
+ }
}
$("#btn-discard").addEventListener("click", async () => {