Fossil SCM
Allow restricting the timeline RSS feed to a specific ticket.
Commit
3f43ab397e289dc11b7d0b0865ba73f58f449e53
Parent
5634879fbe5a9f9…
1 file changed
+23
+23
| --- src/rss.c | ||
| +++ src/rss.c | ||
| @@ -22,17 +22,28 @@ | ||
| 22 | 22 | #include "rss.h" |
| 23 | 23 | #include <assert.h> |
| 24 | 24 | |
| 25 | 25 | /* |
| 26 | 26 | ** WEBPAGE: timeline.rss |
| 27 | +** URL: /timeline.rss/y=TYPE&n=LIMIT&tkt=UUID | |
| 28 | +** | |
| 29 | +** Produce an RSS feed of the timeline. | |
| 30 | +** | |
| 31 | +** TYPE may be: all, ci (show checkins only), t (show tickets only), | |
| 32 | +** w (show wiki only). LIMIT is the number of items to show. | |
| 33 | +** | |
| 34 | +** If UUID is specified, then only changes for the specified ticket will | |
| 35 | +** be shown. It probably only makes sense to use y=t if you're doing this. | |
| 27 | 36 | */ |
| 37 | + | |
| 28 | 38 | void page_timeline_rss(void){ |
| 29 | 39 | Stmt q; |
| 30 | 40 | int nLine=0; |
| 31 | 41 | char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0; |
| 32 | 42 | Blob bSQL; |
| 33 | 43 | const char *zType = PD("y","all"); /* Type of events. All if NULL */ |
| 44 | + const char *zTicketUuid = PD("tkt",NULL); | |
| 34 | 45 | int nLimit = atoi(PD("n","20")); |
| 35 | 46 | const char zSQL1[] = |
| 36 | 47 | @ SELECT |
| 37 | 48 | @ blob.rid, |
| 38 | 49 | @ uuid, |
| @@ -62,10 +73,11 @@ | ||
| 62 | 73 | if( !g.perm.Read ){ |
| 63 | 74 | if( g.perm.RdTkt && g.perm.RdWiki ){ |
| 64 | 75 | blob_append(&bSQL, " AND event.type!='ci'", -1); |
| 65 | 76 | }else if( g.perm.RdTkt ){ |
| 66 | 77 | blob_append(&bSQL, " AND event.type=='t'", -1); |
| 78 | + | |
| 67 | 79 | }else{ |
| 68 | 80 | blob_append(&bSQL, " AND event.type=='w'", -1); |
| 69 | 81 | } |
| 70 | 82 | }else if( !g.perm.RdWiki ){ |
| 71 | 83 | if( g.perm.RdTkt ){ |
| @@ -76,10 +88,21 @@ | ||
| 76 | 88 | }else if( !g.perm.RdTkt ){ |
| 77 | 89 | assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki ); |
| 78 | 90 | blob_append(&bSQL, " AND event.type!='t'", -1); |
| 79 | 91 | } |
| 80 | 92 | } |
| 93 | + | |
| 94 | + if ( zTicketUuid ){ | |
| 95 | + int nTagId = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'", | |
| 96 | + zTicketUuid); | |
| 97 | + if ( nTagId == 0 ){ | |
| 98 | + @ No such ticket: %h(zTicketUuid) | |
| 99 | + style_footer(); | |
| 100 | + return; | |
| 101 | + } | |
| 102 | + blob_appendf(&bSQL, " AND objid IN (SELECT rid FROM tagxref WHERE tagid=%d)", nTagId); | |
| 103 | + } | |
| 81 | 104 | |
| 82 | 105 | blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 ); |
| 83 | 106 | |
| 84 | 107 | cgi_set_content_type("application/rss+xml"); |
| 85 | 108 | |
| 86 | 109 |
| --- src/rss.c | |
| +++ src/rss.c | |
| @@ -22,17 +22,28 @@ | |
| 22 | #include "rss.h" |
| 23 | #include <assert.h> |
| 24 | |
| 25 | /* |
| 26 | ** WEBPAGE: timeline.rss |
| 27 | */ |
| 28 | void page_timeline_rss(void){ |
| 29 | Stmt q; |
| 30 | int nLine=0; |
| 31 | char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0; |
| 32 | Blob bSQL; |
| 33 | const char *zType = PD("y","all"); /* Type of events. All if NULL */ |
| 34 | int nLimit = atoi(PD("n","20")); |
| 35 | const char zSQL1[] = |
| 36 | @ SELECT |
| 37 | @ blob.rid, |
| 38 | @ uuid, |
| @@ -62,10 +73,11 @@ | |
| 62 | if( !g.perm.Read ){ |
| 63 | if( g.perm.RdTkt && g.perm.RdWiki ){ |
| 64 | blob_append(&bSQL, " AND event.type!='ci'", -1); |
| 65 | }else if( g.perm.RdTkt ){ |
| 66 | blob_append(&bSQL, " AND event.type=='t'", -1); |
| 67 | }else{ |
| 68 | blob_append(&bSQL, " AND event.type=='w'", -1); |
| 69 | } |
| 70 | }else if( !g.perm.RdWiki ){ |
| 71 | if( g.perm.RdTkt ){ |
| @@ -76,10 +88,21 @@ | |
| 76 | }else if( !g.perm.RdTkt ){ |
| 77 | assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki ); |
| 78 | blob_append(&bSQL, " AND event.type!='t'", -1); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 ); |
| 83 | |
| 84 | cgi_set_content_type("application/rss+xml"); |
| 85 | |
| 86 |
| --- src/rss.c | |
| +++ src/rss.c | |
| @@ -22,17 +22,28 @@ | |
| 22 | #include "rss.h" |
| 23 | #include <assert.h> |
| 24 | |
| 25 | /* |
| 26 | ** WEBPAGE: timeline.rss |
| 27 | ** URL: /timeline.rss/y=TYPE&n=LIMIT&tkt=UUID |
| 28 | ** |
| 29 | ** Produce an RSS feed of the timeline. |
| 30 | ** |
| 31 | ** TYPE may be: all, ci (show checkins only), t (show tickets only), |
| 32 | ** w (show wiki only). LIMIT is the number of items to show. |
| 33 | ** |
| 34 | ** If UUID is specified, then only changes for the specified ticket will |
| 35 | ** be shown. It probably only makes sense to use y=t if you're doing this. |
| 36 | */ |
| 37 | |
| 38 | void page_timeline_rss(void){ |
| 39 | Stmt q; |
| 40 | int nLine=0; |
| 41 | char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0; |
| 42 | Blob bSQL; |
| 43 | const char *zType = PD("y","all"); /* Type of events. All if NULL */ |
| 44 | const char *zTicketUuid = PD("tkt",NULL); |
| 45 | int nLimit = atoi(PD("n","20")); |
| 46 | const char zSQL1[] = |
| 47 | @ SELECT |
| 48 | @ blob.rid, |
| 49 | @ uuid, |
| @@ -62,10 +73,11 @@ | |
| 73 | if( !g.perm.Read ){ |
| 74 | if( g.perm.RdTkt && g.perm.RdWiki ){ |
| 75 | blob_append(&bSQL, " AND event.type!='ci'", -1); |
| 76 | }else if( g.perm.RdTkt ){ |
| 77 | blob_append(&bSQL, " AND event.type=='t'", -1); |
| 78 | |
| 79 | }else{ |
| 80 | blob_append(&bSQL, " AND event.type=='w'", -1); |
| 81 | } |
| 82 | }else if( !g.perm.RdWiki ){ |
| 83 | if( g.perm.RdTkt ){ |
| @@ -76,10 +88,21 @@ | |
| 88 | }else if( !g.perm.RdTkt ){ |
| 89 | assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki ); |
| 90 | blob_append(&bSQL, " AND event.type!='t'", -1); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | if ( zTicketUuid ){ |
| 95 | int nTagId = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'", |
| 96 | zTicketUuid); |
| 97 | if ( nTagId == 0 ){ |
| 98 | @ No such ticket: %h(zTicketUuid) |
| 99 | style_footer(); |
| 100 | return; |
| 101 | } |
| 102 | blob_appendf(&bSQL, " AND objid IN (SELECT rid FROM tagxref WHERE tagid=%d)", nTagId); |
| 103 | } |
| 104 | |
| 105 | blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 ); |
| 106 | |
| 107 | cgi_set_content_type("application/rss+xml"); |
| 108 | |
| 109 |