Skip to content

Commit

Permalink
Merge pull request #36185 from nextcloud/revert-36177-enh/noid/ext-st…
Browse files Browse the repository at this point in the history
…orage-default-values/stable23

Revert "[stable23] Ext storage configs default value support + enable SSL by default"
  • Loading branch information
blizzz authored Jan 17, 2023
2 parents 487988a + f2b1bd1 commit 01cfab5
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 49 deletions.
8 changes: 0 additions & 8 deletions apps/files_external/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1021,14 +1021,6 @@ MountConfigListView.prototype = _.extend({
newElement = $('<input type="text" class="'+classes.join(' ')+'" data-parameter="'+parameter+'" placeholder="'+ trimmedPlaceholder+'" />');
}

if (placeholder.defaultValue) {
if (placeholder.type === MountConfigListView.ParameterTypes.BOOLEAN) {
newElement.find('input').prop('checked', placeholder.defaultValue);
} else {
newElement.val(placeholder.defaultValue);
}
}

if (placeholder.tooltip) {
newElement.attr('title', placeholder.tooltip);
}
Expand Down
3 changes: 1 addition & 2 deletions apps/files_external/lib/Lib/Backend/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public function __construct(IL10N $l, AccessKey $legacyAuth) {
(new DefinitionParameter('region', $l->t('Region')))
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
(new DefinitionParameter('use_ssl', $l->t('Enable SSL')))
->setType(DefinitionParameter::VALUE_BOOLEAN)
->setDefaultValue(true),
->setType(DefinitionParameter::VALUE_BOOLEAN),
(new DefinitionParameter('use_path_style', $l->t('Enable Path Style')))
->setType(DefinitionParameter::VALUE_BOOLEAN),
(new DefinitionParameter('legacy_auth', $l->t('Legacy (v2) authentication')))
Expand Down
3 changes: 1 addition & 2 deletions apps/files_external/lib/Lib/Backend/DAV.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public function __construct(IL10N $l, Password $legacyAuth) {
(new DefinitionParameter('root', $l->t('Remote subfolder')))
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
(new DefinitionParameter('secure', $l->t('Secure https://')))
->setType(DefinitionParameter::VALUE_BOOLEAN)
->setDefaultValue(true),
->setType(DefinitionParameter::VALUE_BOOLEAN),
])
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
->setLegacyAuthMechanism($legacyAuth)
Expand Down
3 changes: 1 addition & 2 deletions apps/files_external/lib/Lib/Backend/FTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public function __construct(IL10N $l, Password $legacyAuth) {
(new DefinitionParameter('root', $l->t('Remote subfolder')))
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
(new DefinitionParameter('secure', $l->t('Secure ftps://')))
->setType(DefinitionParameter::VALUE_BOOLEAN)
->setDefaultValue(true),
->setType(DefinitionParameter::VALUE_BOOLEAN),
])
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
->setLegacyAuthMechanism($legacyAuth)
Expand Down
3 changes: 1 addition & 2 deletions apps/files_external/lib/Lib/Backend/OwnCloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public function __construct(IL10N $l, Password $legacyAuth) {
(new DefinitionParameter('root', $l->t('Remote subfolder')))
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
(new DefinitionParameter('secure', $l->t('Secure https://')))
->setType(DefinitionParameter::VALUE_BOOLEAN)
->setDefaultValue(true),
->setType(DefinitionParameter::VALUE_BOOLEAN),
])
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
->setLegacyAuthMechanism($legacyAuth)
Expand Down
34 changes: 4 additions & 30 deletions apps/files_external/lib/Lib/DefinitionParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,13 @@ class DefinitionParameter implements \JsonSerializable {
/** @var int flags, see self::FLAG_* constants */
private $flags = self::FLAG_NONE;

/** @var mixed */
private $defaultValue;

/**
* @param string $name parameter name
* @param string $text parameter description
* @param mixed $defaultValue default value
* @param string $name
* @param string $text
*/
public function __construct($name, $text, $defaultValue = null) {
public function __construct($name, $text) {
$this->name = $name;
$this->text = $text;
$this->defaultValue = $defaultValue;
}

/**
Expand Down Expand Up @@ -105,22 +100,6 @@ public function setType($type) {
return $this;
}

/**
* @return mixed default value
*/
public function getDefaultValue() {
return $this->defaultValue;
}

/**
* @param mixed $defaultValue default value
* @return self
*/
public function setDefaultValue($defaultValue) {
$this->defaultValue = $defaultValue;
return $this;
}

/**
* @return string
*/
Expand Down Expand Up @@ -192,17 +171,12 @@ public function setTooltip(string $tooltip) {
* @return string
*/
public function jsonSerialize() {
$result = [
return [
'value' => $this->getText(),
'flags' => $this->getFlags(),
'type' => $this->getType(),
'tooltip' => $this->getTooltip(),
];
$defaultValue = $this->getDefaultValue();
if ($defaultValue) {
$result['defaultValue'] = $defaultValue;
}
return $result;
}

public function isOptional() {
Expand Down
3 changes: 0 additions & 3 deletions apps/files_external/tests/DefinitionParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,15 @@ public function testJsonSerialization() {
], $param->jsonSerialize());

$param->setType(Param::VALUE_BOOLEAN);
$param->setDefaultValue(true);
$this->assertEquals([
'value' => 'bar',
'flags' => 0,
'type' => Param::VALUE_BOOLEAN,
'tooltip' => '',
'defaultValue' => true,
], $param->jsonSerialize());

$param->setType(Param::VALUE_PASSWORD);
$param->setFlag(Param::FLAG_OPTIONAL);
$param->setDefaultValue(null);
$this->assertEquals([
'value' => 'bar',
'flags' => Param::FLAG_OPTIONAL,
Expand Down

0 comments on commit 01cfab5

Please sign in to comment.