Fossil SCM
Generate event report in chronological order for an alert text.
Commit
e02892522ecf7f3e79568a97f33ba5051f54f828caebc64c843e00a6367ec514
Parent
bb30d02efdb768b…
1 file changed
+9
-4
+9
-4
| --- src/email.c | ||
| +++ src/email.c | ||
| @@ -70,11 +70,11 @@ | ||
| 70 | 70 | @ -- 'c4413' means check-in with rid=4413. |
| 71 | 71 | @ -- |
| 72 | 72 | @ CREATE TABLE repository.pending_alert( |
| 73 | 73 | @ eventid TEXT PRIMARY KEY, -- Object that changed |
| 74 | 74 | @ sentSep BOOLEAN DEFAULT false, -- individual emails sent |
| 75 | -@ sentDigest BOOLEAN DEFAULT false -- digest emails sent | |
| 75 | +@ mtime DATETIME -- when added to queue | |
| 76 | 76 | @ ) WITHOUT ROWID; |
| 77 | 77 | @ |
| 78 | 78 | @ -- Record bounced emails. If too many bounces are received within |
| 79 | 79 | @ -- some defined time range, then cancel the subscription. Older |
| 80 | 80 | @ -- entries are periodically purged. |
| @@ -103,12 +103,13 @@ | ||
| 103 | 103 | void email_triggers_enable(void){ |
| 104 | 104 | if( !db_table_exists("repository","pending_alert") ) return; |
| 105 | 105 | db_multi_exec( |
| 106 | 106 | "CREATE TRIGGER IF NOT EXISTS repository.email_trigger1\n" |
| 107 | 107 | "AFTER INSERT ON event BEGIN\n" |
| 108 | - " INSERT INTO pending_alert(eventid)\n" | |
| 109 | - " SELECT printf('%%.1c%%d',new.type,new.objid) WHERE true\n" | |
| 108 | + " INSERT INTO pending_alert(eventid,mtime)\n" | |
| 109 | + " SELECT printf('%%.1c%%d',new.type,new.objid)," | |
| 110 | + " julianday('now') WHERE true\n" | |
| 110 | 111 | " ON CONFLICT(eventId) DO NOTHING;\n" |
| 111 | 112 | "END;" |
| 112 | 113 | ); |
| 113 | 114 | } |
| 114 | 115 | |
| @@ -1341,11 +1342,15 @@ | ||
| 1341 | 1342 | email_schema(); |
| 1342 | 1343 | blob_init(&out, 0, 0); |
| 1343 | 1344 | email_header(mAlert, &out); |
| 1344 | 1345 | if( bActual ){ |
| 1345 | 1346 | Stmt q; |
| 1346 | - db_prepare(&q, "SELECT eventid FROM pending_alert"); | |
| 1347 | + db_prepare(&q, | |
| 1348 | + "SELECT eventid FROM pending_alert, event" | |
| 1349 | + " WHERE event.objid=substr(pending_alert.eventid,2)+0" | |
| 1350 | + " ORDER BY event.mtime" | |
| 1351 | + ); | |
| 1347 | 1352 | while( db_step(&q)==SQLITE_ROW ){ |
| 1348 | 1353 | email_one_alert(db_column_text(&q,0), mAlert, &out); |
| 1349 | 1354 | } |
| 1350 | 1355 | db_finalize(&q); |
| 1351 | 1356 | }else{ |
| 1352 | 1357 |
| --- src/email.c | |
| +++ src/email.c | |
| @@ -70,11 +70,11 @@ | |
| 70 | @ -- 'c4413' means check-in with rid=4413. |
| 71 | @ -- |
| 72 | @ CREATE TABLE repository.pending_alert( |
| 73 | @ eventid TEXT PRIMARY KEY, -- Object that changed |
| 74 | @ sentSep BOOLEAN DEFAULT false, -- individual emails sent |
| 75 | @ sentDigest BOOLEAN DEFAULT false -- digest emails sent |
| 76 | @ ) WITHOUT ROWID; |
| 77 | @ |
| 78 | @ -- Record bounced emails. If too many bounces are received within |
| 79 | @ -- some defined time range, then cancel the subscription. Older |
| 80 | @ -- entries are periodically purged. |
| @@ -103,12 +103,13 @@ | |
| 103 | void email_triggers_enable(void){ |
| 104 | if( !db_table_exists("repository","pending_alert") ) return; |
| 105 | db_multi_exec( |
| 106 | "CREATE TRIGGER IF NOT EXISTS repository.email_trigger1\n" |
| 107 | "AFTER INSERT ON event BEGIN\n" |
| 108 | " INSERT INTO pending_alert(eventid)\n" |
| 109 | " SELECT printf('%%.1c%%d',new.type,new.objid) WHERE true\n" |
| 110 | " ON CONFLICT(eventId) DO NOTHING;\n" |
| 111 | "END;" |
| 112 | ); |
| 113 | } |
| 114 | |
| @@ -1341,11 +1342,15 @@ | |
| 1341 | email_schema(); |
| 1342 | blob_init(&out, 0, 0); |
| 1343 | email_header(mAlert, &out); |
| 1344 | if( bActual ){ |
| 1345 | Stmt q; |
| 1346 | db_prepare(&q, "SELECT eventid FROM pending_alert"); |
| 1347 | while( db_step(&q)==SQLITE_ROW ){ |
| 1348 | email_one_alert(db_column_text(&q,0), mAlert, &out); |
| 1349 | } |
| 1350 | db_finalize(&q); |
| 1351 | }else{ |
| 1352 |
| --- src/email.c | |
| +++ src/email.c | |
| @@ -70,11 +70,11 @@ | |
| 70 | @ -- 'c4413' means check-in with rid=4413. |
| 71 | @ -- |
| 72 | @ CREATE TABLE repository.pending_alert( |
| 73 | @ eventid TEXT PRIMARY KEY, -- Object that changed |
| 74 | @ sentSep BOOLEAN DEFAULT false, -- individual emails sent |
| 75 | @ mtime DATETIME -- when added to queue |
| 76 | @ ) WITHOUT ROWID; |
| 77 | @ |
| 78 | @ -- Record bounced emails. If too many bounces are received within |
| 79 | @ -- some defined time range, then cancel the subscription. Older |
| 80 | @ -- entries are periodically purged. |
| @@ -103,12 +103,13 @@ | |
| 103 | void email_triggers_enable(void){ |
| 104 | if( !db_table_exists("repository","pending_alert") ) return; |
| 105 | db_multi_exec( |
| 106 | "CREATE TRIGGER IF NOT EXISTS repository.email_trigger1\n" |
| 107 | "AFTER INSERT ON event BEGIN\n" |
| 108 | " INSERT INTO pending_alert(eventid,mtime)\n" |
| 109 | " SELECT printf('%%.1c%%d',new.type,new.objid)," |
| 110 | " julianday('now') WHERE true\n" |
| 111 | " ON CONFLICT(eventId) DO NOTHING;\n" |
| 112 | "END;" |
| 113 | ); |
| 114 | } |
| 115 | |
| @@ -1341,11 +1342,15 @@ | |
| 1342 | email_schema(); |
| 1343 | blob_init(&out, 0, 0); |
| 1344 | email_header(mAlert, &out); |
| 1345 | if( bActual ){ |
| 1346 | Stmt q; |
| 1347 | db_prepare(&q, |
| 1348 | "SELECT eventid FROM pending_alert, event" |
| 1349 | " WHERE event.objid=substr(pending_alert.eventid,2)+0" |
| 1350 | " ORDER BY event.mtime" |
| 1351 | ); |
| 1352 | while( db_step(&q)==SQLITE_ROW ){ |
| 1353 | email_one_alert(db_column_text(&q,0), mAlert, &out); |
| 1354 | } |
| 1355 | db_finalize(&q); |
| 1356 | }else{ |
| 1357 |