Fossil SCM

/timeline.rss: updated TITLE fields for wiki entry comment formatting changes. Add explicit forum posts support (they were shown before in some contexts but only by virtue of being 'not a checkin/ticket/wiki' and not honoring the caller's permissions to read them).

stephan 2022-06-18 13:45 trunk
Commit cb651568fbfe66cd3d33f04c76a6722e0e1565b6e1a9bbe0b3ea045a37e807e2
1 file changed +36 -29
+36 -29
--- src/rss.c
+++ src/rss.c
@@ -57,10 +57,11 @@
5757
const char zSQL1[] =
5858
@ SELECT
5959
@ blob.rid,
6060
@ uuid,
6161
@ event.mtime,
62
+ @ event.type,
6263
@ coalesce(ecomment,comment),
6364
@ coalesce(euser,user),
6465
@ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
6566
@ (SELECT count(*) FROM plink WHERE cid=blob.rid),
6667
@ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
@@ -80,31 +81,27 @@
8081
8182
if( zType[0]!='a' ){
8283
if( zType[0]=='c' && !g.perm.Read ) zType = "x";
8384
if( zType[0]=='w' && !g.perm.RdWiki ) zType = "x";
8485
if( zType[0]=='t' && !g.perm.RdTkt ) zType = "x";
86
+ if( zType[0]=='f' && !g.perm.RdForum ) zType = "x";
8587
blob_append_sql(&bSQL, " AND event.type=%Q", zType);
8688
}else{
87
- if( !g.perm.Read ){
88
- if( g.perm.RdTkt && g.perm.RdWiki ){
89
- blob_append(&bSQL, " AND event.type!='ci'", -1);
90
- }else if( g.perm.RdTkt ){
91
- blob_append(&bSQL, " AND event.type=='t'", -1);
92
-
93
- }else{
94
- blob_append(&bSQL, " AND event.type=='w'", -1);
95
- }
96
- }else if( !g.perm.RdWiki ){
97
- if( g.perm.RdTkt ){
98
- blob_append(&bSQL, " AND event.type!='w'", -1);
99
- }else{
100
- blob_append(&bSQL, " AND event.type=='ci'", -1);
101
- }
102
- }else if( !g.perm.RdTkt ){
103
- assert( !g.perm.RdTkt && g.perm.Read && g.perm.RdWiki );
104
- blob_append(&bSQL, " AND event.type!='t'", -1);
105
- }
89
+ blob_append(&bSQL, " AND event.type in (", -1);
90
+ if( g.perm.Read ){
91
+ blob_append(&bSQL, "'ci',", 4);
92
+ }
93
+ if( g.perm.RdTkt ){
94
+ blob_append(&bSQL, "'t',", 4);
95
+ }
96
+ if( g.perm.RdWiki ){
97
+ blob_append(&bSQL, "'w',", 4);
98
+ }
99
+ if( g.perm.RdForum ){
100
+ blob_append(&bSQL, "'f',", -1);
101
+ }
102
+ blob_append(&bSQL, "'x')", 4);
106103
}
107104
108105
if( zTicketUuid ){
109106
nTagId = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",
110107
zTicketUuid);
@@ -168,30 +165,40 @@
168165
free(zPubDate);
169166
db_prepare(&q, "%s", blob_sql_text(&bSQL));
170167
blob_reset( &bSQL );
171168
while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
172169
const char *zId = db_column_text(&q, 1);
173
- const char *zCom = db_column_text(&q, 3);
174
- const char *zAuthor = db_column_text(&q, 4);
170
+ const char *zType = db_column_text(&q, 3);
171
+ const char *zCom = db_column_text(&q, 4);
172
+ const char *zAuthor = db_column_text(&q, 5);
175173
char *zPrefix = "";
176174
char *zSuffix = 0;
177175
char *zDate;
178176
int nChild = db_column_int(&q, 5);
179
- int nParent = db_column_int(&q, 6);
180
- const char *zTagList = db_column_text(&q, 7);
177
+ int nParent = db_column_int(&q, 7);
178
+ const char *zTagList = db_column_text(&q, 8);
181179
time_t ts;
182180
183181
if( zTagList && zTagList[0]==0 ) zTagList = 0;
184182
ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
185183
zDate = cgi_rfc822_datestamp(ts);
186184
187
- if( nParent>1 && nChild>1 ){
188
- zPrefix = "*MERGE/FORK* ";
189
- }else if( nParent>1 ){
190
- zPrefix = "*MERGE* ";
191
- }else if( nChild>1 ){
192
- zPrefix = "*FORK* ";
185
+ if('c'==zType[0]){
186
+ if( nParent>1 && nChild>1 ){
187
+ zPrefix = "*MERGE/FORK* ";
188
+ }else if( nParent>1 ){
189
+ zPrefix = "*MERGE* ";
190
+ }else if( nChild>1 ){
191
+ zPrefix = "*FORK* ";
192
+ }
193
+ }else if('w'==zType[0]){
194
+ switch(zCom ? zCom[0] : 0){
195
+ case ':': zPrefix = "Edit wiki page: "; break;
196
+ case '+': zPrefix = "Add wiki page: "; break;
197
+ case '-': zPrefix = "Delete wiki page: "; break;
198
+ }
199
+ if(*zPrefix) ++zCom;
193200
}
194201
195202
if( zTagList ){
196203
zSuffix = mprintf(" (tags: %s)", zTagList);
197204
}
198205
--- src/rss.c
+++ src/rss.c
@@ -57,10 +57,11 @@
57 const char zSQL1[] =
58 @ SELECT
59 @ blob.rid,
60 @ uuid,
61 @ event.mtime,
 
62 @ coalesce(ecomment,comment),
63 @ coalesce(euser,user),
64 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
65 @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
66 @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
@@ -80,31 +81,27 @@
80
81 if( zType[0]!='a' ){
82 if( zType[0]=='c' && !g.perm.Read ) zType = "x";
83 if( zType[0]=='w' && !g.perm.RdWiki ) zType = "x";
84 if( zType[0]=='t' && !g.perm.RdTkt ) zType = "x";
 
85 blob_append_sql(&bSQL, " AND event.type=%Q", zType);
86 }else{
87 if( !g.perm.Read ){
88 if( g.perm.RdTkt && g.perm.RdWiki ){
89 blob_append(&bSQL, " AND event.type!='ci'", -1);
90 }else if( g.perm.RdTkt ){
91 blob_append(&bSQL, " AND event.type=='t'", -1);
92
93 }else{
94 blob_append(&bSQL, " AND event.type=='w'", -1);
95 }
96 }else if( !g.perm.RdWiki ){
97 if( g.perm.RdTkt ){
98 blob_append(&bSQL, " AND event.type!='w'", -1);
99 }else{
100 blob_append(&bSQL, " AND event.type=='ci'", -1);
101 }
102 }else if( !g.perm.RdTkt ){
103 assert( !g.perm.RdTkt && g.perm.Read && g.perm.RdWiki );
104 blob_append(&bSQL, " AND event.type!='t'", -1);
105 }
106 }
107
108 if( zTicketUuid ){
109 nTagId = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",
110 zTicketUuid);
@@ -168,30 +165,40 @@
168 free(zPubDate);
169 db_prepare(&q, "%s", blob_sql_text(&bSQL));
170 blob_reset( &bSQL );
171 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
172 const char *zId = db_column_text(&q, 1);
173 const char *zCom = db_column_text(&q, 3);
174 const char *zAuthor = db_column_text(&q, 4);
 
175 char *zPrefix = "";
176 char *zSuffix = 0;
177 char *zDate;
178 int nChild = db_column_int(&q, 5);
179 int nParent = db_column_int(&q, 6);
180 const char *zTagList = db_column_text(&q, 7);
181 time_t ts;
182
183 if( zTagList && zTagList[0]==0 ) zTagList = 0;
184 ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
185 zDate = cgi_rfc822_datestamp(ts);
186
187 if( nParent>1 && nChild>1 ){
188 zPrefix = "*MERGE/FORK* ";
189 }else if( nParent>1 ){
190 zPrefix = "*MERGE* ";
191 }else if( nChild>1 ){
192 zPrefix = "*FORK* ";
 
 
 
 
 
 
 
 
 
193 }
194
195 if( zTagList ){
196 zSuffix = mprintf(" (tags: %s)", zTagList);
197 }
198
--- src/rss.c
+++ src/rss.c
@@ -57,10 +57,11 @@
57 const char zSQL1[] =
58 @ SELECT
59 @ blob.rid,
60 @ uuid,
61 @ event.mtime,
62 @ event.type,
63 @ coalesce(ecomment,comment),
64 @ coalesce(euser,user),
65 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
66 @ (SELECT count(*) FROM plink WHERE cid=blob.rid),
67 @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
@@ -80,31 +81,27 @@
81
82 if( zType[0]!='a' ){
83 if( zType[0]=='c' && !g.perm.Read ) zType = "x";
84 if( zType[0]=='w' && !g.perm.RdWiki ) zType = "x";
85 if( zType[0]=='t' && !g.perm.RdTkt ) zType = "x";
86 if( zType[0]=='f' && !g.perm.RdForum ) zType = "x";
87 blob_append_sql(&bSQL, " AND event.type=%Q", zType);
88 }else{
89 blob_append(&bSQL, " AND event.type in (", -1);
90 if( g.perm.Read ){
91 blob_append(&bSQL, "'ci',", 4);
92 }
93 if( g.perm.RdTkt ){
94 blob_append(&bSQL, "'t',", 4);
95 }
96 if( g.perm.RdWiki ){
97 blob_append(&bSQL, "'w',", 4);
98 }
99 if( g.perm.RdForum ){
100 blob_append(&bSQL, "'f',", -1);
101 }
102 blob_append(&bSQL, "'x')", 4);
 
 
 
 
 
103 }
104
105 if( zTicketUuid ){
106 nTagId = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",
107 zTicketUuid);
@@ -168,30 +165,40 @@
165 free(zPubDate);
166 db_prepare(&q, "%s", blob_sql_text(&bSQL));
167 blob_reset( &bSQL );
168 while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){
169 const char *zId = db_column_text(&q, 1);
170 const char *zType = db_column_text(&q, 3);
171 const char *zCom = db_column_text(&q, 4);
172 const char *zAuthor = db_column_text(&q, 5);
173 char *zPrefix = "";
174 char *zSuffix = 0;
175 char *zDate;
176 int nChild = db_column_int(&q, 5);
177 int nParent = db_column_int(&q, 7);
178 const char *zTagList = db_column_text(&q, 8);
179 time_t ts;
180
181 if( zTagList && zTagList[0]==0 ) zTagList = 0;
182 ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0);
183 zDate = cgi_rfc822_datestamp(ts);
184
185 if('c'==zType[0]){
186 if( nParent>1 && nChild>1 ){
187 zPrefix = "*MERGE/FORK* ";
188 }else if( nParent>1 ){
189 zPrefix = "*MERGE* ";
190 }else if( nChild>1 ){
191 zPrefix = "*FORK* ";
192 }
193 }else if('w'==zType[0]){
194 switch(zCom ? zCom[0] : 0){
195 case ':': zPrefix = "Edit wiki page: "; break;
196 case '+': zPrefix = "Add wiki page: "; break;
197 case '-': zPrefix = "Delete wiki page: "; break;
198 }
199 if(*zPrefix) ++zCom;
200 }
201
202 if( zTagList ){
203 zSuffix = mprintf(" (tags: %s)", zTagList);
204 }
205

Keyboard Shortcuts

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