Fossil SCM

Allow restricting the timeline RSS feed to a specific ticket.

dg 2013-02-05 23:38 dg-misc
Commit 3f43ab397e289dc11b7d0b0865ba73f58f449e53
1 file changed +23
+23
--- src/rss.c
+++ src/rss.c
@@ -22,17 +22,28 @@
2222
#include "rss.h"
2323
#include <assert.h>
2424
2525
/*
2626
** 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.
2736
*/
37
+
2838
void page_timeline_rss(void){
2939
Stmt q;
3040
int nLine=0;
3141
char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0;
3242
Blob bSQL;
3343
const char *zType = PD("y","all"); /* Type of events. All if NULL */
44
+ const char *zTicketUuid = PD("tkt",NULL);
3445
int nLimit = atoi(PD("n","20"));
3546
const char zSQL1[] =
3647
@ SELECT
3748
@ blob.rid,
3849
@ uuid,
@@ -62,10 +73,11 @@
6273
if( !g.perm.Read ){
6374
if( g.perm.RdTkt && g.perm.RdWiki ){
6475
blob_append(&bSQL, " AND event.type!='ci'", -1);
6576
}else if( g.perm.RdTkt ){
6677
blob_append(&bSQL, " AND event.type=='t'", -1);
78
+
6779
}else{
6880
blob_append(&bSQL, " AND event.type=='w'", -1);
6981
}
7082
}else if( !g.perm.RdWiki ){
7183
if( g.perm.RdTkt ){
@@ -76,10 +88,21 @@
7688
}else if( !g.perm.RdTkt ){
7789
assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki );
7890
blob_append(&bSQL, " AND event.type!='t'", -1);
7991
}
8092
}
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
+ }
81104
82105
blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
83106
84107
cgi_set_content_type("application/rss+xml");
85108
86109
--- 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

Keyboard Shortcuts

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