Fossil SCM
Roll back the part of [71a2d68a7a113e7c] which automatically updates the user display prefs cookie, per /chat discussion. Updating the cookie once again requires an explicit udc URL arg or setting the skin, which implies udc. This fixes the problem that a timeline link from the /reports page persistently sets the default timeline entry count to the value used by that report.
Commit
5feac634737660e03bc0f5761d2cff7c0af579146599fea93d549d6641f51fe5
Parent
edf03559615d4ce…
5 files changed
+6
-2
+12
-2
+2
-2
+1
-1
+1
-3
+6
-2
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1209,15 +1209,19 @@ | ||
| 1209 | 1209 | if( z ){ |
| 1210 | 1210 | ++rc; |
| 1211 | 1211 | z = fossil_strdup(z); |
| 1212 | 1212 | add_param_list(z, '&'); |
| 1213 | 1213 | z = (char*)P("skin"); |
| 1214 | - if(z){ | |
| 1214 | + if( z ){ | |
| 1215 | 1215 | char *zErr = skin_use_alternative(z, 2); |
| 1216 | 1216 | ++rc; |
| 1217 | - if(!zErr && !P("once")){ | |
| 1217 | + if( !zErr && P("once")==0 ){ | |
| 1218 | 1218 | cookie_write_parameter("skin","skin",z); |
| 1219 | + /* Per /chat discussion, passing ?skin=... without "once" | |
| 1220 | + ** implies the "udc" argument, so we force that into the | |
| 1221 | + ** environment here. */ | |
| 1222 | + cgi_set_parameter_nocopy("udc", "1", 1); | |
| 1219 | 1223 | } |
| 1220 | 1224 | fossil_free(zErr); |
| 1221 | 1225 | } |
| 1222 | 1226 | } |
| 1223 | 1227 | return rc; |
| 1224 | 1228 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1209,15 +1209,19 @@ | |
| 1209 | if( z ){ |
| 1210 | ++rc; |
| 1211 | z = fossil_strdup(z); |
| 1212 | add_param_list(z, '&'); |
| 1213 | z = (char*)P("skin"); |
| 1214 | if(z){ |
| 1215 | char *zErr = skin_use_alternative(z, 2); |
| 1216 | ++rc; |
| 1217 | if(!zErr && !P("once")){ |
| 1218 | cookie_write_parameter("skin","skin",z); |
| 1219 | } |
| 1220 | fossil_free(zErr); |
| 1221 | } |
| 1222 | } |
| 1223 | return rc; |
| 1224 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1209,15 +1209,19 @@ | |
| 1209 | if( z ){ |
| 1210 | ++rc; |
| 1211 | z = fossil_strdup(z); |
| 1212 | add_param_list(z, '&'); |
| 1213 | z = (char*)P("skin"); |
| 1214 | if( z ){ |
| 1215 | char *zErr = skin_use_alternative(z, 2); |
| 1216 | ++rc; |
| 1217 | if( !zErr && P("once")==0 ){ |
| 1218 | cookie_write_parameter("skin","skin",z); |
| 1219 | /* Per /chat discussion, passing ?skin=... without "once" |
| 1220 | ** implies the "udc" argument, so we force that into the |
| 1221 | ** environment here. */ |
| 1222 | cgi_set_parameter_nocopy("udc", "1", 1); |
| 1223 | } |
| 1224 | fossil_free(zErr); |
| 1225 | } |
| 1226 | } |
| 1227 | return rc; |
| 1228 |
+12
-2
| --- src/cookies.c | ||
| +++ src/cookies.c | ||
| @@ -175,14 +175,24 @@ | ||
| 175 | 175 | cookie_readwrite(zQP, zPName, zDflt, COOKIE_READ|COOKIE_WRITE); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /* Update the user preferences cookie, if necessary, and shut down |
| 179 | 179 | ** this module. The cookie is only emitted if its value has actually |
| 180 | -** changed since the request started. | |
| 180 | +** changed since the request started and the "udc" (Update Display | |
| 181 | +** Cookie) URL argument was provided. | |
| 182 | +** | |
| 183 | +** Historical note: from 2021-03-02 [71a2d68a7a113e7c] until | |
| 184 | +** 2023-01-16, the udc was not observed (it had been prior to that), | |
| 185 | +** and that led to the unfortunate side effect that a timeline link | |
| 186 | +** from the /reports page would end up persistently setting a user's | |
| 187 | +** timeline length preference to the number of items in that | |
| 188 | +** report. In a /chat discussion it was agreed that updating the | |
| 189 | +** cookie requires explicit opt-in via the udc argument or ?skin=..., | |
| 190 | +** which implies udc. | |
| 181 | 191 | */ |
| 182 | 192 | void cookie_render(void){ |
| 183 | - if( cookies.bChanged ){ | |
| 193 | + if( cookies.bChanged && P("udc")!=0 ){ | |
| 184 | 194 | Blob new; |
| 185 | 195 | int i; |
| 186 | 196 | blob_init(&new, 0, 0); |
| 187 | 197 | for(i=0;i<cookies.nParam;i++){ |
| 188 | 198 | if( i>0 ) blob_append(&new, ",", 1); |
| 189 | 199 |
| --- src/cookies.c | |
| +++ src/cookies.c | |
| @@ -175,14 +175,24 @@ | |
| 175 | cookie_readwrite(zQP, zPName, zDflt, COOKIE_READ|COOKIE_WRITE); |
| 176 | } |
| 177 | |
| 178 | /* Update the user preferences cookie, if necessary, and shut down |
| 179 | ** this module. The cookie is only emitted if its value has actually |
| 180 | ** changed since the request started. |
| 181 | */ |
| 182 | void cookie_render(void){ |
| 183 | if( cookies.bChanged ){ |
| 184 | Blob new; |
| 185 | int i; |
| 186 | blob_init(&new, 0, 0); |
| 187 | for(i=0;i<cookies.nParam;i++){ |
| 188 | if( i>0 ) blob_append(&new, ",", 1); |
| 189 |
| --- src/cookies.c | |
| +++ src/cookies.c | |
| @@ -175,14 +175,24 @@ | |
| 175 | cookie_readwrite(zQP, zPName, zDflt, COOKIE_READ|COOKIE_WRITE); |
| 176 | } |
| 177 | |
| 178 | /* Update the user preferences cookie, if necessary, and shut down |
| 179 | ** this module. The cookie is only emitted if its value has actually |
| 180 | ** changed since the request started and the "udc" (Update Display |
| 181 | ** Cookie) URL argument was provided. |
| 182 | ** |
| 183 | ** Historical note: from 2021-03-02 [71a2d68a7a113e7c] until |
| 184 | ** 2023-01-16, the udc was not observed (it had been prior to that), |
| 185 | ** and that led to the unfortunate side effect that a timeline link |
| 186 | ** from the /reports page would end up persistently setting a user's |
| 187 | ** timeline length preference to the number of items in that |
| 188 | ** report. In a /chat discussion it was agreed that updating the |
| 189 | ** cookie requires explicit opt-in via the udc argument or ?skin=..., |
| 190 | ** which implies udc. |
| 191 | */ |
| 192 | void cookie_render(void){ |
| 193 | if( cookies.bChanged && P("udc")!=0 ){ |
| 194 | Blob new; |
| 195 | int i; |
| 196 | blob_init(&new, 0, 0); |
| 197 | for(i=0;i<cookies.nParam;i++){ |
| 198 | if( i>0 ) blob_append(&new, ",", 1); |
| 199 |
+2
-2
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -881,11 +881,11 @@ | ||
| 881 | 881 | render_checkin_context(rid, 0, 0, 0); |
| 882 | 882 | @ </div><div class="section accordion">Changes</div> |
| 883 | 883 | @ <div class="accordion_panel"> |
| 884 | 884 | @ <div class="sectionmenu"> |
| 885 | 885 | pCfg = construct_diff_flags(diffType, &DCfg); |
| 886 | - DCfg.pRe = pRe; | |
| 886 | + DCfg.pRe = pRe; | |
| 887 | 887 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 888 | 888 | if( diffType!=0 ){ |
| 889 | 889 | @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\ |
| 890 | 890 | @ Hide Diffs</a> |
| 891 | 891 | } |
| @@ -935,11 +935,11 @@ | ||
| 935 | 935 | const char *zName = db_column_text(&q3,0); |
| 936 | 936 | int mperm = db_column_int(&q3, 1); |
| 937 | 937 | const char *zOld = db_column_text(&q3,2); |
| 938 | 938 | const char *zNew = db_column_text(&q3,3); |
| 939 | 939 | const char *zOldName = db_column_text(&q3, 4); |
| 940 | - append_file_change_line(zUuid, zName, zOld, zNew, zOldName, | |
| 940 | + append_file_change_line(zUuid, zName, zOld, zNew, zOldName, | |
| 941 | 941 | pCfg,mperm); |
| 942 | 942 | } |
| 943 | 943 | db_finalize(&q3); |
| 944 | 944 | @ </div> |
| 945 | 945 | append_diff_javascript(diffType); |
| 946 | 946 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -881,11 +881,11 @@ | |
| 881 | render_checkin_context(rid, 0, 0, 0); |
| 882 | @ </div><div class="section accordion">Changes</div> |
| 883 | @ <div class="accordion_panel"> |
| 884 | @ <div class="sectionmenu"> |
| 885 | pCfg = construct_diff_flags(diffType, &DCfg); |
| 886 | DCfg.pRe = pRe; |
| 887 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 888 | if( diffType!=0 ){ |
| 889 | @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\ |
| 890 | @ Hide Diffs</a> |
| 891 | } |
| @@ -935,11 +935,11 @@ | |
| 935 | const char *zName = db_column_text(&q3,0); |
| 936 | int mperm = db_column_int(&q3, 1); |
| 937 | const char *zOld = db_column_text(&q3,2); |
| 938 | const char *zNew = db_column_text(&q3,3); |
| 939 | const char *zOldName = db_column_text(&q3, 4); |
| 940 | append_file_change_line(zUuid, zName, zOld, zNew, zOldName, |
| 941 | pCfg,mperm); |
| 942 | } |
| 943 | db_finalize(&q3); |
| 944 | @ </div> |
| 945 | append_diff_javascript(diffType); |
| 946 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -881,11 +881,11 @@ | |
| 881 | render_checkin_context(rid, 0, 0, 0); |
| 882 | @ </div><div class="section accordion">Changes</div> |
| 883 | @ <div class="accordion_panel"> |
| 884 | @ <div class="sectionmenu"> |
| 885 | pCfg = construct_diff_flags(diffType, &DCfg); |
| 886 | DCfg.pRe = pRe; |
| 887 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 888 | if( diffType!=0 ){ |
| 889 | @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\ |
| 890 | @ Hide Diffs</a> |
| 891 | } |
| @@ -935,11 +935,11 @@ | |
| 935 | const char *zName = db_column_text(&q3,0); |
| 936 | int mperm = db_column_int(&q3, 1); |
| 937 | const char *zOld = db_column_text(&q3,2); |
| 938 | const char *zNew = db_column_text(&q3,3); |
| 939 | const char *zOldName = db_column_text(&q3, 4); |
| 940 | append_file_change_line(zUuid, zName, zOld, zNew, zOldName, |
| 941 | pCfg,mperm); |
| 942 | } |
| 943 | db_finalize(&q3); |
| 944 | @ </div> |
| 945 | append_diff_javascript(diffType); |
| 946 |
+1
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1464,11 +1464,11 @@ | ||
| 1464 | 1464 | /* |
| 1465 | 1465 | ** Send an HTTP redirect back to the designated Index Page. |
| 1466 | 1466 | */ |
| 1467 | 1467 | NORETURN void fossil_redirect_home(void){ |
| 1468 | 1468 | /* In order for ?skin=... to work when visiting the site from |
| 1469 | - ** a typical external link, we have to process is here, as | |
| 1469 | + ** a typical external link, we have to process it here, as | |
| 1470 | 1470 | ** that parameter gets lost during the redirect. We "could" |
| 1471 | 1471 | ** pass the whole query string along instead, but that seems |
| 1472 | 1472 | ** unnecessary. */ |
| 1473 | 1473 | if(cgi_setup_query_string()>1){ |
| 1474 | 1474 | cookie_render(); |
| 1475 | 1475 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1464,11 +1464,11 @@ | |
| 1464 | /* |
| 1465 | ** Send an HTTP redirect back to the designated Index Page. |
| 1466 | */ |
| 1467 | NORETURN void fossil_redirect_home(void){ |
| 1468 | /* In order for ?skin=... to work when visiting the site from |
| 1469 | ** a typical external link, we have to process is here, as |
| 1470 | ** that parameter gets lost during the redirect. We "could" |
| 1471 | ** pass the whole query string along instead, but that seems |
| 1472 | ** unnecessary. */ |
| 1473 | if(cgi_setup_query_string()>1){ |
| 1474 | cookie_render(); |
| 1475 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1464,11 +1464,11 @@ | |
| 1464 | /* |
| 1465 | ** Send an HTTP redirect back to the designated Index Page. |
| 1466 | */ |
| 1467 | NORETURN void fossil_redirect_home(void){ |
| 1468 | /* In order for ?skin=... to work when visiting the site from |
| 1469 | ** a typical external link, we have to process it here, as |
| 1470 | ** that parameter gets lost during the redirect. We "could" |
| 1471 | ** pass the whole query string along instead, but that seems |
| 1472 | ** unnecessary. */ |
| 1473 | if(cgi_setup_query_string()>1){ |
| 1474 | cookie_render(); |
| 1475 |
+1
-3
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -1138,13 +1138,11 @@ | ||
| 1138 | 1138 | if( sqlite3_strlike("%</body>%", zFooter, 0)!=0 ){ |
| 1139 | 1139 | style_load_all_js_files(); |
| 1140 | 1140 | @ </body> |
| 1141 | 1141 | @ </html> |
| 1142 | 1142 | } |
| 1143 | - /* Update the user display prefs cookie if it was modified during | |
| 1144 | - ** this request. | |
| 1145 | - */ | |
| 1143 | + /* Update the user display prefs cookie if it was modified */ | |
| 1146 | 1144 | cookie_render(); |
| 1147 | 1145 | } |
| 1148 | 1146 | |
| 1149 | 1147 | /* |
| 1150 | 1148 | ** Begin a side-box on the right-hand side of a page. The title and |
| 1151 | 1149 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1138,13 +1138,11 @@ | |
| 1138 | if( sqlite3_strlike("%</body>%", zFooter, 0)!=0 ){ |
| 1139 | style_load_all_js_files(); |
| 1140 | @ </body> |
| 1141 | @ </html> |
| 1142 | } |
| 1143 | /* Update the user display prefs cookie if it was modified during |
| 1144 | ** this request. |
| 1145 | */ |
| 1146 | cookie_render(); |
| 1147 | } |
| 1148 | |
| 1149 | /* |
| 1150 | ** Begin a side-box on the right-hand side of a page. The title and |
| 1151 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1138,13 +1138,11 @@ | |
| 1138 | if( sqlite3_strlike("%</body>%", zFooter, 0)!=0 ){ |
| 1139 | style_load_all_js_files(); |
| 1140 | @ </body> |
| 1141 | @ </html> |
| 1142 | } |
| 1143 | /* Update the user display prefs cookie if it was modified */ |
| 1144 | cookie_render(); |
| 1145 | } |
| 1146 | |
| 1147 | /* |
| 1148 | ** Begin a side-box on the right-hand side of a page. The title and |
| 1149 |