Fossil SCM

In JS-capable browsers, add a confirmation step to the forum Approve and Reject buttons in an attempt to reduce the odds of a repeat of [https://sqlite.org/forum/forumpost/914c161a70|sqlite forum post 2026-06-29T09:52:29Z]. Add some space between those buttons.

stephan 2026-06-29 10:41 UTC trunk
Commit a3e5bd4a52cfacbdf06743653d2dc0bc0b6f611a18701f7f5a814030f35567fc
+4 -2
--- src/forum.c
+++ src/forum.c
@@ -1307,12 +1307,14 @@
13071307
}
13081308
}else if( g.perm.ModForum ){
13091309
/* Allow moderators to approve or reject pending posts. Also allow
13101310
** forum supervisors to mark non-special users as trusted and therefore
13111311
** able to post unmoderated. */
1312
- @ <input type="submit" name="approve" value="Approve">
1313
- @ <input type="submit" name="reject" value="Reject">
1312
+ @ <input type="submit" name="approve" value="Approve" \
1313
+ @ class="action-approve">\
1314
+ @ <input type="submit" name="reject" value="Reject" \
1315
+ @ class="action-reject">\
13141316
if( g.perm.AdminForum && !login_is_special(pManifest->zUser) ){
13151317
@ <br><label><input type="checkbox" name="trust">
13161318
@ Trust user "%h(pManifest->zUser)" so that future posts by \
13171319
@ "%h(pManifest->zUser)" do not require moderation.
13181320
@ </label>
13191321
--- src/forum.c
+++ src/forum.c
@@ -1307,12 +1307,14 @@
1307 }
1308 }else if( g.perm.ModForum ){
1309 /* Allow moderators to approve or reject pending posts. Also allow
1310 ** forum supervisors to mark non-special users as trusted and therefore
1311 ** able to post unmoderated. */
1312 @ <input type="submit" name="approve" value="Approve">
1313 @ <input type="submit" name="reject" value="Reject">
 
 
1314 if( g.perm.AdminForum && !login_is_special(pManifest->zUser) ){
1315 @ <br><label><input type="checkbox" name="trust">
1316 @ Trust user "%h(pManifest->zUser)" so that future posts by \
1317 @ "%h(pManifest->zUser)" do not require moderation.
1318 @ </label>
1319
--- src/forum.c
+++ src/forum.c
@@ -1307,12 +1307,14 @@
1307 }
1308 }else if( g.perm.ModForum ){
1309 /* Allow moderators to approve or reject pending posts. Also allow
1310 ** forum supervisors to mark non-special users as trusted and therefore
1311 ** able to post unmoderated. */
1312 @ <input type="submit" name="approve" value="Approve" \
1313 @ class="action-approve">\
1314 @ <input type="submit" name="reject" value="Reject" \
1315 @ class="action-reject">\
1316 if( g.perm.AdminForum && !login_is_special(pManifest->zUser) ){
1317 @ <br><label><input type="checkbox" name="trust">
1318 @ Trust user "%h(pManifest->zUser)" so that future posts by \
1319 @ "%h(pManifest->zUser)" do not require moderation.
1320 @ </label>
1321
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -982,14 +982,26 @@
982982
? "Confirm re-open"
983983
: "Confirm close"),
984984
onconfirm: ()=>form.submit()
985985
});
986986
});
987
+ form
988
+ .querySelectorAll("input.action-approve, input.action-reject")
989
+ .forEach(function(e){
990
+ e.type = 'button'/*do not submit form on click*/;
991
+ F.confirmer(e, {
992
+ confirmText: (e.classList.contains('action-approve')
993
+ ? "Confirm approval"
994
+ : "Confirm rejection"),
995
+ onconfirm: ()=>form.submit()
996
+ });
997
+ /* We should also arguably disable the approve/reject
998
+ button's counterpart while it's counting down. */
999
+ });
9871000
form
9881001
.querySelectorAll("input[type='button'].action-status")
9891002
.forEach(function(btn){
990
- btn.classList.remove('hidden');
9911003
const sel = btn.previousElementSibling;
9921004
const updateButton = ()=>{
9931005
/* Enable btn only when the status has been locally
9941006
modified. */
9951007
if( sel.dataset.initialValue ){
9961008
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -982,14 +982,26 @@
982 ? "Confirm re-open"
983 : "Confirm close"),
984 onconfirm: ()=>form.submit()
985 });
986 });
 
 
 
 
 
 
 
 
 
 
 
 
 
987 form
988 .querySelectorAll("input[type='button'].action-status")
989 .forEach(function(btn){
990 btn.classList.remove('hidden');
991 const sel = btn.previousElementSibling;
992 const updateButton = ()=>{
993 /* Enable btn only when the status has been locally
994 modified. */
995 if( sel.dataset.initialValue ){
996
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -982,14 +982,26 @@
982 ? "Confirm re-open"
983 : "Confirm close"),
984 onconfirm: ()=>form.submit()
985 });
986 });
987 form
988 .querySelectorAll("input.action-approve, input.action-reject")
989 .forEach(function(e){
990 e.type = 'button'/*do not submit form on click*/;
991 F.confirmer(e, {
992 confirmText: (e.classList.contains('action-approve')
993 ? "Confirm approval"
994 : "Confirm rejection"),
995 onconfirm: ()=>form.submit()
996 });
997 /* We should also arguably disable the approve/reject
998 button's counterpart while it's counting down. */
999 });
1000 form
1001 .querySelectorAll("input[type='button'].action-status")
1002 .forEach(function(btn){
 
1003 const sel = btn.previousElementSibling;
1004 const updateButton = ()=>{
1005 /* Enable btn only when the status has been locally
1006 modified. */
1007 if( sel.dataset.initialValue ){
1008
--- src/style.forum.css
+++ src/style.forum.css
@@ -101,5 +101,9 @@
101101
.forumTime {
102102
/* Animate the transition when a ForumPostEditor shifts
103103
its post to the left. */
104104
transition: margin-left 0.25s linear;
105105
}
106
+
107
+.forum form input.action-approve {
108
+ margin-right: 1em;
109
+}
106110
--- src/style.forum.css
+++ src/style.forum.css
@@ -101,5 +101,9 @@
101 .forumTime {
102 /* Animate the transition when a ForumPostEditor shifts
103 its post to the left. */
104 transition: margin-left 0.25s linear;
105 }
 
 
 
 
106
--- src/style.forum.css
+++ src/style.forum.css
@@ -101,5 +101,9 @@
101 .forumTime {
102 /* Animate the transition when a ForumPostEditor shifts
103 its post to the left. */
104 transition: margin-left 0.25s linear;
105 }
106
107 .forum form input.action-approve {
108 margin-right: 1em;
109 }
110

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button