Skip to content

Commit eee7c5e

Browse files
committed
fix review comments
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent f1867a4 commit eee7c5e

5 files changed

Lines changed: 24 additions & 42 deletions

File tree

lib/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Constants {
4343
self::CONFIG_KEY_CONFIRMATIONEMAILRATELIMIT => 'int',
4444
];
4545

46-
public const PUBLIC_SHARE_TOKEN_MIN_LENGTH = 8;
46+
public const PUBLIC_SHARE_TOKEN_MIN_LENGTH = 1;
4747
public const PUBLIC_SHARE_TOKEN_MAX_LENGTH = 256;
4848
public const PUBLIC_SHARE_HASH_REQUIREMENT = '[a-zA-Z0-9]{' . self::PUBLIC_SHARE_TOKEN_MIN_LENGTH . ',' . self::PUBLIC_SHARE_TOKEN_MAX_LENGTH . '}';
4949

lib/Controller/ShareApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public function updateShare(int $formId, int $shareId, array $keyValuePairs): Da
296296
$existingShare = $this->shareMapper->findPublicShareByHash($token);
297297
if ($existingShare->getId() !== $formShare->getId()) {
298298
$this->logger->debug('Share hash already exists.');
299-
throw new OCSBadRequestException('Share hash exists, please retry.');
299+
throw new OCSBadRequestException('Invalid share token');
300300
}
301301
} catch (DoesNotExistException $e) {
302302
// Just continue, this is what we expect to happen (share hash not existing yet).

lib/Service/ConfigService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getAllowPublicLink(): bool {
3939
return $this->appConfig->getAppValueBool(Constants::CONFIG_KEY_ALLOWPUBLICLINK, true);
4040
}
4141
public function getAllowCustomPublicToken(): bool {
42-
return json_decode($this->config->getAppValue($this->appName, Constants::CONFIG_KEY_ALLOWCUSTOMPUBLICTOKEN, 'false'));
42+
return $this->appConfig->getAppValueBool(Constants::CONFIG_KEY_ALLOWCUSTOMPUBLICTOKEN, false);
4343
}
4444
public function getAllowShowToAll(): bool {
4545
return $this->appConfig->getAppValueBool(Constants::CONFIG_KEY_ALLOWSHOWTOALL, true);

src/FormsSettings.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,13 @@
7373
{{ t('forms', 'Allow sharing by link') }}
7474
</NcCheckboxRadioSwitch>
7575
<NcCheckboxRadioSwitch
76-
ref="switchAllowCustomPublicShareTokens"
7776
v-model="appConfig.allowCustomPublicShareTokens"
77+
:loading="loading.allowCustomPublicShareTokens"
7878
type="switch"
7979
@update:modelValue="onAllowCustomPublicShareTokensChange">
8080
{{ t('forms', 'Allow custom public share tokens') }}
8181
</NcCheckboxRadioSwitch>
8282
<NcCheckboxRadioSwitch
83-
ref="switchAllowPermitAll"
8483
v-model="appConfig.allowPermitAll"
8584
:loading="loading.allowPermitAll"
8685
type="switch"
@@ -176,14 +175,13 @@ export default {
176175
async onAllowPublicLinkChange(newVal) {
177176
this.loading.allowPublicLink = true
178177
await this.saveAppConfig('allowPublicLink', newVal)
179-
el.loading = false
178+
this.loading.allowPublicLink = false
180179
},
181180
182181
async onAllowCustomPublicShareTokensChange(newVal) {
183-
const el = this.$refs.switchAllowCustomPublicShareTokens
184-
el.loading = true
182+
this.loading.allowCustomPublicShareTokens = true
185183
await this.saveAppConfig('allowCustomPublicShareTokens', newVal)
186-
el.loading = false
184+
this.loading.allowCustomPublicShareTokens = false
187185
},
188186
189187
async onAllowPermitAllChange(newVal) {

src/components/SidebarTabs/SharingSidebarTab.vue

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@
231231

232232
<script>
233233
import IconPlus from '@material-symbols/svg-400/outlined/add.svg?raw'
234+
import IconCheck from '@material-symbols/svg-400/outlined/check.svg?raw'
234235
import IconCodeBrackets from '@material-symbols/svg-400/outlined/code.svg?raw'
235236
import IconCopyAll from '@material-symbols/svg-400/outlined/copy_all.svg?raw'
236237
import IconDelete from '@material-symbols/svg-400/outlined/delete.svg?raw'
@@ -250,14 +251,6 @@ import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwit
250251
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
251252
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
252253
import NcTextField from '@nextcloud/vue/components/NcTextField'
253-
import IconAccountMultiple from 'vue-material-design-icons/AccountMultipleOutline.vue'
254-
import IconCheck from 'vue-material-design-icons/Check.vue'
255-
import IconCodeBrackets from 'vue-material-design-icons/CodeBrackets.vue'
256-
import IconLinkVariant from 'vue-material-design-icons/Link.vue'
257-
import IconLinkBoxVariantOutline from 'vue-material-design-icons/LinkBoxOutline.vue'
258-
import IconPlus from 'vue-material-design-icons/Plus.vue'
259-
import IconQr from 'vue-material-design-icons/Qrcode.vue'
260-
import IconDelete from 'vue-material-design-icons/TrashCanOutline.vue'
261254
import FormsIcon from '../Icons/FormsIcon.vue'
262255
import IconCopyAll from '../Icons/IconCopyAll.vue'
263256
import QRDialog from '../QRDialog.vue'
@@ -273,16 +266,6 @@ import OcsResponse2Data from '../../utils/OcsResponse2Data.js'
273266
export default {
274267
components: {
275268
NcIconSvgWrapper,
276-
FormsIcon,
277-
IconAccountMultiple,
278-
IconCheck,
279-
IconCodeBrackets,
280-
IconCopyAll,
281-
IconDelete,
282-
IconLinkBoxVariantOutline,
283-
IconLinkVariant,
284-
IconPlus,
285-
IconQr,
286269
NcActions,
287270
NcActionButton,
288271
NcActionLink,
@@ -318,6 +301,7 @@ export default {
318301
setup() {
319302
return {
320303
FormsIcon,
304+
IconCheck,
321305
IconCopyAll,
322306
IconPlus,
323307
IconCodeBrackets,
@@ -339,21 +323,6 @@ export default {
339323
}
340324
},
341325
342-
watch: {
343-
publicLinkShares: {
344-
immediate: true,
345-
handler(shares) {
346-
const nextShareTokens = {}
347-
for (const share of shares) {
348-
nextShareTokens[share.id] =
349-
this.shareTokens[share.id] ?? share.shareWith
350-
}
351-
352-
this.shareTokens = nextShareTokens
353-
},
354-
},
355-
},
356-
357326
computed: {
358327
isCurrentUserOwner() {
359328
return getCurrentUser().uid === this.form.ownerId
@@ -383,6 +352,21 @@ export default {
383352
},
384353
},
385354
355+
watch: {
356+
publicLinkShares: {
357+
immediate: true,
358+
handler(shares) {
359+
const nextShareTokens = {}
360+
for (const share of shares) {
361+
nextShareTokens[share.id] =
362+
this.shareTokens[share.id] ?? share.shareWith
363+
}
364+
365+
this.shareTokens = nextShareTokens
366+
},
367+
},
368+
},
369+
386370
methods: {
387371
/**
388372
* Add share

0 commit comments

Comments
 (0)