Fossil SCM

For email alerts on forum posts, if the forum post is a reply to a prior post that has been edited two or more times, ensure that the In-Reply-To header on the email message refers to the very first edition of the in-reply-to post. Prior check-in [137cba6f1b81170d] attempt to do the same thing, but only worked for cases where the post was edited just once.

drh 2020-04-22 15:57 trunk
Commit fb4545ef937e06eeda979a8e9aead9c123f7a33dbd0254b550286be462cf3c83
1 file changed +18 -10
+18 -10
--- src/alerts.c
+++ src/alerts.c
@@ -2210,20 +2210,28 @@
22102210
** is a normal email alert. Construct full-text forum post alerts
22112211
** using a format that enables them to be sent as separate emails.
22122212
*/
22132213
db_prepare(&q,
22142214
"SELECT"
2215
- " forumpost.fpid," /* 0 */
2216
- " (SELECT uuid FROM blob WHERE rid=forumpost.fpid)," /* 1 */
2217
- " datetime(event.mtime)," /* 2 */
2218
- " substr(comment,instr(comment,':')+2)," /* 3 */
2219
- " (SELECT uuid FROM blob, forumpost AS irt"
2220
- " WHERE irt.fpid=forumpost.firt"
2221
- " AND blob.rid=coalesce(irt.fprev,irt.fpid))," /* 4 */
2222
- " wantalert.needMod," /* 5 */
2223
- " coalesce(display_name(info),euser,user)," /* 6 */
2224
- " forumpost.fprev IS NULL" /* 7 */
2215
+ " forumpost.fpid," /* 0: fpid */
2216
+ " (SELECT uuid FROM blob WHERE rid=forumpost.fpid)," /* 1: hash */
2217
+ " datetime(event.mtime)," /* 2: date/time */
2218
+ " substr(comment,instr(comment,':')+2)," /* 3: comment */
2219
+ " (WITH thread(fpid,fprev) AS ("
2220
+ " SELECT fpid,fprev FROM forumpost AS tx"
2221
+ " WHERE tx.froot=forumpost.froot),"
2222
+ " basepid(fpid,bpid) AS ("
2223
+ " SELECT fpid, fpid FROM thread WHERE fprev IS NULL"
2224
+ " UNION ALL"
2225
+ " SELECT thread.fpid, basepid.bpid FROM basepid, thread"
2226
+ " WHERE basepid.fpid=thread.fprev)"
2227
+ " SELECT uuid FROM blob, basepid"
2228
+ " WHERE basepid.fpid=forumpost.firt"
2229
+ " AND blob.rid=basepid.bpid)," /* 4: in-reply-to */
2230
+ " wantalert.needMod," /* 5: moderated */
2231
+ " coalesce(display_name(info),euser,user)," /* 6: user */
2232
+ " forumpost.fprev IS NULL" /* 7: is an edit */
22252233
" FROM temp.wantalert, event, forumpost"
22262234
" LEFT JOIN user ON (login=coalesce(euser,user))"
22272235
" WHERE event.objid=substr(wantalert.eventId,2)+0"
22282236
" AND eventId GLOB 'f*'"
22292237
" AND forumpost.fpid=event.objid"
22302238
--- src/alerts.c
+++ src/alerts.c
@@ -2210,20 +2210,28 @@
2210 ** is a normal email alert. Construct full-text forum post alerts
2211 ** using a format that enables them to be sent as separate emails.
2212 */
2213 db_prepare(&q,
2214 "SELECT"
2215 " forumpost.fpid," /* 0 */
2216 " (SELECT uuid FROM blob WHERE rid=forumpost.fpid)," /* 1 */
2217 " datetime(event.mtime)," /* 2 */
2218 " substr(comment,instr(comment,':')+2)," /* 3 */
2219 " (SELECT uuid FROM blob, forumpost AS irt"
2220 " WHERE irt.fpid=forumpost.firt"
2221 " AND blob.rid=coalesce(irt.fprev,irt.fpid))," /* 4 */
2222 " wantalert.needMod," /* 5 */
2223 " coalesce(display_name(info),euser,user)," /* 6 */
2224 " forumpost.fprev IS NULL" /* 7 */
 
 
 
 
 
 
 
 
2225 " FROM temp.wantalert, event, forumpost"
2226 " LEFT JOIN user ON (login=coalesce(euser,user))"
2227 " WHERE event.objid=substr(wantalert.eventId,2)+0"
2228 " AND eventId GLOB 'f*'"
2229 " AND forumpost.fpid=event.objid"
2230
--- src/alerts.c
+++ src/alerts.c
@@ -2210,20 +2210,28 @@
2210 ** is a normal email alert. Construct full-text forum post alerts
2211 ** using a format that enables them to be sent as separate emails.
2212 */
2213 db_prepare(&q,
2214 "SELECT"
2215 " forumpost.fpid," /* 0: fpid */
2216 " (SELECT uuid FROM blob WHERE rid=forumpost.fpid)," /* 1: hash */
2217 " datetime(event.mtime)," /* 2: date/time */
2218 " substr(comment,instr(comment,':')+2)," /* 3: comment */
2219 " (WITH thread(fpid,fprev) AS ("
2220 " SELECT fpid,fprev FROM forumpost AS tx"
2221 " WHERE tx.froot=forumpost.froot),"
2222 " basepid(fpid,bpid) AS ("
2223 " SELECT fpid, fpid FROM thread WHERE fprev IS NULL"
2224 " UNION ALL"
2225 " SELECT thread.fpid, basepid.bpid FROM basepid, thread"
2226 " WHERE basepid.fpid=thread.fprev)"
2227 " SELECT uuid FROM blob, basepid"
2228 " WHERE basepid.fpid=forumpost.firt"
2229 " AND blob.rid=basepid.bpid)," /* 4: in-reply-to */
2230 " wantalert.needMod," /* 5: moderated */
2231 " coalesce(display_name(info),euser,user)," /* 6: user */
2232 " forumpost.fprev IS NULL" /* 7: is an edit */
2233 " FROM temp.wantalert, event, forumpost"
2234 " LEFT JOIN user ON (login=coalesce(euser,user))"
2235 " WHERE event.objid=substr(wantalert.eventId,2)+0"
2236 " AND eventId GLOB 'f*'"
2237 " AND forumpost.fpid=event.objid"
2238

Keyboard Shortcuts

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