Skip to content

Commit b01631e

Browse files
author
olysenko
committed
MAGETWO-66212: Re-subscribe after M2 token was lost at server-side
1 parent aa376c5 commit b01631e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Activate.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ public function execute()
9898
$configValue = $this->preparedValueFactory->create(
9999
Enabled::XML_ENABLED_CONFIG_STRUCTURE_PATH,
100100
Enabledisable::ENABLE_VALUE,
101-
ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
102-
0
101+
ScopeConfigInterface::SCOPE_TYPE_DEFAULT
103102
);
104103

105104
$this->configValueResource

app/code/Magento/Config/Model/PreparedValueFactory.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ public function create($path, $value, $scope, $scopeCode = null)
7575
try {
7676
/** @var Structure $structure */
7777
$structure = $this->structureFactory->create();
78+
$backendModel = $this->valueFactory->create();
7879
/** @var Structure\ElementInterface $field */
7980
$field = $structure->getElement($path);
80-
/** @var ValueInterface $backendModel */
81-
$backendModel = $field instanceof Structure\Element\Field && $field->hasBackendModel()
82-
? $field->getBackendModel()
83-
: $this->valueFactory->create();
81+
if ($field instanceof Structure\Element\Field && $field->hasBackendModel()) {
82+
$backendModel = $field->getBackendModel();
83+
$path = $field->getConfigPath() ?: $path;
84+
}
8485

8586
if ($backendModel instanceof Value) {
8687
$scopeId = 0;

app/code/Magento/Config/Test/Unit/Model/PreparedValueFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function testCreate(
146146
$this->fieldMock->expects($this->once())
147147
->method('getBackendModel')
148148
->willReturn($this->valueMock);
149-
$this->valueFactoryMock->expects($this->never())
149+
$this->valueFactoryMock->expects($this->once())
150150
->method('create')
151151
->willReturn($this->valueMock);
152152
$this->valueMock->expects($this->once())

0 commit comments

Comments
 (0)