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.

stephan 2023-01-16 15:37 trunk
Commit 5feac634737660e03bc0f5761d2cff7c0af579146599fea93d549d6641f51fe5
+6 -2
--- src/cgi.c
+++ src/cgi.c
@@ -1209,15 +1209,19 @@
12091209
if( z ){
12101210
++rc;
12111211
z = fossil_strdup(z);
12121212
add_param_list(z, '&');
12131213
z = (char*)P("skin");
1214
- if(z){
1214
+ if( z ){
12151215
char *zErr = skin_use_alternative(z, 2);
12161216
++rc;
1217
- if(!zErr && !P("once")){
1217
+ if( !zErr && P("once")==0 ){
12181218
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);
12191223
}
12201224
fossil_free(zErr);
12211225
}
12221226
}
12231227
return rc;
12241228
--- 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 @@
175175
cookie_readwrite(zQP, zPName, zDflt, COOKIE_READ|COOKIE_WRITE);
176176
}
177177
178178
/* Update the user preferences cookie, if necessary, and shut down
179179
** 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.
181191
*/
182192
void cookie_render(void){
183
- if( cookies.bChanged ){
193
+ if( cookies.bChanged && P("udc")!=0 ){
184194
Blob new;
185195
int i;
186196
blob_init(&new, 0, 0);
187197
for(i=0;i<cookies.nParam;i++){
188198
if( i>0 ) blob_append(&new, ",", 1);
189199
--- 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 @@
881881
render_checkin_context(rid, 0, 0, 0);
882882
@ </div><div class="section accordion">Changes</div>
883883
@ <div class="accordion_panel">
884884
@ <div class="sectionmenu">
885885
pCfg = construct_diff_flags(diffType, &DCfg);
886
- DCfg.pRe = pRe;
886
+ DCfg.pRe = pRe;
887887
zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
888888
if( diffType!=0 ){
889889
@ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\
890890
@ Hide&nbsp;Diffs</a>
891891
}
@@ -935,11 +935,11 @@
935935
const char *zName = db_column_text(&q3,0);
936936
int mperm = db_column_int(&q3, 1);
937937
const char *zOld = db_column_text(&q3,2);
938938
const char *zNew = db_column_text(&q3,3);
939939
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,
941941
pCfg,mperm);
942942
}
943943
db_finalize(&q3);
944944
@ </div>
945945
append_diff_javascript(diffType);
946946
--- 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&nbsp;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&nbsp;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 @@
14641464
/*
14651465
** Send an HTTP redirect back to the designated Index Page.
14661466
*/
14671467
NORETURN void fossil_redirect_home(void){
14681468
/* 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
14701470
** that parameter gets lost during the redirect. We "could"
14711471
** pass the whole query string along instead, but that seems
14721472
** unnecessary. */
14731473
if(cgi_setup_query_string()>1){
14741474
cookie_render();
14751475
--- 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 @@
11381138
if( sqlite3_strlike("%</body>%", zFooter, 0)!=0 ){
11391139
style_load_all_js_files();
11401140
@ </body>
11411141
@ </html>
11421142
}
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 */
11461144
cookie_render();
11471145
}
11481146
11491147
/*
11501148
** Begin a side-box on the right-hand side of a page. The title and
11511149
--- 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

Keyboard Shortcuts

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