Skip to content

Commit b49447b

Browse files
author
Stanislav Idolov
authored
🔃 [EngCom] Public Pull Requests - 2.1-develop
Accepted Public Pull Requests: - #16619: [Backport] Login with wishlist raise report after logout (by @ronak2ram) - #17179: [Backport] Fix newsletter subscription behaviour for registered customer. (by @mage2pratik) - #16911: [Backport] Fixed extends and removed unnecessary variables (by @gelanivishal)
2 parents 15b9b26 + 0883bbb commit b49447b

File tree

7 files changed

+22
-32
lines changed

7 files changed

+22
-32
lines changed

app/code/Magento/Customer/Model/Plugin/CustomerFlushFormKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function aroundExecute(FlushFormKey $subject, callable $proceed, Observer
4747
$currentFormKey = $this->dataFormKey->getFormKey();
4848
$proceed($observer);
4949
$beforeParams = $this->session->getBeforeRequestParams();
50-
if ($beforeParams['form_key'] == $currentFormKey) {
50+
if (isset($beforeParams['form_key']) && $beforeParams['form_key'] === $currentFormKey) {
5151
$beforeParams['form_key'] = $this->dataFormKey->getFormKey();
5252
$this->session->setBeforeRequestParams($beforeParams);
5353
}

app/code/Magento/Newsletter/Model/Subscriber.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ public function subscribe($email)
417417
self::XML_PATH_CONFIRMATION_FLAG,
418418
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
419419
) == 1 ? true : false;
420-
$isOwnSubscribes = false;
421420

422421
$isSubscribeOwnEmail = $this->_customerSession->isLoggedIn()
423422
&& $this->_customerSession->getCustomerDataObject()->getEmail() == $email;
@@ -426,13 +425,7 @@ public function subscribe($email)
426425
|| $this->getStatus() == self::STATUS_NOT_ACTIVE
427426
) {
428427
if ($isConfirmNeed === true) {
429-
// if user subscribes own login email - confirmation is not needed
430-
$isOwnSubscribes = $isSubscribeOwnEmail;
431-
if ($isOwnSubscribes == true) {
432-
$this->setStatus(self::STATUS_SUBSCRIBED);
433-
} else {
434-
$this->setStatus(self::STATUS_NOT_ACTIVE);
435-
}
428+
$this->setStatus(self::STATUS_NOT_ACTIVE);
436429
} else {
437430
$this->setStatus(self::STATUS_SUBSCRIBED);
438431
}
@@ -458,9 +451,7 @@ public function subscribe($email)
458451
try {
459452
/* Save model before sending out email */
460453
$this->save();
461-
if ($isConfirmNeed === true
462-
&& $isOwnSubscribes === false
463-
) {
454+
if ($isConfirmNeed === true) {
464455
$this->sendConfirmationRequestEmail();
465456
} else {
466457
$this->sendConfirmationSuccessEmail();

app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Newsletter\Test\Unit\Model;
77

8+
use Magento\Newsletter\Model\Subscriber;
9+
810
/**
911
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1012
*/
@@ -134,7 +136,7 @@ public function testSubscribe()
134136
$email = '[email protected]';
135137
$this->resource->expects($this->any())->method('loadByEmail')->willReturn(
136138
[
137-
'subscriber_status' => 3,
139+
'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED,
138140
'subscriber_email' => $email,
139141
'name' => 'subscriber_name'
140142
]
@@ -151,15 +153,15 @@ public function testSubscribe()
151153
$this->sendEmailCheck();
152154
$this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf();
153155

154-
$this->assertEquals(1, $this->subscriber->subscribe($email));
156+
$this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->subscribe($email));
155157
}
156158

157159
public function testSubscribeNotLoggedIn()
158160
{
159161
$email = '[email protected]';
160162
$this->resource->expects($this->any())->method('loadByEmail')->willReturn(
161163
[
162-
'subscriber_status' => 3,
164+
'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED,
163165
'subscriber_email' => $email,
164166
'name' => 'subscriber_name'
165167
]
@@ -176,7 +178,7 @@ public function testSubscribeNotLoggedIn()
176178
$this->sendEmailCheck();
177179
$this->resource->expects($this->atLeastOnce())->method('save')->willReturnSelf();
178180

179-
$this->assertEquals(2, $this->subscriber->subscribe($email));
181+
$this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->subscribe($email));
180182
}
181183

182184
public function testUpdateSubscription()
@@ -193,7 +195,7 @@ public function testUpdateSubscription()
193195
->willReturn(
194196
[
195197
'subscriber_id' => 1,
196-
'subscriber_status' => 1
198+
'subscriber_status' => Subscriber::STATUS_SUBSCRIBED
197199
]
198200
);
199201
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -228,7 +230,7 @@ public function testUnsubscribeCustomerById()
228230
->willReturn(
229231
[
230232
'subscriber_id' => 1,
231-
'subscriber_status' => 1
233+
'subscriber_status' => Subscriber::STATUS_SUBSCRIBED
232234
]
233235
);
234236
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -254,7 +256,7 @@ public function testSubscribeCustomerById()
254256
->willReturn(
255257
[
256258
'subscriber_id' => 1,
257-
'subscriber_status' => 3
259+
'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED
258260
]
259261
);
260262
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -280,7 +282,7 @@ public function testSubscribeCustomerById1()
280282
->willReturn(
281283
[
282284
'subscriber_id' => 1,
283-
'subscriber_status' => 3
285+
'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED
284286
]
285287
);
286288
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -294,7 +296,7 @@ public function testSubscribeCustomerById1()
294296
$this->scopeConfig->expects($this->atLeastOnce())->method('getValue')->with()->willReturn(true);
295297

296298
$this->subscriber->subscribeCustomerById($customerId);
297-
$this->assertEquals(\Magento\Newsletter\Model\Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->getStatus());
299+
$this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->subscriber->getStatus());
298300
}
299301

300302
public function testSubscribeCustomerByIdAfterConfirmation()
@@ -311,7 +313,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
311313
->willReturn(
312314
[
313315
'subscriber_id' => 1,
314-
'subscriber_status' => 4
316+
'subscriber_status' => Subscriber::STATUS_UNCONFIRMED
315317
]
316318
);
317319
$customerDataMock->expects($this->atLeastOnce())->method('getId')->willReturn('id');
@@ -323,7 +325,7 @@ public function testSubscribeCustomerByIdAfterConfirmation()
323325
$this->scopeConfig->expects($this->atLeastOnce())->method('getValue')->with()->willReturn(true);
324326

325327
$this->subscriber->updateSubscription($customerId);
326-
$this->assertEquals(\Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED, $this->subscriber->getStatus());
328+
$this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $this->subscriber->getStatus());
327329
}
328330

329331
public function testUnsubscribe()

app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_tooltip.less

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// _____________________________________________
99

1010
@checkout-tooltip__hover__z-index: @tooltip__z-index;
11-
@checkout-tooltip-breakpoint__screen-m: @modal-popup-breakpoint-screen__m;
1211

1312
@checkout-tooltip-icon-arrow__font-size: 10px;
1413
@checkout-tooltip-icon-arrow__left: -( @checkout-tooltip-content__padding + @checkout-tooltip-icon-arrow__font-size - @checkout-tooltip-content__border-width);
@@ -138,7 +137,7 @@
138137
}
139138
}
140139

141-
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @checkout-tooltip-breakpoint__screen-m) {
140+
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
142141
.field-tooltip {
143142
.field-tooltip-content {
144143
&:extend(.abs-checkout-tooltip-content-position-top-mobile all);

app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
}
263263

264264
.toolbar {
265-
&:extend(.abs-add-clearfix-desktop all);
265+
&:extend(.abs-add-clearfix-mobile all);
266266

267267
.pages {
268268
float: right;

app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
@modal-popup-title__font-size: 26px;
1818
@modal-popup-title-mobile__font-size: @font-size__base;
19-
@modal-popup-breakpoint-screen__m: @screen__m;
2019

2120
@modal-slide__first__indent-left: 44px;
2221
@modal-slide-mobile__background-color: @color-gray-light01;
@@ -151,7 +150,7 @@
151150
}
152151
}
153152

154-
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @modal-popup-breakpoint-screen__m) {
153+
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
155154
.modal-popup {
156155
&.modal-slide {
157156
.modal-inner-wrap[class] {
@@ -182,7 +181,7 @@
182181
// Desktop
183182
// _____________________________________________
184183

185-
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @modal-popup-breakpoint-screen__m) {
184+
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
186185
.modal-popup {
187186
&.modal-slide {
188187
.modal-footer {

app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
@modal-popup-title__font-size: 26px;
1818
@modal-popup-title-mobile__font-size: @font-size__base;
19-
@modal-popup-breakpoint-screen__m: @screen__m;
2019

2120
@modal-slide__first__indent-left: 44px;
2221
@modal-slide-mobile__background-color: @color-gray-light01;
@@ -150,7 +149,7 @@
150149
}
151150
}
152151

153-
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @modal-popup-breakpoint-screen__m) {
152+
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
154153
.modal-popup {
155154
&.modal-slide {
156155
.modal-inner-wrap[class] {
@@ -181,7 +180,7 @@
181180
// Desktop
182181
// _____________________________________________
183182

184-
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @modal-popup-breakpoint-screen__m) {
183+
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
185184
.modal-popup {
186185
&.modal-slide {
187186
.modal-footer {

0 commit comments

Comments
 (0)