Fossil SCM

Merge the forum-attach-moderated branch into small-fixes.

stephan 2026-11-12 20:02 UTC small-fixes merge
Commit 23b9245617761ab1812111eac1aaf68788c68555d1ceba3f8313f5f976b0926c
+27 -11
--- src/attach.c
+++ src/attach.c
@@ -177,11 +177,12 @@
177177
int attach_user_may(int rid, int eArtifactType){
178178
if( g.perm.Admin ) return 1;
179179
if( !login_is_individual() ) return 0;
180180
switch(eArtifactType){
181181
case CFTYPE_FORUM:
182
- return g.perm.AttachForum && forumpost_is_owner(rid, 0);
182
+ return (g.perm.AttachForum || g.perm.WrTForum)
183
+ && forumpost_is_owner(rid, 0);
183184
case CFTYPE_WIKI:
184185
return g.perm.ApndWiki && g.perm.Attach;
185186
case CFTYPE_TICKET:
186187
return g.perm.ApndTkt && g.perm.Attach;
187188
case CFTYPE_EVENT:
@@ -645,11 +646,11 @@
645646
char *zTargetType = 0;
646647
char *zExtraFree = 0;
647648
int szContent;
648649
int goodCaptcha = 1;
649650
int szLimit = 0;
650
-
651
+ int bNeedsModeration = -1; /* -1==don't yet know */
651652
if( P("target")!=0 ){
652653
attachaddV2_page();
653654
return;
654655
}
655656
zPage = P("page");
@@ -670,12 +671,16 @@
670671
}
671672
login_check_credentials();
672673
if( zForumPost ){
673674
int fpid;
674675
if( g.perm.AttachForum==0 ){
675
- login_needed(g.anon.AttachForum);
676
- return;
676
+ if( g.perm.WrTForum ){
677
+ bNeedsModeration = 1;
678
+ }else{
679
+ login_needed(g.anon.AttachForum);
680
+ return;
681
+ }
677682
}
678683
fpid = forumpost_head_rid2(zForumPost);
679684
if( fpid<=0 ){
680685
webpage_error("Invalid forum post ID: %h", zForumPost);
681686
}else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){
@@ -737,14 +742,17 @@
737742
/* Fall through and render form. */
738743
}else if( P("ok")
739744
&& cgi_csrf_safe(2)
740745
&& szContent>0
741746
&& (goodCaptcha = captcha_is_correct(0)) ){
742
- int needModerator = (zForumPost!=0 && forum_need_moderation()) ||
743
- (zTkt!=0 && ticket_need_moderation(0)) ||
744
- (zPage!=0 && wiki_need_moderation(0));
745
- attach_commit(zName, zTarget, aContent, szContent, needModerator, zComment);
747
+ if( bNeedsModeration<0 ){
748
+ bNeedsModeration = (zForumPost!=0 && forum_need_moderation()) ||
749
+ (zTkt!=0 && ticket_need_moderation(0)) ||
750
+ (zPage!=0 && wiki_need_moderation(0));
751
+ }
752
+ attach_commit(zName, zTarget, aContent, szContent,
753
+ bNeedsModeration, zComment);
746754
cgi_redirect(zTo ? zTo : zFrom);
747755
}
748756
749757
style_set_current_feature("attach");
750758
style_header("Add Attachment");
@@ -804,11 +812,17 @@
804812
db_rollback_transaction();
805813
return;
806814
case CFTYPE_FORUM:{
807815
int fpid;
808816
if( g.perm.AttachForum==0 ){
809
- goto ajax_err_403;
817
+ if( g.perm.WrTForum ){
818
+ bNeedsModeration = 1;
819
+ }else{
820
+ goto ajax_err_403;
821
+ }
822
+ }else{
823
+ bNeedsModeration = -1;
810824
}
811825
fpid = forumpost_head_rid2(zTarget);
812826
if( fpid<=0 ){
813827
goto ajax_err_404;
814828
}else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){
@@ -816,11 +830,13 @@
816830
"other users' forum posts.");
817831
db_rollback_transaction();
818832
return;
819833
}
820834
zTarget = zExtraFree = rid_to_uuid(fpid);
821
- bNeedsModeration = forum_need_moderation();
835
+ if( bNeedsModeration < 0 ){
836
+ bNeedsModeration = forum_need_moderation();
837
+ }
822838
break;
823839
}
824840
case CFTYPE_EVENT:{
825841
if( g.perm.Write==0 || g.perm.ApndWiki==0 || g.perm.Attach==0 ){
826842
goto ajax_err_403;
@@ -1006,11 +1022,11 @@
10061022
case 0:
10071023
webpage_error("Cannot resolve target=%h.", zTarget);
10081024
break;
10091025
case CFTYPE_FORUM:{
10101026
int fpid;
1011
- if( g.perm.AttachForum==0 ){
1027
+ if( 0==g.perm.AttachForum && 0==g.perm.WrTForum ){
10121028
login_needed(g.anon.AttachForum);
10131029
return;
10141030
}
10151031
fpid = forumpost_head_rid2(zTarget);
10161032
if( fpid<=0 ){
10171033
--- src/attach.c
+++ src/attach.c
@@ -177,11 +177,12 @@
177 int attach_user_may(int rid, int eArtifactType){
178 if( g.perm.Admin ) return 1;
179 if( !login_is_individual() ) return 0;
180 switch(eArtifactType){
181 case CFTYPE_FORUM:
182 return g.perm.AttachForum && forumpost_is_owner(rid, 0);
 
183 case CFTYPE_WIKI:
184 return g.perm.ApndWiki && g.perm.Attach;
185 case CFTYPE_TICKET:
186 return g.perm.ApndTkt && g.perm.Attach;
187 case CFTYPE_EVENT:
@@ -645,11 +646,11 @@
645 char *zTargetType = 0;
646 char *zExtraFree = 0;
647 int szContent;
648 int goodCaptcha = 1;
649 int szLimit = 0;
650
651 if( P("target")!=0 ){
652 attachaddV2_page();
653 return;
654 }
655 zPage = P("page");
@@ -670,12 +671,16 @@
670 }
671 login_check_credentials();
672 if( zForumPost ){
673 int fpid;
674 if( g.perm.AttachForum==0 ){
675 login_needed(g.anon.AttachForum);
676 return;
 
 
 
 
677 }
678 fpid = forumpost_head_rid2(zForumPost);
679 if( fpid<=0 ){
680 webpage_error("Invalid forum post ID: %h", zForumPost);
681 }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){
@@ -737,14 +742,17 @@
737 /* Fall through and render form. */
738 }else if( P("ok")
739 && cgi_csrf_safe(2)
740 && szContent>0
741 && (goodCaptcha = captcha_is_correct(0)) ){
742 int needModerator = (zForumPost!=0 && forum_need_moderation()) ||
743 (zTkt!=0 && ticket_need_moderation(0)) ||
744 (zPage!=0 && wiki_need_moderation(0));
745 attach_commit(zName, zTarget, aContent, szContent, needModerator, zComment);
 
 
 
746 cgi_redirect(zTo ? zTo : zFrom);
747 }
748
749 style_set_current_feature("attach");
750 style_header("Add Attachment");
@@ -804,11 +812,17 @@
804 db_rollback_transaction();
805 return;
806 case CFTYPE_FORUM:{
807 int fpid;
808 if( g.perm.AttachForum==0 ){
809 goto ajax_err_403;
 
 
 
 
 
 
810 }
811 fpid = forumpost_head_rid2(zTarget);
812 if( fpid<=0 ){
813 goto ajax_err_404;
814 }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){
@@ -816,11 +830,13 @@
816 "other users' forum posts.");
817 db_rollback_transaction();
818 return;
819 }
820 zTarget = zExtraFree = rid_to_uuid(fpid);
821 bNeedsModeration = forum_need_moderation();
 
 
822 break;
823 }
824 case CFTYPE_EVENT:{
825 if( g.perm.Write==0 || g.perm.ApndWiki==0 || g.perm.Attach==0 ){
826 goto ajax_err_403;
@@ -1006,11 +1022,11 @@
1006 case 0:
1007 webpage_error("Cannot resolve target=%h.", zTarget);
1008 break;
1009 case CFTYPE_FORUM:{
1010 int fpid;
1011 if( g.perm.AttachForum==0 ){
1012 login_needed(g.anon.AttachForum);
1013 return;
1014 }
1015 fpid = forumpost_head_rid2(zTarget);
1016 if( fpid<=0 ){
1017
--- src/attach.c
+++ src/attach.c
@@ -177,11 +177,12 @@
177 int attach_user_may(int rid, int eArtifactType){
178 if( g.perm.Admin ) return 1;
179 if( !login_is_individual() ) return 0;
180 switch(eArtifactType){
181 case CFTYPE_FORUM:
182 return (g.perm.AttachForum || g.perm.WrTForum)
183 && forumpost_is_owner(rid, 0);
184 case CFTYPE_WIKI:
185 return g.perm.ApndWiki && g.perm.Attach;
186 case CFTYPE_TICKET:
187 return g.perm.ApndTkt && g.perm.Attach;
188 case CFTYPE_EVENT:
@@ -645,11 +646,11 @@
646 char *zTargetType = 0;
647 char *zExtraFree = 0;
648 int szContent;
649 int goodCaptcha = 1;
650 int szLimit = 0;
651 int bNeedsModeration = -1; /* -1==don't yet know */
652 if( P("target")!=0 ){
653 attachaddV2_page();
654 return;
655 }
656 zPage = P("page");
@@ -670,12 +671,16 @@
671 }
672 login_check_credentials();
673 if( zForumPost ){
674 int fpid;
675 if( g.perm.AttachForum==0 ){
676 if( g.perm.WrTForum ){
677 bNeedsModeration = 1;
678 }else{
679 login_needed(g.anon.AttachForum);
680 return;
681 }
682 }
683 fpid = forumpost_head_rid2(zForumPost);
684 if( fpid<=0 ){
685 webpage_error("Invalid forum post ID: %h", zForumPost);
686 }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){
@@ -737,14 +742,17 @@
742 /* Fall through and render form. */
743 }else if( P("ok")
744 && cgi_csrf_safe(2)
745 && szContent>0
746 && (goodCaptcha = captcha_is_correct(0)) ){
747 if( bNeedsModeration<0 ){
748 bNeedsModeration = (zForumPost!=0 && forum_need_moderation()) ||
749 (zTkt!=0 && ticket_need_moderation(0)) ||
750 (zPage!=0 && wiki_need_moderation(0));
751 }
752 attach_commit(zName, zTarget, aContent, szContent,
753 bNeedsModeration, zComment);
754 cgi_redirect(zTo ? zTo : zFrom);
755 }
756
757 style_set_current_feature("attach");
758 style_header("Add Attachment");
@@ -804,11 +812,17 @@
812 db_rollback_transaction();
813 return;
814 case CFTYPE_FORUM:{
815 int fpid;
816 if( g.perm.AttachForum==0 ){
817 if( g.perm.WrTForum ){
818 bNeedsModeration = 1;
819 }else{
820 goto ajax_err_403;
821 }
822 }else{
823 bNeedsModeration = -1;
824 }
825 fpid = forumpost_head_rid2(zTarget);
826 if( fpid<=0 ){
827 goto ajax_err_404;
828 }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){
@@ -816,11 +830,13 @@
830 "other users' forum posts.");
831 db_rollback_transaction();
832 return;
833 }
834 zTarget = zExtraFree = rid_to_uuid(fpid);
835 if( bNeedsModeration < 0 ){
836 bNeedsModeration = forum_need_moderation();
837 }
838 break;
839 }
840 case CFTYPE_EVENT:{
841 if( g.perm.Write==0 || g.perm.ApndWiki==0 || g.perm.Attach==0 ){
842 goto ajax_err_403;
@@ -1006,11 +1022,11 @@
1022 case 0:
1023 webpage_error("Cannot resolve target=%h.", zTarget);
1024 break;
1025 case CFTYPE_FORUM:{
1026 int fpid;
1027 if( 0==g.perm.AttachForum && 0==g.perm.WrTForum ){
1028 login_needed(g.anon.AttachForum);
1029 return;
1030 }
1031 fpid = forumpost_head_rid2(zTarget);
1032 if( fpid<=0 ){
1033
+6 -1
--- src/builtin.c
+++ src/builtin.c
@@ -697,11 +697,16 @@
697697
CX("};\n"/*window.fossil.config.forum*/);
698698
#define JBOOL(COND) ((COND) ? "true" : "false")
699699
CX("window.fossil.user = {");
700700
CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest");
701701
CX("isAdmin: %s,", JBOOL(g.perm.Admin || g.perm.Setup));
702
- CX("mayAttachForum: %s,", JBOOL(g.perm.AttachForum));
702
+ CX("mayAttachForum: %d,", g.perm.AttachForum
703
+ ? 1 : (g.perm.WrTForum
704
+ ? -1 : 0))
705
+ /* 0 = no, 1 = 'B' permissions,
706
+ ** -1 = moderated attachments. Potential TODO is a setting
707
+ ** to enable this. */;
703708
CX("enableDebug: %s,", JBOOL(g.perm.Debug || g.perm.Admin));
704709
CX("isIndividual: %s", JBOOL(login_is_individual()));
705710
CX("};\n"/*fossil.user*/);
706711
{ /* Workaround for cases like:
707712
** https://fossil-scm.org/forum/forumpost/31cc00b361496cb8
708713
--- src/builtin.c
+++ src/builtin.c
@@ -697,11 +697,16 @@
697 CX("};\n"/*window.fossil.config.forum*/);
698 #define JBOOL(COND) ((COND) ? "true" : "false")
699 CX("window.fossil.user = {");
700 CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest");
701 CX("isAdmin: %s,", JBOOL(g.perm.Admin || g.perm.Setup));
702 CX("mayAttachForum: %s,", JBOOL(g.perm.AttachForum));
 
 
 
 
 
703 CX("enableDebug: %s,", JBOOL(g.perm.Debug || g.perm.Admin));
704 CX("isIndividual: %s", JBOOL(login_is_individual()));
705 CX("};\n"/*fossil.user*/);
706 { /* Workaround for cases like:
707 ** https://fossil-scm.org/forum/forumpost/31cc00b361496cb8
708
--- src/builtin.c
+++ src/builtin.c
@@ -697,11 +697,16 @@
697 CX("};\n"/*window.fossil.config.forum*/);
698 #define JBOOL(COND) ((COND) ? "true" : "false")
699 CX("window.fossil.user = {");
700 CX("name: %!j,", (g.zLogin&&*g.zLogin) ? g.zLogin : "guest");
701 CX("isAdmin: %s,", JBOOL(g.perm.Admin || g.perm.Setup));
702 CX("mayAttachForum: %d,", g.perm.AttachForum
703 ? 1 : (g.perm.WrTForum
704 ? -1 : 0))
705 /* 0 = no, 1 = 'B' permissions,
706 ** -1 = moderated attachments. Potential TODO is a setting
707 ** to enable this. */;
708 CX("enableDebug: %s,", JBOOL(g.perm.Debug || g.perm.Admin));
709 CX("isIndividual: %s", JBOOL(login_is_individual()));
710 CX("};\n"/*fossil.user*/);
711 { /* Workaround for cases like:
712 ** https://fossil-scm.org/forum/forumpost/31cc00b361496cb8
713
+9
--- src/db.c
+++ src/db.c
@@ -4927,10 +4927,19 @@
49274927
/*
49284928
** SETTING: http-port width=16 default=8080
49294929
** The default TCP/IP port number to use by the "server"
49304930
** and "ui" commands.
49314931
*/
4932
+/*
4933
+** SETTING: hide-by-user width=40 block-text
4934
+** The VALUE of this setting is a list of GLOB patterns. On the /timeline
4935
+** page, any check-in whose user login name matches one of these patterns
4936
+** is treated as if it carried the "hidden" tag, and is omitted unless the
4937
+** "unhide=on" query parameter is used. Example: bot-*,*-robot
4938
+** The parsing rules are complex; see
4939
+** https://fossil-scm.org/home/doc/trunk/www/globs.md#syntax
4940
+*/
49324941
/*
49334942
** SETTING: https-login boolean default=off
49344943
** If true, then the Fossil web server will redirect unencrypted
49354944
** login screen requests to HTTPS.
49364945
*/
49374946
--- src/db.c
+++ src/db.c
@@ -4927,10 +4927,19 @@
4927 /*
4928 ** SETTING: http-port width=16 default=8080
4929 ** The default TCP/IP port number to use by the "server"
4930 ** and "ui" commands.
4931 */
 
 
 
 
 
 
 
 
 
4932 /*
4933 ** SETTING: https-login boolean default=off
4934 ** If true, then the Fossil web server will redirect unencrypted
4935 ** login screen requests to HTTPS.
4936 */
4937
--- src/db.c
+++ src/db.c
@@ -4927,10 +4927,19 @@
4927 /*
4928 ** SETTING: http-port width=16 default=8080
4929 ** The default TCP/IP port number to use by the "server"
4930 ** and "ui" commands.
4931 */
4932 /*
4933 ** SETTING: hide-by-user width=40 block-text
4934 ** The VALUE of this setting is a list of GLOB patterns. On the /timeline
4935 ** page, any check-in whose user login name matches one of these patterns
4936 ** is treated as if it carried the "hidden" tag, and is omitted unless the
4937 ** "unhide=on" query parameter is used. Example: bot-*,*-robot
4938 ** The parsing rules are complex; see
4939 ** https://fossil-scm.org/home/doc/trunk/www/globs.md#syntax
4940 */
4941 /*
4942 ** SETTING: https-login boolean default=off
4943 ** If true, then the Fossil web server will redirect unencrypted
4944 ** login screen requests to HTTPS.
4945 */
4946
--- src/default.css
+++ src/default.css
@@ -2016,10 +2016,13 @@
20162016
/* .attach* = styles for file attachments */
20172017
section.attachlist {}
20182018
details.attachlist > summary {
20192019
cursor: pointer;
20202020
}
2021
+div.forumpost > details.attachlist {
2022
+ margin-bottom: 0.5em/*else too cramped with the buttons*/;
2023
+}
20212024
/* .Attacher is the top container element used by the JS Attacher
20222025
class in fossil.attach.js. */
20232026
.Attacher {
20242027
margin-bottom: 1em;
20252028
display: flex;
20262029
--- src/default.css
+++ src/default.css
@@ -2016,10 +2016,13 @@
2016 /* .attach* = styles for file attachments */
2017 section.attachlist {}
2018 details.attachlist > summary {
2019 cursor: pointer;
2020 }
 
 
 
2021 /* .Attacher is the top container element used by the JS Attacher
2022 class in fossil.attach.js. */
2023 .Attacher {
2024 margin-bottom: 1em;
2025 display: flex;
2026
--- src/default.css
+++ src/default.css
@@ -2016,10 +2016,13 @@
2016 /* .attach* = styles for file attachments */
2017 section.attachlist {}
2018 details.attachlist > summary {
2019 cursor: pointer;
2020 }
2021 div.forumpost > details.attachlist {
2022 margin-bottom: 0.5em/*else too cramped with the buttons*/;
2023 }
2024 /* .Attacher is the top container element used by the JS Attacher
2025 class in fossil.attach.js. */
2026 .Attacher {
2027 margin-bottom: 1em;
2028 display: flex;
2029
+25 -23
--- src/forum.c
+++ src/forum.c
@@ -2191,11 +2191,11 @@
21912191
** its list of attachments. We only emit this for No-JS environments,
21922192
** as in JS environments the interactive forum editor includes
21932193
** attachment support.
21942194
*/
21952195
static void forum_render_attachment_notice(void){
2196
- if( g.perm.AttachForum ){
2196
+ if( g.perm.AttachForum || g.perm.WrTForum ){
21972197
@ <noscript><div>You will be able to attach files to this post
21982198
@ after saving it.</div></noscript>
21992199
}
22002200
}
22012201
@@ -2238,12 +2238,12 @@
22382238
}
22392239
forum_render_debug_options();
22402240
login_insert_csrf_secret();
22412241
@ </form>
22422242
/* When JS is disabled the block above will work. When it's
2243
- enabled, the above will be removed and JS will render the editor
2244
- form in the next element. */
2243
+ ** enabled, the above will be removed and JS will render the editor
2244
+ ** form in the next element. */
22452245
@ <div hidden id='forumnew-placeholder'>
22462246
@ <input type='hidden' name='title' value='%h(zTitle)'>
22472247
login_insert_csrf_secret();
22482248
@ </div>
22492249
forum_render_attachment_notice();
@@ -3044,14 +3044,14 @@
30443044
** The caller must have started a transaction and must roll it back if
30453045
** this call returns <=0, noting that only the negative-value case is
30463046
** an error.
30473047
**
30483048
** This function does some work to try to ensure that duplicate
3049
-** entries are not save (this can happen as a side effect of the forum
3050
-** post editor added in 2026-06). If the given post will not have been
3051
-** materially edited by these changes, they are not applied and the
3052
-** rid of the existing entry is used.
3049
+** entries are not saved (this can happen as a side effect of the
3050
+** forum post editor added in 2026-06). If the given post will not
3051
+** have been materially edited by these changes, they are not applied
3052
+** and the rid of the existing entry is used.
30533053
**
30543054
** Maintenance reminders:
30553055
**
30563056
** - iInReplyTo==0 && iEdit==0: new thread
30573057
** - iInReplyTo==0 && iEdit>0 : edit top post or response
@@ -3243,15 +3243,15 @@
32433243
return rc;
32443244
}
32453245
/*
32463246
** WEBPAGE: forumajax_save hidden
32473247
**
3248
-** WIP
3248
+** Used by the forum JS pages to save a post.
32493249
**
32503250
** Response JSON:
32513251
**
3252
-** { uuid: hash, ...tbd }
3252
+** { uuid: hash, ...TO DOCUMENT }
32533253
*/
32543254
void forum_ajax_save_page(void){
32553255
const char *zFpid;
32563256
const char *zTitle;
32573257
const char *zIrt;
@@ -3267,15 +3267,17 @@
32673267
int nrid = 0; /* New artifact rid. */
32683268
int iPostFlags; /* forum_post_flags() (after perms check) */
32693269
int bRollback; /* True = roll back. */
32703270
int nAttach = 0; /* Number of attachments added */
32713271
int bStatusSet = 0; /* True if status tag set. */
3272
+ int bModPost = 0; /* Moderate post? */
3273
+ int bModAttach; /* Moderate attachment? */
32723274
32733275
if( !ajax_route_bootstrap(0, 1) ){
32743276
return;
3275
- }else if( !g.perm.WrForum
3276
- || (bHasAttachment && !g.perm.AttachForum) ){
3277
+ }else if( !g.perm.WrForum ||
3278
+ (bHasAttachment && !g.perm.WrTForum) ){
32773279
ajax_route_error_forbidden();
32783280
return;
32793281
}else if( !ajax_check_csrf(2) ){
32803282
ajax_route_error_csrf();
32813283
return;
@@ -3322,17 +3324,18 @@
33223324
rc = -ajax_route_error(404, "Cannot resolve in-reply-do ID.");
33233325
goto ajax_save_end;
33243326
}
33253327
}
33263328
3327
- if( 0 ){
3328
- rc = -ajax_route_error(400, "Save is TODO. "
3329
- "iPostFlags=%d debug=%d",
3330
- iPostFlags, g.perm.Debug);
3331
- goto ajax_save_end;
3329
+ bModPost = forum_need_moderation();
3330
+ if( bHasAttachment && !g.perm.AttachForum && g.perm.WrTForum ){
3331
+ /* A user with WrTForum but not AttachForum may attach but
3332
+ ** the attachments will be moderated. */
3333
+ bModAttach = 1;
3334
+ }else{
3335
+ bModAttach = bModPost;
33323336
}
3333
-
33343337
zTitle = firt ? 0 : P("title");
33353338
nrid = forum_post_ajax(zTitle, firt, fpid, 0, zMimetype,
33363339
zContent, iPostFlags);
33373340
if( nrid<0 ){
33383341
rc = nrid;
@@ -3345,24 +3348,23 @@
33453348
CX("{\"message\": \"Rolled back for dry-run.\","
33463349
"\"iPostFlags\":%d}\n", iPostFlags);
33473350
}
33483351
goto ajax_save_end;
33493352
}else{
3350
- const int bNeedsModeration = forum_need_moderation();
33513353
const int fpHead = forumpost_head_rid(nrid);
33523354
assert( nrid>0 );
33533355
assert( fpHead>0 );
33543356
zNewUuid = rid_to_uuid(nrid);
3355
- if( 0!=P("file1") ){
3357
+ if( bHasAttachment ){
33563358
/* Attachments */
3357
- if( !g.perm.Admin && !g.perm.AttachForum ){
3358
- rc = -ajax_route_error(403, "No permission no attach files.");
3359
+ if( !g.perm.Admin && !(g.perm.AttachForum ||g.perm.WrTForum) ){
3360
+ rc = -ajax_route_error(403, "No permission to attach files.");
33593361
goto ajax_save_end;
33603362
}else{
33613363
char *zRoot = (nrid==fpHead) ? 0 : rid_to_uuid(fpHead);
33623364
nAttach = attachments_ajax_from_POST(zRoot ? zRoot : zNewUuid,
3363
- bNeedsModeration);
3365
+ bModAttach);
33643366
fossil_free(zRoot);
33653367
if( nAttach<0 ){
33663368
rc = nAttach;
33673369
goto ajax_save_end;
33683370
}
@@ -3385,11 +3387,11 @@
33853387
fpHead, fpHead
33863388
);
33873389
}
33883390
}
33893391
}
3390
- if( 0==bNeedsModeration
3392
+ if( 0==bModPost
33913393
/* ^^^ Do not allow a status tag on a pending-moderation post
33923394
** because it will introduce a reference to an artifact which
33933395
** will become a phantom if it is rejected by a moderator. */
33943396
&& zStatus!=0 && zStatus[0]!=0
33953397
&& forum_may_set_status(nrid)
33963398
--- src/forum.c
+++ src/forum.c
@@ -2191,11 +2191,11 @@
2191 ** its list of attachments. We only emit this for No-JS environments,
2192 ** as in JS environments the interactive forum editor includes
2193 ** attachment support.
2194 */
2195 static void forum_render_attachment_notice(void){
2196 if( g.perm.AttachForum ){
2197 @ <noscript><div>You will be able to attach files to this post
2198 @ after saving it.</div></noscript>
2199 }
2200 }
2201
@@ -2238,12 +2238,12 @@
2238 }
2239 forum_render_debug_options();
2240 login_insert_csrf_secret();
2241 @ </form>
2242 /* When JS is disabled the block above will work. When it's
2243 enabled, the above will be removed and JS will render the editor
2244 form in the next element. */
2245 @ <div hidden id='forumnew-placeholder'>
2246 @ <input type='hidden' name='title' value='%h(zTitle)'>
2247 login_insert_csrf_secret();
2248 @ </div>
2249 forum_render_attachment_notice();
@@ -3044,14 +3044,14 @@
3044 ** The caller must have started a transaction and must roll it back if
3045 ** this call returns <=0, noting that only the negative-value case is
3046 ** an error.
3047 **
3048 ** This function does some work to try to ensure that duplicate
3049 ** entries are not save (this can happen as a side effect of the forum
3050 ** post editor added in 2026-06). If the given post will not have been
3051 ** materially edited by these changes, they are not applied and the
3052 ** rid of the existing entry is used.
3053 **
3054 ** Maintenance reminders:
3055 **
3056 ** - iInReplyTo==0 && iEdit==0: new thread
3057 ** - iInReplyTo==0 && iEdit>0 : edit top post or response
@@ -3243,15 +3243,15 @@
3243 return rc;
3244 }
3245 /*
3246 ** WEBPAGE: forumajax_save hidden
3247 **
3248 ** WIP
3249 **
3250 ** Response JSON:
3251 **
3252 ** { uuid: hash, ...tbd }
3253 */
3254 void forum_ajax_save_page(void){
3255 const char *zFpid;
3256 const char *zTitle;
3257 const char *zIrt;
@@ -3267,15 +3267,17 @@
3267 int nrid = 0; /* New artifact rid. */
3268 int iPostFlags; /* forum_post_flags() (after perms check) */
3269 int bRollback; /* True = roll back. */
3270 int nAttach = 0; /* Number of attachments added */
3271 int bStatusSet = 0; /* True if status tag set. */
 
 
3272
3273 if( !ajax_route_bootstrap(0, 1) ){
3274 return;
3275 }else if( !g.perm.WrForum
3276 || (bHasAttachment && !g.perm.AttachForum) ){
3277 ajax_route_error_forbidden();
3278 return;
3279 }else if( !ajax_check_csrf(2) ){
3280 ajax_route_error_csrf();
3281 return;
@@ -3322,17 +3324,18 @@
3322 rc = -ajax_route_error(404, "Cannot resolve in-reply-do ID.");
3323 goto ajax_save_end;
3324 }
3325 }
3326
3327 if( 0 ){
3328 rc = -ajax_route_error(400, "Save is TODO. "
3329 "iPostFlags=%d debug=%d",
3330 iPostFlags, g.perm.Debug);
3331 goto ajax_save_end;
 
 
3332 }
3333
3334 zTitle = firt ? 0 : P("title");
3335 nrid = forum_post_ajax(zTitle, firt, fpid, 0, zMimetype,
3336 zContent, iPostFlags);
3337 if( nrid<0 ){
3338 rc = nrid;
@@ -3345,24 +3348,23 @@
3345 CX("{\"message\": \"Rolled back for dry-run.\","
3346 "\"iPostFlags\":%d}\n", iPostFlags);
3347 }
3348 goto ajax_save_end;
3349 }else{
3350 const int bNeedsModeration = forum_need_moderation();
3351 const int fpHead = forumpost_head_rid(nrid);
3352 assert( nrid>0 );
3353 assert( fpHead>0 );
3354 zNewUuid = rid_to_uuid(nrid);
3355 if( 0!=P("file1") ){
3356 /* Attachments */
3357 if( !g.perm.Admin && !g.perm.AttachForum ){
3358 rc = -ajax_route_error(403, "No permission no attach files.");
3359 goto ajax_save_end;
3360 }else{
3361 char *zRoot = (nrid==fpHead) ? 0 : rid_to_uuid(fpHead);
3362 nAttach = attachments_ajax_from_POST(zRoot ? zRoot : zNewUuid,
3363 bNeedsModeration);
3364 fossil_free(zRoot);
3365 if( nAttach<0 ){
3366 rc = nAttach;
3367 goto ajax_save_end;
3368 }
@@ -3385,11 +3387,11 @@
3385 fpHead, fpHead
3386 );
3387 }
3388 }
3389 }
3390 if( 0==bNeedsModeration
3391 /* ^^^ Do not allow a status tag on a pending-moderation post
3392 ** because it will introduce a reference to an artifact which
3393 ** will become a phantom if it is rejected by a moderator. */
3394 && zStatus!=0 && zStatus[0]!=0
3395 && forum_may_set_status(nrid)
3396
--- src/forum.c
+++ src/forum.c
@@ -2191,11 +2191,11 @@
2191 ** its list of attachments. We only emit this for No-JS environments,
2192 ** as in JS environments the interactive forum editor includes
2193 ** attachment support.
2194 */
2195 static void forum_render_attachment_notice(void){
2196 if( g.perm.AttachForum || g.perm.WrTForum ){
2197 @ <noscript><div>You will be able to attach files to this post
2198 @ after saving it.</div></noscript>
2199 }
2200 }
2201
@@ -2238,12 +2238,12 @@
2238 }
2239 forum_render_debug_options();
2240 login_insert_csrf_secret();
2241 @ </form>
2242 /* When JS is disabled the block above will work. When it's
2243 ** enabled, the above will be removed and JS will render the editor
2244 ** form in the next element. */
2245 @ <div hidden id='forumnew-placeholder'>
2246 @ <input type='hidden' name='title' value='%h(zTitle)'>
2247 login_insert_csrf_secret();
2248 @ </div>
2249 forum_render_attachment_notice();
@@ -3044,14 +3044,14 @@
3044 ** The caller must have started a transaction and must roll it back if
3045 ** this call returns <=0, noting that only the negative-value case is
3046 ** an error.
3047 **
3048 ** This function does some work to try to ensure that duplicate
3049 ** entries are not saved (this can happen as a side effect of the
3050 ** forum post editor added in 2026-06). If the given post will not
3051 ** have been materially edited by these changes, they are not applied
3052 ** and the rid of the existing entry is used.
3053 **
3054 ** Maintenance reminders:
3055 **
3056 ** - iInReplyTo==0 && iEdit==0: new thread
3057 ** - iInReplyTo==0 && iEdit>0 : edit top post or response
@@ -3243,15 +3243,15 @@
3243 return rc;
3244 }
3245 /*
3246 ** WEBPAGE: forumajax_save hidden
3247 **
3248 ** Used by the forum JS pages to save a post.
3249 **
3250 ** Response JSON:
3251 **
3252 ** { uuid: hash, ...TO DOCUMENT }
3253 */
3254 void forum_ajax_save_page(void){
3255 const char *zFpid;
3256 const char *zTitle;
3257 const char *zIrt;
@@ -3267,15 +3267,17 @@
3267 int nrid = 0; /* New artifact rid. */
3268 int iPostFlags; /* forum_post_flags() (after perms check) */
3269 int bRollback; /* True = roll back. */
3270 int nAttach = 0; /* Number of attachments added */
3271 int bStatusSet = 0; /* True if status tag set. */
3272 int bModPost = 0; /* Moderate post? */
3273 int bModAttach; /* Moderate attachment? */
3274
3275 if( !ajax_route_bootstrap(0, 1) ){
3276 return;
3277 }else if( !g.perm.WrForum ||
3278 (bHasAttachment && !g.perm.WrTForum) ){
3279 ajax_route_error_forbidden();
3280 return;
3281 }else if( !ajax_check_csrf(2) ){
3282 ajax_route_error_csrf();
3283 return;
@@ -3322,17 +3324,18 @@
3324 rc = -ajax_route_error(404, "Cannot resolve in-reply-do ID.");
3325 goto ajax_save_end;
3326 }
3327 }
3328
3329 bModPost = forum_need_moderation();
3330 if( bHasAttachment && !g.perm.AttachForum && g.perm.WrTForum ){
3331 /* A user with WrTForum but not AttachForum may attach but
3332 ** the attachments will be moderated. */
3333 bModAttach = 1;
3334 }else{
3335 bModAttach = bModPost;
3336 }
 
3337 zTitle = firt ? 0 : P("title");
3338 nrid = forum_post_ajax(zTitle, firt, fpid, 0, zMimetype,
3339 zContent, iPostFlags);
3340 if( nrid<0 ){
3341 rc = nrid;
@@ -3345,24 +3348,23 @@
3348 CX("{\"message\": \"Rolled back for dry-run.\","
3349 "\"iPostFlags\":%d}\n", iPostFlags);
3350 }
3351 goto ajax_save_end;
3352 }else{
 
3353 const int fpHead = forumpost_head_rid(nrid);
3354 assert( nrid>0 );
3355 assert( fpHead>0 );
3356 zNewUuid = rid_to_uuid(nrid);
3357 if( bHasAttachment ){
3358 /* Attachments */
3359 if( !g.perm.Admin && !(g.perm.AttachForum ||g.perm.WrTForum) ){
3360 rc = -ajax_route_error(403, "No permission to attach files.");
3361 goto ajax_save_end;
3362 }else{
3363 char *zRoot = (nrid==fpHead) ? 0 : rid_to_uuid(fpHead);
3364 nAttach = attachments_ajax_from_POST(zRoot ? zRoot : zNewUuid,
3365 bModAttach);
3366 fossil_free(zRoot);
3367 if( nAttach<0 ){
3368 rc = nAttach;
3369 goto ajax_save_end;
3370 }
@@ -3385,11 +3387,11 @@
3387 fpHead, fpHead
3388 );
3389 }
3390 }
3391 }
3392 if( 0==bModPost
3393 /* ^^^ Do not allow a status tag on a pending-moderation post
3394 ** because it will introduce a reference to an artifact which
3395 ** will become a phantom if it is rejected by a moderator. */
3396 && zStatus!=0 && zStatus[0]!=0
3397 && forum_may_set_status(nrid)
3398
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -138,11 +138,10 @@
138138
}
139139
}else{
140140
this.#updateControls();
141141
}
142142
}
143
-
144143
145144
get widget(){
146145
return this.#e.body;
147146
}
148147
149148
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -138,11 +138,10 @@
138 }
139 }else{
140 this.#updateControls();
141 }
142 }
143
144
145 get widget(){
146 return this.#e.body;
147 }
148
149
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -138,11 +138,10 @@
138 }
139 }else{
140 this.#updateControls();
141 }
142 }
 
143
144 get widget(){
145 return this.#e.body;
146 }
147
148
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -337,11 +337,11 @@
337337
}
338338
});
339339
}
340340
}/*e.status*/
341341
342
- if( F.user.mayAttachForum ){
342
+ if( 0!==F.user.mayAttachForum ){
343343
//e.buttons.append( e.button.addAttach = this.#att.takeAddButton() );
344344
e.tabAttach = D.div();
345345
e.tabAttach.setAttribute('id', idPrefix+'-attach');
346346
e.tabAttach.dataset.tabLabel = 'Attachments';
347347
this.#tabs.addTab(e.tabAttach);
@@ -598,13 +598,23 @@
598598
D.attr(
599599
D.a(F.repoUrl('attachadd?target='+this.#opt.edit.uuid), '/attachadd'),
600600
'target',
601601
'_new'
602602
),
603
- ".",
603
+ "."
604604
);
605605
this.#e.tabAttach.append(eNote);
606
+ }
607
+ if( F.user.mayAttachForum < 0 ){
608
+ /* Users with permission '4' (forum unmoderated) but not 'B'
609
+ ** (forum-attach) may attach files but they will undergo
610
+ ** moderation. */
611
+ const w = D.div();
612
+ w.append("Your attachments will be held "+
613
+ "for moderation.");
614
+ w.classList.add('warning');
615
+ this.#e.tabAttach.append(w);
606616
}
607617
this.#e.tabAttach.append(this.#att.widget);
608618
}
609619
610620
#newFormData(addThisContent){
611621
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -337,11 +337,11 @@
337 }
338 });
339 }
340 }/*e.status*/
341
342 if( F.user.mayAttachForum ){
343 //e.buttons.append( e.button.addAttach = this.#att.takeAddButton() );
344 e.tabAttach = D.div();
345 e.tabAttach.setAttribute('id', idPrefix+'-attach');
346 e.tabAttach.dataset.tabLabel = 'Attachments';
347 this.#tabs.addTab(e.tabAttach);
@@ -598,13 +598,23 @@
598 D.attr(
599 D.a(F.repoUrl('attachadd?target='+this.#opt.edit.uuid), '/attachadd'),
600 'target',
601 '_new'
602 ),
603 ".",
604 );
605 this.#e.tabAttach.append(eNote);
 
 
 
 
 
 
 
 
 
 
606 }
607 this.#e.tabAttach.append(this.#att.widget);
608 }
609
610 #newFormData(addThisContent){
611
--- src/fossil.page.forumpost.js
+++ src/fossil.page.forumpost.js
@@ -337,11 +337,11 @@
337 }
338 });
339 }
340 }/*e.status*/
341
342 if( 0!==F.user.mayAttachForum ){
343 //e.buttons.append( e.button.addAttach = this.#att.takeAddButton() );
344 e.tabAttach = D.div();
345 e.tabAttach.setAttribute('id', idPrefix+'-attach');
346 e.tabAttach.dataset.tabLabel = 'Attachments';
347 this.#tabs.addTab(e.tabAttach);
@@ -598,13 +598,23 @@
598 D.attr(
599 D.a(F.repoUrl('attachadd?target='+this.#opt.edit.uuid), '/attachadd'),
600 'target',
601 '_new'
602 ),
603 "."
604 );
605 this.#e.tabAttach.append(eNote);
606 }
607 if( F.user.mayAttachForum < 0 ){
608 /* Users with permission '4' (forum unmoderated) but not 'B'
609 ** (forum-attach) may attach files but they will undergo
610 ** moderation. */
611 const w = D.div();
612 w.append("Your attachments will be held "+
613 "for moderation.");
614 w.classList.add('warning');
615 this.#e.tabAttach.append(w);
616 }
617 this.#e.tabAttach.append(this.#att.widget);
618 }
619
620 #newFormData(addThisContent){
621
+1 -1
--- src/style.c
+++ src/style.c
@@ -505,11 +505,11 @@
505505
** the ID of the <span> that surrounds the display text and the ID
506506
** of the <button> becomes "copy-%s" where %s is filled in by zTargetId.
507507
** If zTargetId is NULL (the usual case) then IDs are selected automatically.
508508
**
509509
** The bOutputCGI parameter is usually true, meaning that the output
510
-** is appended to the CGI result under construction. However, if
510
+** is appended to the CGI result under construction. However, if
511511
** bOutputCGI is false, the generated HTML is written into memory
512512
** obtained from fossil_malloc() and returned.
513513
**
514514
** If the bAfter argument is non-zero, the copy button is displayed
515515
** after the text. Normally the copy button comes before the text.
516516
--- src/style.c
+++ src/style.c
@@ -505,11 +505,11 @@
505 ** the ID of the <span> that surrounds the display text and the ID
506 ** of the <button> becomes "copy-%s" where %s is filled in by zTargetId.
507 ** If zTargetId is NULL (the usual case) then IDs are selected automatically.
508 **
509 ** The bOutputCGI parameter is usually true, meaning that the output
510 ** is appended to the CGI result under construction. However, if
511 ** bOutputCGI is false, the generated HTML is written into memory
512 ** obtained from fossil_malloc() and returned.
513 **
514 ** If the bAfter argument is non-zero, the copy button is displayed
515 ** after the text. Normally the copy button comes before the text.
516
--- src/style.c
+++ src/style.c
@@ -505,11 +505,11 @@
505 ** the ID of the <span> that surrounds the display text and the ID
506 ** of the <button> becomes "copy-%s" where %s is filled in by zTargetId.
507 ** If zTargetId is NULL (the usual case) then IDs are selected automatically.
508 **
509 ** The bOutputCGI parameter is usually true, meaning that the output
510 ** is appended to the CGI result under construction. However, if
511 ** bOutputCGI is false, the generated HTML is written into memory
512 ** obtained from fossil_malloc() and returned.
513 **
514 ** If the bAfter argument is non-zero, the copy button is displayed
515 ** after the text. Normally the copy button comes before the text.
516
--- src/timeline.c
+++ src/timeline.c
@@ -1237,10 +1237,46 @@
12371237
@ FROM event CROSS JOIN blob
12381238
@ WHERE blob.rid=event.objid
12391239
;
12401240
return zBase;
12411241
}
1242
+
1243
+/*
1244
+** SQL function: hidden_by_user(X)
1245
+**
1246
+** Return true if X matches one of the GLOB patterns in the "hide-by-user"
1247
+** setting.
1248
+*/
1249
+static void timeline_hidden_by_user_func(
1250
+ sqlite3_context *context,
1251
+ int argc,
1252
+ sqlite3_value **argv
1253
+){
1254
+ static Glob *pGlob = 0;
1255
+ static int isInit = 0;
1256
+ const char *zUser;
1257
+ if( !isInit ){
1258
+ const char *zPat = db_get("hide-by-user", 0);
1259
+ pGlob = zPat ? glob_create(zPat) : 0;
1260
+ isInit = 1;
1261
+ }
1262
+ zUser = (const char*)sqlite3_value_text(argv[0]);
1263
+ sqlite3_result_int(context,
1264
+ pGlob!=0 && zUser!=0 && glob_match(pGlob, zUser)!=0);
1265
+}
1266
+
1267
+/*
1268
+** Register hidden_by_user() and return true if the "hide-by-user"
1269
+** setting is non-empty.
1270
+*/
1271
+static int timeline_enable_hide_by_user(void){
1272
+ const char *zPat = db_get("hide-by-user", 0);
1273
+ if( zPat==0 || zPat[0]==0 ) return 0;
1274
+ sqlite3_create_function(g.db, "hidden_by_user", 1, SQLITE_UTF8, 0,
1275
+ timeline_hidden_by_user_func, 0, 0);
1276
+ return 1;
1277
+}
12421278
12431279
/*
12441280
** zDate is a localtime date. Insert records into the
12451281
** "timeline" table to cause <hr> to be inserted on zDate.
12461282
*/
@@ -2261,10 +2297,15 @@
22612297
blob_append_sql(&sql,
22622298
" AND NOT EXISTS(SELECT 1 FROM tagxref"
22632299
" WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n",
22642300
TAG_HIDDEN
22652301
);
2302
+ if( timeline_enable_hide_by_user() ){
2303
+ blob_append_sql(&sql,
2304
+ " AND NOT (event.type='ci' AND hidden_by_user(coalesce(euser,user)))\n"
2305
+ );
2306
+ }
22662307
}
22672308
if( from_rid && !to_rid && (P("ft")!=0 || P("bt")!=0) ){
22682309
const char *zTo = P("ft");
22692310
if( zTo ){
22702311
from_to_mode = 1;
@@ -3049,10 +3090,20 @@
30493090
" FROM related_nodes, tagxref\n"
30503091
" WHERE tagid=%d AND tagtype>0\n"
30513092
" AND tagxref.rid=related_nodes.rid)",
30523093
TAG_HIDDEN
30533094
);
3095
+ if( timeline_enable_hide_by_user() ){
3096
+ db_multi_exec(
3097
+ "DELETE FROM related_nodes\n"
3098
+ " WHERE rid IN (SELECT related_nodes.rid\n"
3099
+ " FROM related_nodes, event\n"
3100
+ " WHERE event.objid=related_nodes.rid\n"
3101
+ " AND event.type='ci'\n"
3102
+ " AND hidden_by_user(coalesce(euser,user)))"
3103
+ );
3104
+ }
30543105
}
30553106
}
30563107
}
30573108
if( (zType[0]=='w' && !g.perm.RdWiki)
30583109
|| (zType[0]=='t' && !g.perm.RdTkt)
30593110
--- src/timeline.c
+++ src/timeline.c
@@ -1237,10 +1237,46 @@
1237 @ FROM event CROSS JOIN blob
1238 @ WHERE blob.rid=event.objid
1239 ;
1240 return zBase;
1241 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1242
1243 /*
1244 ** zDate is a localtime date. Insert records into the
1245 ** "timeline" table to cause <hr> to be inserted on zDate.
1246 */
@@ -2261,10 +2297,15 @@
2261 blob_append_sql(&sql,
2262 " AND NOT EXISTS(SELECT 1 FROM tagxref"
2263 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n",
2264 TAG_HIDDEN
2265 );
 
 
 
 
 
2266 }
2267 if( from_rid && !to_rid && (P("ft")!=0 || P("bt")!=0) ){
2268 const char *zTo = P("ft");
2269 if( zTo ){
2270 from_to_mode = 1;
@@ -3049,10 +3090,20 @@
3049 " FROM related_nodes, tagxref\n"
3050 " WHERE tagid=%d AND tagtype>0\n"
3051 " AND tagxref.rid=related_nodes.rid)",
3052 TAG_HIDDEN
3053 );
 
 
 
 
 
 
 
 
 
 
3054 }
3055 }
3056 }
3057 if( (zType[0]=='w' && !g.perm.RdWiki)
3058 || (zType[0]=='t' && !g.perm.RdTkt)
3059
--- src/timeline.c
+++ src/timeline.c
@@ -1237,10 +1237,46 @@
1237 @ FROM event CROSS JOIN blob
1238 @ WHERE blob.rid=event.objid
1239 ;
1240 return zBase;
1241 }
1242
1243 /*
1244 ** SQL function: hidden_by_user(X)
1245 **
1246 ** Return true if X matches one of the GLOB patterns in the "hide-by-user"
1247 ** setting.
1248 */
1249 static void timeline_hidden_by_user_func(
1250 sqlite3_context *context,
1251 int argc,
1252 sqlite3_value **argv
1253 ){
1254 static Glob *pGlob = 0;
1255 static int isInit = 0;
1256 const char *zUser;
1257 if( !isInit ){
1258 const char *zPat = db_get("hide-by-user", 0);
1259 pGlob = zPat ? glob_create(zPat) : 0;
1260 isInit = 1;
1261 }
1262 zUser = (const char*)sqlite3_value_text(argv[0]);
1263 sqlite3_result_int(context,
1264 pGlob!=0 && zUser!=0 && glob_match(pGlob, zUser)!=0);
1265 }
1266
1267 /*
1268 ** Register hidden_by_user() and return true if the "hide-by-user"
1269 ** setting is non-empty.
1270 */
1271 static int timeline_enable_hide_by_user(void){
1272 const char *zPat = db_get("hide-by-user", 0);
1273 if( zPat==0 || zPat[0]==0 ) return 0;
1274 sqlite3_create_function(g.db, "hidden_by_user", 1, SQLITE_UTF8, 0,
1275 timeline_hidden_by_user_func, 0, 0);
1276 return 1;
1277 }
1278
1279 /*
1280 ** zDate is a localtime date. Insert records into the
1281 ** "timeline" table to cause <hr> to be inserted on zDate.
1282 */
@@ -2261,10 +2297,15 @@
2297 blob_append_sql(&sql,
2298 " AND NOT EXISTS(SELECT 1 FROM tagxref"
2299 " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n",
2300 TAG_HIDDEN
2301 );
2302 if( timeline_enable_hide_by_user() ){
2303 blob_append_sql(&sql,
2304 " AND NOT (event.type='ci' AND hidden_by_user(coalesce(euser,user)))\n"
2305 );
2306 }
2307 }
2308 if( from_rid && !to_rid && (P("ft")!=0 || P("bt")!=0) ){
2309 const char *zTo = P("ft");
2310 if( zTo ){
2311 from_to_mode = 1;
@@ -3049,10 +3090,20 @@
3090 " FROM related_nodes, tagxref\n"
3091 " WHERE tagid=%d AND tagtype>0\n"
3092 " AND tagxref.rid=related_nodes.rid)",
3093 TAG_HIDDEN
3094 );
3095 if( timeline_enable_hide_by_user() ){
3096 db_multi_exec(
3097 "DELETE FROM related_nodes\n"
3098 " WHERE rid IN (SELECT related_nodes.rid\n"
3099 " FROM related_nodes, event\n"
3100 " WHERE event.objid=related_nodes.rid\n"
3101 " AND event.type='ci'\n"
3102 " AND hidden_by_user(coalesce(euser,user)))"
3103 );
3104 }
3105 }
3106 }
3107 }
3108 if( (zType[0]=='w' && !g.perm.RdWiki)
3109 || (zType[0]=='t' && !g.perm.RdTkt)
3110

Keyboard Shortcuts

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