Skip to content

Commit 01cfab5

Browse files
authored
Merge pull request #36185 from nextcloud/revert-36177-enh/noid/ext-storage-default-values/stable23
Revert "[stable23] Ext storage configs default value support + enable SSL by default"
2 parents 487988a + f2b1bd1 commit 01cfab5

File tree

7 files changed

+8
-49
lines changed

7 files changed

+8
-49
lines changed

apps/files_external/js/settings.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,14 +1021,6 @@ MountConfigListView.prototype = _.extend({
10211021
newElement = $('<input type="text" class="'+classes.join(' ')+'" data-parameter="'+parameter+'" placeholder="'+ trimmedPlaceholder+'" />');
10221022
}
10231023

1024-
if (placeholder.defaultValue) {
1025-
if (placeholder.type === MountConfigListView.ParameterTypes.BOOLEAN) {
1026-
newElement.find('input').prop('checked', placeholder.defaultValue);
1027-
} else {
1028-
newElement.val(placeholder.defaultValue);
1029-
}
1030-
}
1031-
10321024
if (placeholder.tooltip) {
10331025
newElement.attr('title', placeholder.tooltip);
10341026
}

apps/files_external/lib/Lib/Backend/AmazonS3.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ public function __construct(IL10N $l, AccessKey $legacyAuth) {
4747
(new DefinitionParameter('region', $l->t('Region')))
4848
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
4949
(new DefinitionParameter('use_ssl', $l->t('Enable SSL')))
50-
->setType(DefinitionParameter::VALUE_BOOLEAN)
51-
->setDefaultValue(true),
50+
->setType(DefinitionParameter::VALUE_BOOLEAN),
5251
(new DefinitionParameter('use_path_style', $l->t('Enable Path Style')))
5352
->setType(DefinitionParameter::VALUE_BOOLEAN),
5453
(new DefinitionParameter('legacy_auth', $l->t('Legacy (v2) authentication')))

apps/files_external/lib/Lib/Backend/DAV.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public function __construct(IL10N $l, Password $legacyAuth) {
4343
(new DefinitionParameter('root', $l->t('Remote subfolder')))
4444
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
4545
(new DefinitionParameter('secure', $l->t('Secure https://')))
46-
->setType(DefinitionParameter::VALUE_BOOLEAN)
47-
->setDefaultValue(true),
46+
->setType(DefinitionParameter::VALUE_BOOLEAN),
4847
])
4948
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
5049
->setLegacyAuthMechanism($legacyAuth)

apps/files_external/lib/Lib/Backend/FTP.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public function __construct(IL10N $l, Password $legacyAuth) {
4343
(new DefinitionParameter('root', $l->t('Remote subfolder')))
4444
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
4545
(new DefinitionParameter('secure', $l->t('Secure ftps://')))
46-
->setType(DefinitionParameter::VALUE_BOOLEAN)
47-
->setDefaultValue(true),
46+
->setType(DefinitionParameter::VALUE_BOOLEAN),
4847
])
4948
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
5049
->setLegacyAuthMechanism($legacyAuth)

apps/files_external/lib/Lib/Backend/OwnCloud.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ public function __construct(IL10N $l, Password $legacyAuth) {
4141
(new DefinitionParameter('root', $l->t('Remote subfolder')))
4242
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
4343
(new DefinitionParameter('secure', $l->t('Secure https://')))
44-
->setType(DefinitionParameter::VALUE_BOOLEAN)
45-
->setDefaultValue(true),
44+
->setType(DefinitionParameter::VALUE_BOOLEAN),
4645
])
4746
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
4847
->setLegacyAuthMechanism($legacyAuth)

apps/files_external/lib/Lib/DefinitionParameter.php

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,13 @@ class DefinitionParameter implements \JsonSerializable {
5757
/** @var int flags, see self::FLAG_* constants */
5858
private $flags = self::FLAG_NONE;
5959

60-
/** @var mixed */
61-
private $defaultValue;
62-
6360
/**
64-
* @param string $name parameter name
65-
* @param string $text parameter description
66-
* @param mixed $defaultValue default value
61+
* @param string $name
62+
* @param string $text
6763
*/
68-
public function __construct($name, $text, $defaultValue = null) {
64+
public function __construct($name, $text) {
6965
$this->name = $name;
7066
$this->text = $text;
71-
$this->defaultValue = $defaultValue;
7267
}
7368

7469
/**
@@ -105,22 +100,6 @@ public function setType($type) {
105100
return $this;
106101
}
107102

108-
/**
109-
* @return mixed default value
110-
*/
111-
public function getDefaultValue() {
112-
return $this->defaultValue;
113-
}
114-
115-
/**
116-
* @param mixed $defaultValue default value
117-
* @return self
118-
*/
119-
public function setDefaultValue($defaultValue) {
120-
$this->defaultValue = $defaultValue;
121-
return $this;
122-
}
123-
124103
/**
125104
* @return string
126105
*/
@@ -192,17 +171,12 @@ public function setTooltip(string $tooltip) {
192171
* @return string
193172
*/
194173
public function jsonSerialize() {
195-
$result = [
174+
return [
196175
'value' => $this->getText(),
197176
'flags' => $this->getFlags(),
198177
'type' => $this->getType(),
199178
'tooltip' => $this->getTooltip(),
200179
];
201-
$defaultValue = $this->getDefaultValue();
202-
if ($defaultValue) {
203-
$result['defaultValue'] = $defaultValue;
204-
}
205-
return $result;
206180
}
207181

208182
public function isOptional() {

apps/files_external/tests/DefinitionParameterTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,15 @@ public function testJsonSerialization() {
3636
], $param->jsonSerialize());
3737

3838
$param->setType(Param::VALUE_BOOLEAN);
39-
$param->setDefaultValue(true);
4039
$this->assertEquals([
4140
'value' => 'bar',
4241
'flags' => 0,
4342
'type' => Param::VALUE_BOOLEAN,
4443
'tooltip' => '',
45-
'defaultValue' => true,
4644
], $param->jsonSerialize());
4745

4846
$param->setType(Param::VALUE_PASSWORD);
4947
$param->setFlag(Param::FLAG_OPTIONAL);
50-
$param->setDefaultValue(null);
5148
$this->assertEquals([
5249
'value' => 'bar',
5350
'flags' => Param::FLAG_OPTIONAL,

0 commit comments

Comments
 (0)