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.
Commit
fb4545ef937e06eeda979a8e9aead9c123f7a33dbd0254b550286be462cf3c83
Parent
dbdf50d5fde79d9…
1 file changed
+18
-10
+18
-10
| --- src/alerts.c | ||
| +++ src/alerts.c | ||
| @@ -2210,20 +2210,28 @@ | ||
| 2210 | 2210 | ** is a normal email alert. Construct full-text forum post alerts |
| 2211 | 2211 | ** using a format that enables them to be sent as separate emails. |
| 2212 | 2212 | */ |
| 2213 | 2213 | db_prepare(&q, |
| 2214 | 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 */ | |
| 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 */ | |
| 2225 | 2233 | " FROM temp.wantalert, event, forumpost" |
| 2226 | 2234 | " LEFT JOIN user ON (login=coalesce(euser,user))" |
| 2227 | 2235 | " WHERE event.objid=substr(wantalert.eventId,2)+0" |
| 2228 | 2236 | " AND eventId GLOB 'f*'" |
| 2229 | 2237 | " AND forumpost.fpid=event.objid" |
| 2230 | 2238 |
| --- 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 |