Fossil SCM

Add the thread=HASH query parameter to /timeline. Link to this from the /forumpost page.

drh 2026-10-24 19:27 UTC forum-tracking-enhancements
Commit f1bf008a04e03ba1612c48a5accdd57fe6c5647d5e0e134359865b7513cea2d4
2 files changed +1 +32
--- src/forum.c
+++ src/forum.c
@@ -1832,10 +1832,11 @@
18321832
style_submenu_element("Hierarchical", "%R/%s/%s?t=h%s%s", g.zPath, zName,
18331833
bUnf ? "&unf" : "", bHist ? "&hist" : "");
18341834
}
18351835
style_submenu_checkbox("unf", "Unformatted", 0, 0);
18361836
style_submenu_checkbox("hist", "History", 0, 0);
1837
+ style_submenu_element("Timeline", "%R/timeline?thread=%t", zName);
18371838
if( g.perm.Admin ){
18381839
style_submenu_element("Artifacts", "%R/forumthreadhashlist/%t", zName);
18391840
}
18401841
18411842
/* Display the thread. */
18421843
--- src/forum.c
+++ src/forum.c
@@ -1832,10 +1832,11 @@
1832 style_submenu_element("Hierarchical", "%R/%s/%s?t=h%s%s", g.zPath, zName,
1833 bUnf ? "&unf" : "", bHist ? "&hist" : "");
1834 }
1835 style_submenu_checkbox("unf", "Unformatted", 0, 0);
1836 style_submenu_checkbox("hist", "History", 0, 0);
 
1837 if( g.perm.Admin ){
1838 style_submenu_element("Artifacts", "%R/forumthreadhashlist/%t", zName);
1839 }
1840
1841 /* Display the thread. */
1842
--- src/forum.c
+++ src/forum.c
@@ -1832,10 +1832,11 @@
1832 style_submenu_element("Hierarchical", "%R/%s/%s?t=h%s%s", g.zPath, zName,
1833 bUnf ? "&unf" : "", bHist ? "&hist" : "");
1834 }
1835 style_submenu_checkbox("unf", "Unformatted", 0, 0);
1836 style_submenu_checkbox("hist", "History", 0, 0);
1837 style_submenu_element("Timeline", "%R/timeline?thread=%t", zName);
1838 if( g.perm.Admin ){
1839 style_submenu_element("Artifacts", "%R/forumthreadhashlist/%t", zName);
1840 }
1841
1842 /* Display the thread. */
1843
--- src/timeline.c
+++ src/timeline.c
@@ -1758,10 +1758,14 @@
17581758
** nowiki Do not show wiki associated with branch or tag
17591759
** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob",
17601760
** "like", or "regexp".
17611761
** u=USER Only show items associated with USER
17621762
** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', 'h', or 'all'.
1763
+** thread=POST Show the complete history of the forum thread that
1764
+** contains POST, including all edits, replies, and
1765
+** tags. POST is a hash prefix or timestamp for any
1766
+** post, reply, or edit within the thread.
17631767
** status=NAME With y=f or y=h, show only forum posts or threads
17641768
** whose thread has status NAME. See the
17651769
** forum-statuses setting.
17661770
** ss=VIEWSTYLE c: "Compact", v: "Verbose", m: "Modern", j: "Columnar",
17671771
** x: "Classic".
@@ -1856,10 +1860,11 @@
18561860
const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
18571861
const char *zYear = P("year"); /* Events for the year YYYY */
18581862
const char *zNDays = P("days"); /* Show events over the previous N days */
18591863
int nDays = 0; /* Numeric value for zNDays */
18601864
const char *zChng = P("chng"); /* List of GLOBs for files that changed */
1865
+ const char *zThread = P("thread"); /* Show the forum thread holding this */
18611866
int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
18621867
int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
18631868
int forkOnly = PB("forks"); /* Show only forks and their children */
18641869
int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */
18651870
const char *zBisect = P("bid"); /* Bisect description */
@@ -2257,10 +2262,37 @@
22572262
to_rid = from_rid;
22582263
blob_appendf(&desc, "There is no path from %h %s to %h.<br>Instead: ",
22592264
P("from"), from_to_mode==1 ? "forward" : "back", zTo);
22602265
}
22612266
}
2267
+ if( zThread && g.perm.RdForum ){
2268
+ /* If thread= is present, show every post, edit, reply, and tag
2269
+ ** associated with the forum thread that contains the post identified
2270
+ ** by thread=. Other parameters except vfx= are ignored. */
2271
+ int fpid = symbolic_name_to_rid(zThread, "f");
2272
+ int froot = 0;
2273
+ if( fpid>0 ){
2274
+ froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid);
2275
+ }
2276
+ if( froot==0 ){
2277
+ blob_appendf(&desc, "No such forum post: \"%h\"", zThread);
2278
+ }else{
2279
+ char *zUuid;
2280
+ int n;
2281
+ forum_thread_artifacts("fthread", froot, 1, 0);
2282
+ blob_append_sql(&sql, " AND event.objid IN (SELECT rid FROM fthread)");
2283
+ db_multi_exec("%s", blob_sql_text(&sql));
2284
+ if( useDividers && !selectedRid ) selectedRid = fpid;
2285
+ n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div'");
2286
+ zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", froot);
2287
+ blob_appendf(&desc, "%d event%s in the history of forum thread %z%S</a>",
2288
+ n, n==1 ? "" : "s",
2289
+ href("%R/forumthread/%!S", zUuid), zUuid);
2290
+ fossil_free(zUuid);
2291
+ }
2292
+ style_submenu_checkbox("vfx", "Content", 0, 0);
2293
+ }else
22622294
if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){
22632295
/* If from= and to= are present, display all nodes on a path connecting
22642296
** the two */
22652297
PathNode *p = 0;
22662298
const char *zFrom = 0;
22672299
--- src/timeline.c
+++ src/timeline.c
@@ -1758,10 +1758,14 @@
1758 ** nowiki Do not show wiki associated with branch or tag
1759 ** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob",
1760 ** "like", or "regexp".
1761 ** u=USER Only show items associated with USER
1762 ** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', 'h', or 'all'.
 
 
 
 
1763 ** status=NAME With y=f or y=h, show only forum posts or threads
1764 ** whose thread has status NAME. See the
1765 ** forum-statuses setting.
1766 ** ss=VIEWSTYLE c: "Compact", v: "Verbose", m: "Modern", j: "Columnar",
1767 ** x: "Classic".
@@ -1856,10 +1860,11 @@
1856 const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
1857 const char *zYear = P("year"); /* Events for the year YYYY */
1858 const char *zNDays = P("days"); /* Show events over the previous N days */
1859 int nDays = 0; /* Numeric value for zNDays */
1860 const char *zChng = P("chng"); /* List of GLOBs for files that changed */
 
1861 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1862 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
1863 int forkOnly = PB("forks"); /* Show only forks and their children */
1864 int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */
1865 const char *zBisect = P("bid"); /* Bisect description */
@@ -2257,10 +2262,37 @@
2257 to_rid = from_rid;
2258 blob_appendf(&desc, "There is no path from %h %s to %h.<br>Instead: ",
2259 P("from"), from_to_mode==1 ? "forward" : "back", zTo);
2260 }
2261 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2262 if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){
2263 /* If from= and to= are present, display all nodes on a path connecting
2264 ** the two */
2265 PathNode *p = 0;
2266 const char *zFrom = 0;
2267
--- src/timeline.c
+++ src/timeline.c
@@ -1758,10 +1758,14 @@
1758 ** nowiki Do not show wiki associated with branch or tag
1759 ** ms=MATCHSTYLE Set tag name match algorithm. One of "exact", "glob",
1760 ** "like", or "regexp".
1761 ** u=USER Only show items associated with USER
1762 ** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', 'h', or 'all'.
1763 ** thread=POST Show the complete history of the forum thread that
1764 ** contains POST, including all edits, replies, and
1765 ** tags. POST is a hash prefix or timestamp for any
1766 ** post, reply, or edit within the thread.
1767 ** status=NAME With y=f or y=h, show only forum posts or threads
1768 ** whose thread has status NAME. See the
1769 ** forum-statuses setting.
1770 ** ss=VIEWSTYLE c: "Compact", v: "Verbose", m: "Modern", j: "Columnar",
1771 ** x: "Classic".
@@ -1856,10 +1860,11 @@
1860 const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
1861 const char *zYear = P("year"); /* Events for the year YYYY */
1862 const char *zNDays = P("days"); /* Show events over the previous N days */
1863 int nDays = 0; /* Numeric value for zNDays */
1864 const char *zChng = P("chng"); /* List of GLOBs for files that changed */
1865 const char *zThread = P("thread"); /* Show the forum thread holding this */
1866 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1867 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
1868 int forkOnly = PB("forks"); /* Show only forks and their children */
1869 int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */
1870 const char *zBisect = P("bid"); /* Bisect description */
@@ -2257,10 +2262,37 @@
2262 to_rid = from_rid;
2263 blob_appendf(&desc, "There is no path from %h %s to %h.<br>Instead: ",
2264 P("from"), from_to_mode==1 ? "forward" : "back", zTo);
2265 }
2266 }
2267 if( zThread && g.perm.RdForum ){
2268 /* If thread= is present, show every post, edit, reply, and tag
2269 ** associated with the forum thread that contains the post identified
2270 ** by thread=. Other parameters except vfx= are ignored. */
2271 int fpid = symbolic_name_to_rid(zThread, "f");
2272 int froot = 0;
2273 if( fpid>0 ){
2274 froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid);
2275 }
2276 if( froot==0 ){
2277 blob_appendf(&desc, "No such forum post: \"%h\"", zThread);
2278 }else{
2279 char *zUuid;
2280 int n;
2281 forum_thread_artifacts("fthread", froot, 1, 0);
2282 blob_append_sql(&sql, " AND event.objid IN (SELECT rid FROM fthread)");
2283 db_multi_exec("%s", blob_sql_text(&sql));
2284 if( useDividers && !selectedRid ) selectedRid = fpid;
2285 n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div'");
2286 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", froot);
2287 blob_appendf(&desc, "%d event%s in the history of forum thread %z%S</a>",
2288 n, n==1 ? "" : "s",
2289 href("%R/forumthread/%!S", zUuid), zUuid);
2290 fossil_free(zUuid);
2291 }
2292 style_submenu_checkbox("vfx", "Content", 0, 0);
2293 }else
2294 if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){
2295 /* If from= and to= are present, display all nodes on a path connecting
2296 ** the two */
2297 PathNode *p = 0;
2298 const char *zFrom = 0;
2299

Keyboard Shortcuts

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