Fossil SCM

New (experimental) setting "hide-by-user" is a comma-separated list of GLOB patterns. Check-ins by any user on that list are automatically hidden in timeline displays unless overridden by the "unhide" query parameter.

drh 2026-11-09 09:59 UTC trunk
Commit d1e85bd2d9bb65ef0e016092810c3be7f4cc7947add0d4b470a271840bcabc8d
2 files changed +9 +51
+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/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