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).
Commit
cb651568fbfe66cd3d33f04c76a6722e0e1565b6e1a9bbe0b3ea045a37e807e2
Parent
30f669b004de35c…
1 file changed
+36
-29
+36
-29
| --- src/rss.c | ||
| +++ src/rss.c | ||
| @@ -57,10 +57,11 @@ | ||
| 57 | 57 | const char zSQL1[] = |
| 58 | 58 | @ SELECT |
| 59 | 59 | @ blob.rid, |
| 60 | 60 | @ uuid, |
| 61 | 61 | @ event.mtime, |
| 62 | + @ event.type, | |
| 62 | 63 | @ coalesce(ecomment,comment), |
| 63 | 64 | @ coalesce(euser,user), |
| 64 | 65 | @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim), |
| 65 | 66 | @ (SELECT count(*) FROM plink WHERE cid=blob.rid), |
| 66 | 67 | @ (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref |
| @@ -80,31 +81,27 @@ | ||
| 80 | 81 | |
| 81 | 82 | if( zType[0]!='a' ){ |
| 82 | 83 | if( zType[0]=='c' && !g.perm.Read ) zType = "x"; |
| 83 | 84 | if( zType[0]=='w' && !g.perm.RdWiki ) zType = "x"; |
| 84 | 85 | if( zType[0]=='t' && !g.perm.RdTkt ) zType = "x"; |
| 86 | + if( zType[0]=='f' && !g.perm.RdForum ) zType = "x"; | |
| 85 | 87 | blob_append_sql(&bSQL, " AND event.type=%Q", zType); |
| 86 | 88 | }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); | |
| 106 | 103 | } |
| 107 | 104 | |
| 108 | 105 | if( zTicketUuid ){ |
| 109 | 106 | nTagId = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'", |
| 110 | 107 | zTicketUuid); |
| @@ -168,30 +165,40 @@ | ||
| 168 | 165 | free(zPubDate); |
| 169 | 166 | db_prepare(&q, "%s", blob_sql_text(&bSQL)); |
| 170 | 167 | blob_reset( &bSQL ); |
| 171 | 168 | while( db_step(&q)==SQLITE_ROW && nLine<nLimit ){ |
| 172 | 169 | 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); | |
| 175 | 173 | char *zPrefix = ""; |
| 176 | 174 | char *zSuffix = 0; |
| 177 | 175 | char *zDate; |
| 178 | 176 | 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); | |
| 181 | 179 | time_t ts; |
| 182 | 180 | |
| 183 | 181 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 184 | 182 | ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); |
| 185 | 183 | zDate = cgi_rfc822_datestamp(ts); |
| 186 | 184 | |
| 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; | |
| 193 | 200 | } |
| 194 | 201 | |
| 195 | 202 | if( zTagList ){ |
| 196 | 203 | zSuffix = mprintf(" (tags: %s)", zTagList); |
| 197 | 204 | } |
| 198 | 205 |
| --- 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 |