Fossil SCM
Doc updates. Fix the (harmless but annoying) warning in the file attachment about the attachment being too large if the attachment-size-limit is not set or is set to 0.
Commit
f6785741d98573e7175c34b81156df39cc503b7dffd59da220da1c3c1ef290b3
Parent
77c3ce12e94cfb3…
2 files changed
+2
-1
+18
-11
+2
-1
| --- src/fossil.attach.js | ||
| +++ src/fossil.attach.js | ||
| @@ -504,11 +504,12 @@ | ||
| 504 | 504 | img.classList.add('thumbnail'); |
| 505 | 505 | const reader = new FileReader(); |
| 506 | 506 | reader.onload = (e)=>img.setAttribute('src', e.target.result); |
| 507 | 507 | reader.readAsDataURL(file); |
| 508 | 508 | } |
| 509 | - if( file.size>F.config.attachmentSizeLimit ){ | |
| 509 | + if( F.config.attachmentSizeLimit>0 | |
| 510 | + && file.size>F.config.attachmentSizeLimit ){ | |
| 510 | 511 | /* Problem: tapping this link propagates its click event through |
| 511 | 512 | to eDropzone. Thus... */ |
| 512 | 513 | const eLink = D.a(F.repoUrl('help/attachment-size-limit'),'limit'); |
| 513 | 514 | eLink.addEventListener('click', ev=>ev.stopPropagation()); |
| 514 | 515 | this.#rowError(rowObj, "Too large: ", eLink, |
| 515 | 516 |
| --- src/fossil.attach.js | |
| +++ src/fossil.attach.js | |
| @@ -504,11 +504,12 @@ | |
| 504 | img.classList.add('thumbnail'); |
| 505 | const reader = new FileReader(); |
| 506 | reader.onload = (e)=>img.setAttribute('src', e.target.result); |
| 507 | reader.readAsDataURL(file); |
| 508 | } |
| 509 | if( file.size>F.config.attachmentSizeLimit ){ |
| 510 | /* Problem: tapping this link propagates its click event through |
| 511 | to eDropzone. Thus... */ |
| 512 | const eLink = D.a(F.repoUrl('help/attachment-size-limit'),'limit'); |
| 513 | eLink.addEventListener('click', ev=>ev.stopPropagation()); |
| 514 | this.#rowError(rowObj, "Too large: ", eLink, |
| 515 |
| --- src/fossil.attach.js | |
| +++ src/fossil.attach.js | |
| @@ -504,11 +504,12 @@ | |
| 504 | img.classList.add('thumbnail'); |
| 505 | const reader = new FileReader(); |
| 506 | reader.onload = (e)=>img.setAttribute('src', e.target.result); |
| 507 | reader.readAsDataURL(file); |
| 508 | } |
| 509 | if( F.config.attachmentSizeLimit>0 |
| 510 | && file.size>F.config.attachmentSizeLimit ){ |
| 511 | /* Problem: tapping this link propagates its click event through |
| 512 | to eDropzone. Thus... */ |
| 513 | const eLink = D.a(F.repoUrl('help/attachment-size-limit'),'limit'); |
| 514 | eLink.addEventListener('click', ev=>ev.stopPropagation()); |
| 515 | this.#rowError(rowObj, "Too large: ", eLink, |
| 516 |
+18
-11
| --- src/fossil.page.forumpost.js | ||
| +++ src/fossil.page.forumpost.js | ||
| @@ -28,18 +28,18 @@ | ||
| 28 | 28 | padding when none are active. */ |
| 29 | 29 | dummyPadding.refs = new Set(); |
| 30 | 30 | F.dummyPadding = dummyPadding /* only for debugging */; |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - A WIP forum post editor widget for both new posts and responses. | |
| 33 | + A forum post editor widget for new posts and responses. | |
| 34 | 34 | */ |
| 35 | 35 | class ForumPostEditor { |
| 36 | 36 | /* Options */ |
| 37 | 37 | #opt; |
| 38 | 38 | /* Dom elements */ |
| 39 | 39 | #e; |
| 40 | - /* Attacher */ | |
| 40 | + /* F.Attacher instance */ | |
| 41 | 41 | #att; |
| 42 | 42 | /* Is waiting on a pending remote response. */ |
| 43 | 43 | #isWaiting = false; |
| 44 | 44 | /* F.TabManager */ |
| 45 | 45 | #tabs; |
| @@ -914,11 +914,16 @@ | ||
| 914 | 914 | const eStatus = document.querySelector( |
| 915 | 915 | 'form div.submenu select.submenuctrl[name="status"]' |
| 916 | 916 | ); |
| 917 | 917 | if( eStatus ){ |
| 918 | 918 | /* Main /forum list. Remove the 'x' form element when eStatus |
| 919 | - ** changes, to avoid propagating x when changing the filter. */ | |
| 919 | + changes, to avoid propagating x when changing the filter. | |
| 920 | + The problem this solves: we're browsed to page 3 of status X. | |
| 921 | + We change the status filter selection to Y. We're redirected | |
| 922 | + to page x, but Y only has 2 posts with that status, so we see | |
| 923 | + an empty list. When changing the filter, we need to ensure | |
| 924 | + that we start back and that beginning. */ | |
| 920 | 925 | const pForm = eStatus.parentElement?.parentElement; |
| 921 | 926 | if( pForm ){ |
| 922 | 927 | eStatus.addEventListener('change', ()=>{ |
| 923 | 928 | pForm.querySelector('input[type="hidden"][name="x"]')?.remove?.(); |
| 924 | 929 | }, true); |
| @@ -935,12 +940,14 @@ | ||
| 935 | 940 | return; |
| 936 | 941 | } |
| 937 | 942 | form.dataset.submitted = '1'; |
| 938 | 943 | /** If the user is left waiting "a long time," disable the |
| 939 | 944 | resubmit protection. If we don't do this and they tap the |
| 940 | - browser's cancel button while waiting, they'll be stuck with | |
| 941 | - an unsubmittable form. */ | |
| 945 | + browser's cancel button while waiting, they'll be stuck | |
| 946 | + with an unsubmittable form. It can apparently also happen, | |
| 947 | + via browser-back, that the form gets left in a submitted | |
| 948 | + state. */ | |
| 942 | 949 | setTimeout(()=>{delete form.dataset.submitted}, 7000); |
| 943 | 950 | return; |
| 944 | 951 | }; |
| 945 | 952 | |
| 946 | 953 | document.querySelectorAll("form").forEach(function(form){ |
| @@ -1277,21 +1284,21 @@ | ||
| 1277 | 1284 | |
| 1278 | 1285 | document.body.querySelectorAll( |
| 1279 | 1286 | '.forumpost-single-controls > form' |
| 1280 | 1287 | ).forEach(form=>{ |
| 1281 | 1288 | /* For each forum post... */ |
| 1289 | + const eThePost = form.parentElement.parentElement/*main post DOM element*/; | |
| 1290 | + if( !eThePost?.dataset?.fpid ){ | |
| 1291 | + /* The server injects these dataset values. */ | |
| 1292 | + console.warn("Unexpected missing fpid", eThePost); | |
| 1293 | + return; | |
| 1294 | + } | |
| 1282 | 1295 | const eToDisable = [ |
| 1283 | 1296 | /* List of non-editor DOM elements which need to be disabled |
| 1284 | 1297 | while the editor is active and re-enabled when it |
| 1285 | 1298 | closes. */ |
| 1286 | 1299 | ]; |
| 1287 | - const eThePost = form.parentElement.parentElement/*main post DOM element*/; | |
| 1288 | - if( !eThePost?.dataset?.fpid ){ | |
| 1289 | - /* The server injects these. */ | |
| 1290 | - console.warn("Unexpected missing fpid", eThePost); | |
| 1291 | - return; | |
| 1292 | - } | |
| 1293 | 1300 | |
| 1294 | 1301 | const checkButtonForDraft = (draftKeyPrefix, eBtn)=>{ |
| 1295 | 1302 | /* If a draft is found associated with eThePost, mark eBtn |
| 1296 | 1303 | as a draft and set up storage event listeners to update |
| 1297 | 1304 | the button as new drafts come and go. */ |
| 1298 | 1305 |
| --- src/fossil.page.forumpost.js | |
| +++ src/fossil.page.forumpost.js | |
| @@ -28,18 +28,18 @@ | |
| 28 | padding when none are active. */ |
| 29 | dummyPadding.refs = new Set(); |
| 30 | F.dummyPadding = dummyPadding /* only for debugging */; |
| 31 | |
| 32 | /** |
| 33 | A WIP forum post editor widget for both new posts and responses. |
| 34 | */ |
| 35 | class ForumPostEditor { |
| 36 | /* Options */ |
| 37 | #opt; |
| 38 | /* Dom elements */ |
| 39 | #e; |
| 40 | /* Attacher */ |
| 41 | #att; |
| 42 | /* Is waiting on a pending remote response. */ |
| 43 | #isWaiting = false; |
| 44 | /* F.TabManager */ |
| 45 | #tabs; |
| @@ -914,11 +914,16 @@ | |
| 914 | const eStatus = document.querySelector( |
| 915 | 'form div.submenu select.submenuctrl[name="status"]' |
| 916 | ); |
| 917 | if( eStatus ){ |
| 918 | /* Main /forum list. Remove the 'x' form element when eStatus |
| 919 | ** changes, to avoid propagating x when changing the filter. */ |
| 920 | const pForm = eStatus.parentElement?.parentElement; |
| 921 | if( pForm ){ |
| 922 | eStatus.addEventListener('change', ()=>{ |
| 923 | pForm.querySelector('input[type="hidden"][name="x"]')?.remove?.(); |
| 924 | }, true); |
| @@ -935,12 +940,14 @@ | |
| 935 | return; |
| 936 | } |
| 937 | form.dataset.submitted = '1'; |
| 938 | /** If the user is left waiting "a long time," disable the |
| 939 | resubmit protection. If we don't do this and they tap the |
| 940 | browser's cancel button while waiting, they'll be stuck with |
| 941 | an unsubmittable form. */ |
| 942 | setTimeout(()=>{delete form.dataset.submitted}, 7000); |
| 943 | return; |
| 944 | }; |
| 945 | |
| 946 | document.querySelectorAll("form").forEach(function(form){ |
| @@ -1277,21 +1284,21 @@ | |
| 1277 | |
| 1278 | document.body.querySelectorAll( |
| 1279 | '.forumpost-single-controls > form' |
| 1280 | ).forEach(form=>{ |
| 1281 | /* For each forum post... */ |
| 1282 | const eToDisable = [ |
| 1283 | /* List of non-editor DOM elements which need to be disabled |
| 1284 | while the editor is active and re-enabled when it |
| 1285 | closes. */ |
| 1286 | ]; |
| 1287 | const eThePost = form.parentElement.parentElement/*main post DOM element*/; |
| 1288 | if( !eThePost?.dataset?.fpid ){ |
| 1289 | /* The server injects these. */ |
| 1290 | console.warn("Unexpected missing fpid", eThePost); |
| 1291 | return; |
| 1292 | } |
| 1293 | |
| 1294 | const checkButtonForDraft = (draftKeyPrefix, eBtn)=>{ |
| 1295 | /* If a draft is found associated with eThePost, mark eBtn |
| 1296 | as a draft and set up storage event listeners to update |
| 1297 | the button as new drafts come and go. */ |
| 1298 |
| --- src/fossil.page.forumpost.js | |
| +++ src/fossil.page.forumpost.js | |
| @@ -28,18 +28,18 @@ | |
| 28 | padding when none are active. */ |
| 29 | dummyPadding.refs = new Set(); |
| 30 | F.dummyPadding = dummyPadding /* only for debugging */; |
| 31 | |
| 32 | /** |
| 33 | A forum post editor widget for new posts and responses. |
| 34 | */ |
| 35 | class ForumPostEditor { |
| 36 | /* Options */ |
| 37 | #opt; |
| 38 | /* Dom elements */ |
| 39 | #e; |
| 40 | /* F.Attacher instance */ |
| 41 | #att; |
| 42 | /* Is waiting on a pending remote response. */ |
| 43 | #isWaiting = false; |
| 44 | /* F.TabManager */ |
| 45 | #tabs; |
| @@ -914,11 +914,16 @@ | |
| 914 | const eStatus = document.querySelector( |
| 915 | 'form div.submenu select.submenuctrl[name="status"]' |
| 916 | ); |
| 917 | if( eStatus ){ |
| 918 | /* Main /forum list. Remove the 'x' form element when eStatus |
| 919 | changes, to avoid propagating x when changing the filter. |
| 920 | The problem this solves: we're browsed to page 3 of status X. |
| 921 | We change the status filter selection to Y. We're redirected |
| 922 | to page x, but Y only has 2 posts with that status, so we see |
| 923 | an empty list. When changing the filter, we need to ensure |
| 924 | that we start back and that beginning. */ |
| 925 | const pForm = eStatus.parentElement?.parentElement; |
| 926 | if( pForm ){ |
| 927 | eStatus.addEventListener('change', ()=>{ |
| 928 | pForm.querySelector('input[type="hidden"][name="x"]')?.remove?.(); |
| 929 | }, true); |
| @@ -935,12 +940,14 @@ | |
| 940 | return; |
| 941 | } |
| 942 | form.dataset.submitted = '1'; |
| 943 | /** If the user is left waiting "a long time," disable the |
| 944 | resubmit protection. If we don't do this and they tap the |
| 945 | browser's cancel button while waiting, they'll be stuck |
| 946 | with an unsubmittable form. It can apparently also happen, |
| 947 | via browser-back, that the form gets left in a submitted |
| 948 | state. */ |
| 949 | setTimeout(()=>{delete form.dataset.submitted}, 7000); |
| 950 | return; |
| 951 | }; |
| 952 | |
| 953 | document.querySelectorAll("form").forEach(function(form){ |
| @@ -1277,21 +1284,21 @@ | |
| 1284 | |
| 1285 | document.body.querySelectorAll( |
| 1286 | '.forumpost-single-controls > form' |
| 1287 | ).forEach(form=>{ |
| 1288 | /* For each forum post... */ |
| 1289 | const eThePost = form.parentElement.parentElement/*main post DOM element*/; |
| 1290 | if( !eThePost?.dataset?.fpid ){ |
| 1291 | /* The server injects these dataset values. */ |
| 1292 | console.warn("Unexpected missing fpid", eThePost); |
| 1293 | return; |
| 1294 | } |
| 1295 | const eToDisable = [ |
| 1296 | /* List of non-editor DOM elements which need to be disabled |
| 1297 | while the editor is active and re-enabled when it |
| 1298 | closes. */ |
| 1299 | ]; |
| 1300 | |
| 1301 | const checkButtonForDraft = (draftKeyPrefix, eBtn)=>{ |
| 1302 | /* If a draft is found associated with eThePost, mark eBtn |
| 1303 | as a draft and set up storage event listeners to update |
| 1304 | the button as new drafts come and go. */ |
| 1305 |