Fossil SCM

Automatic moderation approval for attachments to moderation-approved forum posts seems to work.

stephan 2026-05-23 09:57 UTC forum-attachments
Commit bd00fbe81a7a81d9efa7f12915686dc1d84b622ebe0ce49dc66a2455ef58116a
+5 -1
--- src/forum.c
+++ src/forum.c
@@ -200,11 +200,11 @@
200200
return i ? -rc : rc;
201201
}
202202
203203
/* True if moderation of forum posts performs the same operation
204204
** on its attachments. UNTESTED. */
205
-#define FORUMPOST_MOD_ATTACHMENTS 0
205
+#define FORUMPOST_MOD_ATTACHMENTS 1
206206
#if FORUMPOST_MOD_ATTACHMENTS
207207
/*
208208
** Internal helper for moderation_forumpost_...().
209209
*/
210210
static void forumpost_prepare_attachids(Stmt *q, int fpid){
@@ -1041,10 +1041,14 @@
10411041
@ class='%s(iClosed ? "action-reopen" : "action-close")'/>
10421042
}
10431043
@ </form>
10441044
}
10451045
if( g.perm.Admin || forumpost_is_owner(p/*not pHead*/->fpid, 0) ){
1046
+ /* When an admin edits someone else's post, the admin
1047
+ ** effectively takes over ownership of it (and we currently
1048
+ ** have no way of passing it back). Because of this, we
1049
+ ** check the ownership of `p` instead of `pHead`. */
10461050
@ <form method="post" action="%R/attachadd">\
10471051
@ <input type="hidden" name="forumpost" value="%T(pHead->zUuid)">
10481052
@ <input type="submit" value="Attach...">
10491053
login_insert_csrf_secret();
10501054
@ </form>
10511055
--- src/forum.c
+++ src/forum.c
@@ -200,11 +200,11 @@
200 return i ? -rc : rc;
201 }
202
203 /* True if moderation of forum posts performs the same operation
204 ** on its attachments. UNTESTED. */
205 #define FORUMPOST_MOD_ATTACHMENTS 0
206 #if FORUMPOST_MOD_ATTACHMENTS
207 /*
208 ** Internal helper for moderation_forumpost_...().
209 */
210 static void forumpost_prepare_attachids(Stmt *q, int fpid){
@@ -1041,10 +1041,14 @@
1041 @ class='%s(iClosed ? "action-reopen" : "action-close")'/>
1042 }
1043 @ </form>
1044 }
1045 if( g.perm.Admin || forumpost_is_owner(p/*not pHead*/->fpid, 0) ){
 
 
 
 
1046 @ <form method="post" action="%R/attachadd">\
1047 @ <input type="hidden" name="forumpost" value="%T(pHead->zUuid)">
1048 @ <input type="submit" value="Attach...">
1049 login_insert_csrf_secret();
1050 @ </form>
1051
--- src/forum.c
+++ src/forum.c
@@ -200,11 +200,11 @@
200 return i ? -rc : rc;
201 }
202
203 /* True if moderation of forum posts performs the same operation
204 ** on its attachments. UNTESTED. */
205 #define FORUMPOST_MOD_ATTACHMENTS 1
206 #if FORUMPOST_MOD_ATTACHMENTS
207 /*
208 ** Internal helper for moderation_forumpost_...().
209 */
210 static void forumpost_prepare_attachids(Stmt *q, int fpid){
@@ -1041,10 +1041,14 @@
1041 @ class='%s(iClosed ? "action-reopen" : "action-close")'/>
1042 }
1043 @ </form>
1044 }
1045 if( g.perm.Admin || forumpost_is_owner(p/*not pHead*/->fpid, 0) ){
1046 /* When an admin edits someone else's post, the admin
1047 ** effectively takes over ownership of it (and we currently
1048 ** have no way of passing it back). Because of this, we
1049 ** check the ownership of `p` instead of `pHead`. */
1050 @ <form method="post" action="%R/attachadd">\
1051 @ <input type="hidden" name="forumpost" value="%T(pHead->zUuid)">
1052 @ <input type="submit" value="Attach...">
1053 login_insert_csrf_secret();
1054 @ </form>
1055
--- src/setupuser.c
+++ src/setupuser.c
@@ -860,10 +860,12 @@
860860
@ <li><label><input type="checkbox" name="a3"%s(oa['3'])>
861861
@ Write Forum%s(B('3'))</label>
862862
@ <li><label><input type="checkbox" name="a4"%s(oa['4'])>
863863
@ WriteTrusted Forum%s(B('4'))</label>
864864
@ <li><label><input type="checkbox" name="a5"%s(oa['5'])>
865
+ @ Attach to Forum%s(B('B'))</label>
866
+ @ <li><label><input type="checkbox" name="ag"%s(oa['g'])>
865867
@ Moderate Forum%s(B('5'))</label>
866868
@ <li><label><input type="checkbox" name="a6"%s(oa['6'])>
867869
@ Supervise Forum%s(B('6'))</label>
868870
@ <li><label><input type="checkbox" name="a7"%s(oa['7'])>
869871
@ Email Alerts%s(B('7'))</label>
870872
--- src/setupuser.c
+++ src/setupuser.c
@@ -860,10 +860,12 @@
860 @ <li><label><input type="checkbox" name="a3"%s(oa['3'])>
861 @ Write Forum%s(B('3'))</label>
862 @ <li><label><input type="checkbox" name="a4"%s(oa['4'])>
863 @ WriteTrusted Forum%s(B('4'))</label>
864 @ <li><label><input type="checkbox" name="a5"%s(oa['5'])>
 
 
865 @ Moderate Forum%s(B('5'))</label>
866 @ <li><label><input type="checkbox" name="a6"%s(oa['6'])>
867 @ Supervise Forum%s(B('6'))</label>
868 @ <li><label><input type="checkbox" name="a7"%s(oa['7'])>
869 @ Email Alerts%s(B('7'))</label>
870
--- src/setupuser.c
+++ src/setupuser.c
@@ -860,10 +860,12 @@
860 @ <li><label><input type="checkbox" name="a3"%s(oa['3'])>
861 @ Write Forum%s(B('3'))</label>
862 @ <li><label><input type="checkbox" name="a4"%s(oa['4'])>
863 @ WriteTrusted Forum%s(B('4'))</label>
864 @ <li><label><input type="checkbox" name="a5"%s(oa['5'])>
865 @ Attach to Forum%s(B('B'))</label>
866 @ <li><label><input type="checkbox" name="ag"%s(oa['g'])>
867 @ Moderate Forum%s(B('5'))</label>
868 @ <li><label><input type="checkbox" name="a6"%s(oa['6'])>
869 @ Supervise Forum%s(B('6'))</label>
870 @ <li><label><input type="checkbox" name="a7"%s(oa['7'])>
871 @ Email Alerts%s(B('7'))</label>
872
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -446,11 +446,11 @@
446446
which the attachment is connected. The third argument is either
447447
missing or else it is the lower-case artifact ID of the attachment
448448
itself. A missing third argument means that the attachment should be
449449
deleted. If <i>source</i> is a forum post, the hash provided should
450450
generally be the hash of the first version of the post for reasons
451
-[#forumpost-tag|explained below].
451
+[#forumpost-tag|explained in the section on tags].
452452
453453
The <b>C</b> card is an optional comment describing what the attachment is about.
454454
The <b>C</b> card is optional, but there can only be one.
455455
456456
A single <b>D</b> card is required to give the date and time when the attachment
@@ -606,21 +606,24 @@
606606
[#wikichng | wiki artifact].
607607
608608
The <b>Z</b> card is the required checksum over the rest of the artifact.
609609
610610
<a name="forumpost-tag"></a>
611
-<strong>Forum posts and tags:</strong>
612
-
613
-When adding [#ctrl|tags] or [#attachment|attachments] to forum posts
614
-it is generally up to the application to tag/attach to only the first
615
-version of any given post. For example, if post X has two edits, a tag
616
-or applied, or attachment added, by the user to post X+2 should
617
-generally be applied to version X instead. Though this complicates the
618
-app logic for applying tags, it simplifies the app's location of tags.
619
-As of this writing (May 2026), no current Fossil use cases would be
620
-improved by tagging specific subsequent versions of posts, e.g. our
621
-hypothetical X+1.
611
+<h4>2.8.1 Tags and Attachments on Forum Posts</h4>
612
+
613
+When adding [#ctrl|tags] or [#attachment|attachments] to [#forum|forum
614
+posts] it is generally up to the application to tag, or attach to,
615
+only the first version of any given post. For example, if post X has
616
+two edits, a tag or applied, or attachment added, by the user to post
617
+X+2 should generally be applied to version X instead. Though this
618
+complicates the app logic for applying tags, it simplifies the app's
619
+location of tags for purposes of applying tag-/attachment-dependent
620
+logic. As of this writing (May 2026), no current Fossil use cases
621
+would be improved by tagging specific subsequent versions of posts,
622
+e.g. the hypothetical X+1.
623
+
624
+Forum posts, because they have a P-card, support propagating tags.
622625
623626
624627
<h2 id="summary">3.0 Card Summary</h2>
625628
626629
The following table summarizes the various kinds of cards that appear
627630
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -446,11 +446,11 @@
446 which the attachment is connected. The third argument is either
447 missing or else it is the lower-case artifact ID of the attachment
448 itself. A missing third argument means that the attachment should be
449 deleted. If <i>source</i> is a forum post, the hash provided should
450 generally be the hash of the first version of the post for reasons
451 [#forumpost-tag|explained below].
452
453 The <b>C</b> card is an optional comment describing what the attachment is about.
454 The <b>C</b> card is optional, but there can only be one.
455
456 A single <b>D</b> card is required to give the date and time when the attachment
@@ -606,21 +606,24 @@
606 [#wikichng | wiki artifact].
607
608 The <b>Z</b> card is the required checksum over the rest of the artifact.
609
610 <a name="forumpost-tag"></a>
611 <strong>Forum posts and tags:</strong>
612
613 When adding [#ctrl|tags] or [#attachment|attachments] to forum posts
614 it is generally up to the application to tag/attach to only the first
615 version of any given post. For example, if post X has two edits, a tag
616 or applied, or attachment added, by the user to post X+2 should
617 generally be applied to version X instead. Though this complicates the
618 app logic for applying tags, it simplifies the app's location of tags.
619 As of this writing (May 2026), no current Fossil use cases would be
620 improved by tagging specific subsequent versions of posts, e.g. our
621 hypothetical X+1.
 
 
 
622
623
624 <h2 id="summary">3.0 Card Summary</h2>
625
626 The following table summarizes the various kinds of cards that appear
627
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -446,11 +446,11 @@
446 which the attachment is connected. The third argument is either
447 missing or else it is the lower-case artifact ID of the attachment
448 itself. A missing third argument means that the attachment should be
449 deleted. If <i>source</i> is a forum post, the hash provided should
450 generally be the hash of the first version of the post for reasons
451 [#forumpost-tag|explained in the section on tags].
452
453 The <b>C</b> card is an optional comment describing what the attachment is about.
454 The <b>C</b> card is optional, but there can only be one.
455
456 A single <b>D</b> card is required to give the date and time when the attachment
@@ -606,21 +606,24 @@
606 [#wikichng | wiki artifact].
607
608 The <b>Z</b> card is the required checksum over the rest of the artifact.
609
610 <a name="forumpost-tag"></a>
611 <h4>2.8.1 Tags and Attachments on Forum Posts</h4>
612
613 When adding [#ctrl|tags] or [#attachment|attachments] to [#forum|forum
614 posts] it is generally up to the application to tag, or attach to,
615 only the first version of any given post. For example, if post X has
616 two edits, a tag or applied, or attachment added, by the user to post
617 X+2 should generally be applied to version X instead. Though this
618 complicates the app logic for applying tags, it simplifies the app's
619 location of tags for purposes of applying tag-/attachment-dependent
620 logic. As of this writing (May 2026), no current Fossil use cases
621 would be improved by tagging specific subsequent versions of posts,
622 e.g. the hypothetical X+1.
623
624 Forum posts, because they have a P-card, support propagating tags.
625
626
627 <h2 id="summary">3.0 Card Summary</h2>
628
629 The following table summarizes the various kinds of cards that appear
630

Keyboard Shortcuts

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