clean protection for 100%
This commit is contained in:
parent
833fdee69e
commit
bff2f6a642
@ -23,7 +23,7 @@
|
|||||||
"syncrun_shortstep2skip": "2/2 Remotely Save real sync is skipped in dry run mode.",
|
"syncrun_shortstep2skip": "2/2 Remotely Save real sync is skipped in dry run mode.",
|
||||||
"syncrun_shortstep2": "2/2 Remotely Save finished!",
|
"syncrun_shortstep2": "2/2 Remotely Save finished!",
|
||||||
"syncrun_abort": "{{manifestID}}-{{theDate}}: abort sync, triggerSource={{triggerSource}}, error while {{syncStatus}}",
|
"syncrun_abort": "{{manifestID}}-{{theDate}}: abort sync, triggerSource={{triggerSource}}, error while {{syncStatus}}",
|
||||||
"syncrun_abort_protectmodifypercentage": "Abort! you set changing files >= {{protectModifyPercentage}}% is not allowed but {{realModifyDeleteCount}}/{{allFilesCount}}={{percent}}% is going to be modified or deleted! If you are sure you want this sync, please adjust the allowed ratio in the settings.",
|
"syncrun_abort_protectmodifypercentage": "Abort! you set changing files >= {{protectModifyPercentage}}% is not allowed but {{realModifyDeleteCount}}/{{allFilesCount}}={{percent}}% is going to be modified or deleted! If you are sure you want this sync, please adjust the allowed ratio in the settings.",
|
||||||
"protocol_saveqr": "New not-oauth2 settings for {{manifestName}} is saved. Reopen the plugin settings to make it effective.",
|
"protocol_saveqr": "New not-oauth2 settings for {{manifestName}} is saved. Reopen the plugin settings to make it effective.",
|
||||||
"protocol_callbacknotsupported": "Your uri calls a callback that's not supported yet: {{params}}",
|
"protocol_callbacknotsupported": "Your uri calls a callback that's not supported yet: {{params}}",
|
||||||
"protocol_dropbox_connecting": "Connecting to Dropbox...\nPlease DO NOT close this modal.",
|
"protocol_dropbox_connecting": "Connecting to Dropbox...\nPlease DO NOT close this modal.",
|
||||||
|
|||||||
12
src/sync.ts
12
src/sync.ts
@ -888,7 +888,7 @@ const splitThreeStepsOnEntityMappings = (
|
|||||||
}
|
}
|
||||||
realTotalCount += 1;
|
realTotalCount += 1;
|
||||||
|
|
||||||
if (val.decision.startsWith("deleted")) {
|
if (val.decision.includes("deleted")) {
|
||||||
realModifyDeleteCount += 1;
|
realModifyDeleteCount += 1;
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
@ -915,8 +915,8 @@ const splitThreeStepsOnEntityMappings = (
|
|||||||
realTotalCount += 1;
|
realTotalCount += 1;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
val.decision.startsWith("modified") ||
|
val.decision.includes("modified") ||
|
||||||
val.decision.startsWith("conflict")
|
val.decision.includes("conflict")
|
||||||
) {
|
) {
|
||||||
realModifyDeleteCount += 1;
|
realModifyDeleteCount += 1;
|
||||||
}
|
}
|
||||||
@ -1115,6 +1115,12 @@ export const doActualSync = async (
|
|||||||
allFilesCount > 0
|
allFilesCount > 0
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
|
protectModifyPercentage === 100 &&
|
||||||
|
realModifyDeleteCount === allFilesCount
|
||||||
|
) {
|
||||||
|
// special treatment for 100%
|
||||||
|
// let it pass, we do nothing here
|
||||||
|
} else if (
|
||||||
realModifyDeleteCount * 100 >=
|
realModifyDeleteCount * 100 >=
|
||||||
allFilesCount * protectModifyPercentage
|
allFilesCount * protectModifyPercentage
|
||||||
) {
|
) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user