Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion l10n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "Diese Freigabe ist auf {limit} Downloads beschränkt. Es sind noch {downloadsLeft} Downloads zugelassen.",
"Deny download": "Download verhindern",
"Name, email": "Name, E-Mail-Adresse",
"Password must be at least 6 characters long": "Passwort muss mindestens 6 Zeichen lang sein"
"Password must be at least 6 characters long": "Passwort muss mindestens 6 Zeichen lang sein",
"Limit needs to be positive number": "Das Limit muss eine positive Zahl sein"
},
"pluralForm": "nplurals=2; plural=(n != 1);"
}
3 changes: 2 additions & 1 deletion l10n/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.": "This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.",
"Deny download": "Deny download",
"Name, email": "Name, email",
"Password must be at least 6 characters long": "Password must be at least 6 characters long"
"Password must be at least 6 characters long": "Password must be at least 6 characters long",
"Limit needs to be positive number": "Limit needs to be positive number"
},
"pluralForm": "nplurals=2; plural=(n != 1);"
}
11 changes: 11 additions & 0 deletions src/components/DownloadLimit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<NcInputField v-if="isLimitEnabled"
type="number"
min="0"
:error="!isValidPositiveInteger"
:helper-text="invalidIntegerError"
:title="downloadsLeftTooltip"
:value.sync="limit"
@update:value="debounceUpdateLimit" />
Expand Down Expand Up @@ -41,6 +43,7 @@
count: null,
token: null,
loading: false,
isValidPositiveInteger: true,
}
},
computed: {
Expand All @@ -50,6 +53,12 @@
return t('nmcsharing', 'This share was limited to {limit} downloads. There is still {downloadsLeft} left allowed.',
{ limit: this.limit, downloadsLeft })
},
invalidIntegerError() {
if (!this.isValidPositiveInteger) {
return t('nmcsharing', 'Limit needs to be positive number')
}
return undefined
}

Check warning on line 61 in src/components/DownloadLimit.vue

View workflow job for this annotation

GitHub Actions / eslint

Missing trailing comma
},
beforeMount() {
this.getInitialData()
Expand Down Expand Up @@ -78,6 +87,8 @@
this.isLimitEnabled = !this.isLimitEnabled
},
debounceUpdateLimit: debounce(300, async function(limit) {
this.isValidPositiveInteger = /^[1-9]\d*$/.test(limit)
this.$emit('limit-changed', !this.isValidPositiveInteger)
this.loading = true

// If the value is not correct, let's remove the limit
Expand Down
7 changes: 6 additions & 1 deletion src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<section>
<NcCheckboxRadioSwitch v-if="isPublicShare"
:disabled="canChangeHideDownload"
:checked.sync="share.hideDownload"

Check warning on line 63 in src/views/SharingDetailsTab.vue

View workflow job for this annotation

GitHub Actions / eslint

Unexpected mutation of "share" prop
@update:checked="queueUpdate('hideDownload')">
{{ t('files_sharing', 'Hide download') }}
</NcCheckboxRadioSwitch>
Expand Down Expand Up @@ -105,7 +105,8 @@
<textarea :value="mutableShare.note" @input="mutableShare.note = $event.target.value" />
</template>
<DownloadLimit v-if="(isLinkShare || isEmailShare) && !isFolder"
@limit-changed="handleLimitChangeEvent"
:share="share"

Check warning on line 109 in src/views/SharingDetailsTab.vue

View workflow job for this annotation

GitHub Actions / eslint

Attribute ":share" should go before "@limit-changed"
:file-info="fileInfo" />
<NcCheckboxRadioSwitch v-if="!isPublicShare && resharingAllowedGlobal"
:checked.sync="allowResharingIsChecked">
Expand All @@ -121,7 +122,7 @@
</NcButton>
<NcButton class="button-details"
type="primary"
:disabled="passwordError"
:disabled="passwordError || limitError"
@click="saveShare">
{{ shareButtonText }}
</NcButton>
Expand Down Expand Up @@ -207,6 +208,7 @@
password: this.share.password,
label: this.share.label,
},
limitError: false
}
},

Expand Down Expand Up @@ -705,6 +707,9 @@

return true
},
handleLimitChangeEvent(payload) {
this.limitError = payload
},
getShareTypeIcon(type) {
switch (type) {
case this.SHARE_TYPES.SHARE_TYPE_LINK:
Expand Down
Loading