thunderbird-patch-review

Easy-to-use patch review interface for Thunderbird

Contribute: ~marcc/thunderbird-review-plugin@lists.sr.ht

git clone git://mccd.space/thunderbird-patch-review

commit c47dfc73eea5d8c26ceffa52053c59a46db23c64
parent 8833e293294ae6d4ba413f866b4fd78db21d706d
Author: Pi Agent <agent@pi.local>
Date:   Sat, 18 Jul 2026 15:29:40 +0200

review: disable Send review when there's nothing to send

Send review needs at least one draft comment, or — for a sourcehut\nseries — a patchset-status update that can go out as a stand-alone reply.\nWith neither, disable the Send review button and its drop-down toggle so\nthe confirmation modal cannot be opened with nothing to do; add a\ndisabled-button style so the state reads visually.

Diffstat:
Mextension/review/review.css | 2++
Mextension/review/review.js | 10+++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/extension/review/review.css b/extension/review/review.css
@@ -115,6 +115,8 @@ button {
 }
 
 button:hover { background: var(--hunk-bg); }
+button:disabled { opacity: 0.5; cursor: not-allowed; }
+button:disabled:hover { background: inherit; }
 
 .split .menu button.danger {
   color: #cf222e;
diff --git a/extension/review/review.js b/extension/review/review.js
@@ -53,7 +53,8 @@ async function init() {
     anchor.title.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) ||
     "patchset";
 
-  if (response.isSourcehut) {
+  state.isSourcehut = Boolean(response.isSourcehut);
+  if (state.isSourcehut) {
     const select = $("#srht-select");
     for (const status of SOURCEHUT_STATUSES) {
       const option = document.createElement("option");
@@ -461,6 +462,13 @@ function updateCount() {
   const total = state.comments.reduce((sum, c) => sum + Object.keys(c).length, 0);
   // The discard button only makes sense once there are drafts to lose.
   $("#btn-discard").hidden = total === 0;
+  // Send review needs something to send: a draft comment, or — for a
+  // sourcehut series — at least a patchset-status update (which can go
+  // out as a stand-alone reply). Non-sourcehut with no comments is
+  // disabled so the modal cannot be opened with nothing to do.
+  const canSend = total > 0 || state.isSourcehut;
+  $("#btn-send").disabled = !canSend;
+  $("#send-split").querySelector(".menu-toggle").disabled = !canSend;
 }
 
 $("#btn-discard").addEventListener("click", async () => {