Skip to content

Commit 0a87feb

Browse files
committed
Merge pull request #599 from magento-vanilla/PR-bugs
[Vanilla] Bugs
2 parents 2c16563 + bb0f0a9 commit 0a87feb

File tree

12 files changed

+191
-153
lines changed

12 files changed

+191
-153
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@
2020
"mixins":["magnifier/magnify"],
2121
"magnifierOpts": {
2222
"enabled": <?php /* @escapeNotVerified */ echo $block->getVar("magnifier:enabled"); ?>,
23-
"eventType": "<?php /* @escapeNotVerified */ echo $block->getVar("magnifier:action"); ?>",
23+
"eventType": "<?php /* @escapeNotVerified */ echo $block->getVar("magnifier:eventType"); ?>",
2424
"width": "<?php /* @escapeNotVerified */ echo $block->getVar("magnifier:width"); ?>",
2525
"height": "<?php /* @escapeNotVerified */ echo $block->getVar("magnifier:height"); ?>",
2626
"top": "<?php /* @escapeNotVerified */ echo $block->getVar("magnifier:top"); ?>",
2727
"left": "<?php /* @escapeNotVerified */ echo $block->getVar("magnifier:left"); ?>"
2828
},
2929
"data": <?php /* @escapeNotVerified */ echo $block->getGalleryImagesJson(); ?>,
3030
"options": {
31-
"nav": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery:navigation"); ?>",
31+
"nav": "<?php /* @escapeNotVerified */ echo $block->getVar("gallery:nav"); ?>",
3232
"loop": <?php /* @escapeNotVerified */ echo $block->getVar("gallery:loop"); ?>,
3333
"keyboard": <?php /* @escapeNotVerified */ echo $block->getVar("gallery:keyboard"); ?>,
3434
"arrows": <?php /* @escapeNotVerified */ echo $block->getVar("gallery:arrows"); ?>,
35-
"showCaption": <?php /* @escapeNotVerified */ echo $block->getVar("gallery:show_caption"); ?>,
35+
"showCaption": <?php /* @escapeNotVerified */ echo $block->getVar("gallery:showCaption"); ?>,
3636
"width": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'width'); ?>,
3737
"thumbwidth": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'width'); ?>,
3838
"thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height')

app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js

Lines changed: 143 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -4,124 +4,151 @@
44
*/
55
/*browser:true*/
66
/*global define*/
7-
define(
8-
[
9-
'jquery',
10-
'uiComponent',
11-
'ko',
12-
'Magento_Customer/js/model/customer',
13-
'Magento_Customer/js/action/check-email-availability',
14-
'Magento_Customer/js/action/login',
15-
'Magento_Checkout/js/model/quote',
16-
'Magento_Checkout/js/checkout-data',
17-
'mage/validation'
18-
],
19-
function ($, Component, ko, customer, checkEmailAvailability, loginAction, quote, checkoutData) {
20-
'use strict';
21-
22-
var validatedEmail = checkoutData.getValidatedEmailValue();
23-
if (validatedEmail && !customer.isLoggedIn()) {
24-
quote.guestEmail = validatedEmail;
25-
}
7+
define([
8+
'jquery',
9+
'uiComponent',
10+
'ko',
11+
'Magento_Customer/js/model/customer',
12+
'Magento_Customer/js/action/check-email-availability',
13+
'Magento_Customer/js/action/login',
14+
'Magento_Checkout/js/model/quote',
15+
'Magento_Checkout/js/checkout-data',
16+
'mage/validation'
17+
], function ($, Component, ko, customer, checkEmailAvailability, loginAction, quote, checkoutData) {
18+
'use strict';
19+
20+
var validatedEmail = checkoutData.getValidatedEmailValue();
21+
22+
if (validatedEmail && !customer.isLoggedIn()) {
23+
quote.guestEmail = validatedEmail;
24+
}
25+
26+
return Component.extend({
27+
defaults: {
28+
template: 'Magento_Checkout/form/element/email',
29+
email: checkoutData.getInputFieldEmailValue(),
30+
emailFocused: false,
31+
isLoading: false,
32+
isPasswordVisible: false,
33+
listens: {
34+
email: 'emailHasChanged',
35+
emailFocused: 'validateEmail'
36+
}
37+
},
38+
checkDelay: 2000,
39+
checkRequest: null,
40+
isEmailCheckComplete: null,
41+
isCustomerLoggedIn: customer.isLoggedIn,
42+
forgotPasswordUrl: window.checkoutConfig.forgotPasswordUrl,
43+
emailCheckTimeout: 0,
44+
45+
/**
46+
* Initializes observable properties of instance
47+
*
48+
* @returns {Object} Chainable.
49+
*/
50+
initObservable: function () {
51+
this._super()
52+
.observe(['email', 'emailFocused', 'isLoading', 'isPasswordVisible']);
53+
54+
return this;
55+
},
2656

27-
return Component.extend({
28-
defaults: {
29-
template: 'Magento_Checkout/form/element/email',
30-
email: checkoutData.getInputFieldEmailValue(),
31-
isLoading: false,
32-
isPasswordVisible: false
33-
},
34-
checkDelay: 2000,
35-
checkRequest: null,
36-
isEmailCheckComplete: null,
37-
isCustomerLoggedIn: customer.isLoggedIn,
38-
forgotPasswordUrl: window.checkoutConfig.forgotPasswordUrl,
39-
emailCheckTimeout: 0,
40-
41-
initialize: function() {
42-
this._super();
43-
var self = this;
44-
this.email.subscribe(function() {
45-
self.emailHasChanged();
46-
});
47-
},
48-
49-
/** Initialize observable properties */
50-
initObservable: function () {
51-
this._super()
52-
.observe(['email', 'isLoading', 'isPasswordVisible']);
53-
return this;
54-
},
55-
56-
emailHasChanged: function () {
57-
var self = this;
58-
clearTimeout(this.emailCheckTimeout);
57+
/**
58+
* Callback on changing email property
59+
*/
60+
emailHasChanged: function () {
61+
var self = this;
62+
63+
clearTimeout(this.emailCheckTimeout);
64+
65+
if (self.validateEmail()) {
66+
quote.guestEmail = self.email();
67+
checkoutData.setValidatedEmailValue(self.email());
68+
}
69+
this.emailCheckTimeout = setTimeout(function () {
5970
if (self.validateEmail()) {
60-
quote.guestEmail = self.email();
61-
checkoutData.setValidatedEmailValue(self.email());
62-
}
63-
this.emailCheckTimeout = setTimeout(function () {
64-
if (self.validateEmail()) {
65-
self.checkEmailAvailability();
66-
} else {
67-
self.isPasswordVisible(false);
68-
}
69-
}, self.checkDelay);
70-
71-
checkoutData.setInputFieldEmailValue(self.email());
72-
},
73-
74-
checkEmailAvailability: function() {
75-
var self = this;
76-
this.validateRequest();
77-
this.isEmailCheckComplete = $.Deferred();
78-
this.isLoading(true);
79-
this.checkRequest = checkEmailAvailability(this.isEmailCheckComplete, this.email());
80-
81-
$.when(this.isEmailCheckComplete).done(function() {
71+
self.checkEmailAvailability();
72+
} else {
8273
self.isPasswordVisible(false);
83-
}).fail( function() {
84-
self.isPasswordVisible(true);
85-
}).always(function () {
86-
self.isLoading(false);
87-
});
88-
},
89-
90-
validateRequest: function() {
91-
/*
92-
* If request has been sent -> abort it.
93-
* ReadyStates for request aborting:
94-
* 1 - The request has been set up
95-
* 2 - The request has been sent
96-
* 3 - The request is in process
97-
*/
98-
if (this.checkRequest != null && $.inArray(this.checkRequest.readyState, [1, 2, 3])) {
99-
this.checkRequest.abort();
100-
this.checkRequest = null;
101-
}
102-
},
103-
104-
validateEmail: function() {
105-
var loginFormSelector = 'form[data-role=email-with-possible-login]';
106-
$(loginFormSelector).validation();
107-
var validationResult = $(loginFormSelector + ' input[name=username]').valid();
108-
return Boolean(validationResult);
109-
},
110-
111-
login: function(loginForm) {
112-
var loginData = {},
113-
formDataArray = $(loginForm).serializeArray();
114-
115-
formDataArray.forEach(function (entry) {
116-
loginData[entry.name] = entry.value;
117-
});
118-
if (this.isPasswordVisible()
119-
&& $(loginForm).validation()
120-
&& $(loginForm).validation('isValid')
121-
) {
122-
loginAction(loginData);
12374
}
75+
}, self.checkDelay);
76+
77+
checkoutData.setInputFieldEmailValue(self.email());
78+
},
79+
80+
/**
81+
* Check email existing.
82+
*/
83+
checkEmailAvailability: function () {
84+
var self = this;
85+
this.validateRequest();
86+
this.isEmailCheckComplete = $.Deferred();
87+
this.isLoading(true);
88+
this.checkRequest = checkEmailAvailability(this.isEmailCheckComplete, this.email());
89+
90+
$.when(this.isEmailCheckComplete).done(function () {
91+
self.isPasswordVisible(false);
92+
}).fail(function () {
93+
self.isPasswordVisible(true);
94+
}).always(function () {
95+
self.isLoading(false);
96+
});
97+
},
98+
99+
/**
100+
* If request has been sent -> abort it.
101+
* ReadyStates for request aborting:
102+
* 1 - The request has been set up
103+
* 2 - The request has been sent
104+
* 3 - The request is in process
105+
*/
106+
validateRequest: function () {
107+
if (this.checkRequest != null && $.inArray(this.checkRequest.readyState, [1, 2, 3])) {
108+
this.checkRequest.abort();
109+
this.checkRequest = null;
124110
}
125-
});
126-
}
127-
);
111+
},
112+
113+
/**
114+
* Local email validation.
115+
*
116+
* @param {Boolean} focused - input focus.
117+
* @returns {Boolean} - validation result.
118+
*/
119+
validateEmail: function (focused) {
120+
var loginFormSelector = 'form[data-role=email-with-possible-login]',
121+
usernameSelector = loginFormSelector + ' input[name=username]',
122+
loginForm = $(loginFormSelector),
123+
validator;
124+
125+
loginForm.validation();
126+
127+
if (focused === false) {
128+
return !!$(usernameSelector).valid();
129+
}
130+
131+
validator = loginForm.validate();
132+
133+
return validator.check(usernameSelector);
134+
},
135+
136+
/**
137+
* Log in form submitting callback.
138+
*
139+
* @param {HTMLElement} loginForm - form element.
140+
*/
141+
login: function (loginForm) {
142+
var loginData = {},
143+
formDataArray = $(loginForm).serializeArray();
144+
145+
formDataArray.forEach(function (entry) {
146+
loginData[entry.name] = entry.value;
147+
});
148+
149+
if (this.isPasswordVisible() && $(loginForm).validation() && $(loginForm).validation('isValid')) {
150+
loginAction(loginData);
151+
}
152+
}
153+
});
154+
});

app/code/Magento/Checkout/view/frontend/web/template/form/element/email.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
<div class="control _with-tooltip">
2121
<input class="input-text"
2222
type="email"
23-
data-bind="textInput: email"
23+
data-bind="
24+
textInput: email,
25+
hasFocus: emailFocused"
2426
name="username"
2527
data-validate="{required:true, 'validate-email':true}"
2628
id="customer-email" />

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,7 @@ public function showCustomerInfo()
146146
[
147147
'customer' => $this->getTable('customer_entity')
148148
],
149-
'main_table.customer_id = customer.entity_id',
150-
[
151-
'customer_lastname' => 'lastname',
152-
'customer_firstname' => 'firstname'
153-
]
149+
'main_table.customer_id = customer.entity_id'
154150
);
155151
return $this;
156152
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,8 @@ public function sendUnsubscriptionEmail()
789789
public function getSubscriberFullName()
790790
{
791791
$name = null;
792-
if ($this->hasCustomerFirstname() || $this->hasCustomerLastname()) {
793-
$name = $this->getCustomerFirstname() . ' ' . $this->getCustomerLastname();
792+
if ($this->hasFirstname() || $this->hasLastname()) {
793+
$name = $this->getFirstname() . ' ' . $this->getLastname();
794794
}
795795
return $name;
796796
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ public function testUnsubscribeException()
279279

280280
public function testGetSubscriberFullName()
281281
{
282-
$this->subscriber->setCustomerFirstname('John');
283-
$this->subscriber->setCustomerLastname('Doe');
282+
$this->subscriber->setFirstname('John');
283+
$this->subscriber->setLastname('Doe');
284284

285285
$this->assertEquals('John Doe', $this->subscriber->getSubscriberFullName());
286286
}

app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_subscriber_block.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<block class="Magento\Backend\Block\Widget\Grid\Column" as="firstname">
9090
<arguments>
9191
<argument name="header" xsi:type="string" translate="true">Customer First Name</argument>
92-
<argument name="index" xsi:type="string">customer_firstname</argument>
92+
<argument name="index" xsi:type="string">firstname</argument>
9393
<argument name="default" xsi:type="string">----</argument>
9494
<argument name="header_css_class" xsi:type="string">col-first-name</argument>
9595
<argument name="column_css_class" xsi:type="string">col-first-name</argument>
@@ -98,7 +98,7 @@
9898
<block class="Magento\Backend\Block\Widget\Grid\Column" as="lastname">
9999
<arguments>
100100
<argument name="header" xsi:type="string" translate="true">Customer Last Name</argument>
101-
<argument name="index" xsi:type="string">customer_lastname</argument>
101+
<argument name="index" xsi:type="string">lastname</argument>
102102
<argument name="default" xsi:type="string">----</argument>
103103
<argument name="header_css_class" xsi:type="string">col-last-name</argument>
104104
<argument name="column_css_class" xsi:type="string">col-last-name</argument>

app/code/Magento/Ui/view/base/web/js/grid/columns/actions.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,7 @@ define([
146146
*/
147147
applyAction: function (actionIndex, rowIndex) {
148148
var action = this.getAction(rowIndex, actionIndex),
149-
callback;
150-
151-
if (!action.href && !action.callback) {
152-
return this;
153-
}
154-
155-
callback = this._getCallback(action);
149+
callback = this._getCallback(action);
156150

157151
action.confirm ?
158152
this._confirm(action, callback) :
@@ -248,6 +242,19 @@ define([
248242
return action.hidden !== true;
249243
},
250244

245+
/**
246+
* Checks if specified action requires a handler function.
247+
*
248+
* @param {String} actionIndex - Actions' identifier.
249+
* @param {Number} rowIndex - Index of a row.
250+
* @returns {Boolean}
251+
*/
252+
isHandlerRequired: function (actionIndex, rowIndex) {
253+
var action = this.getAction(rowIndex, actionIndex);
254+
255+
return _.isObject(action.callback) || action.confirm || !action.href;
256+
},
257+
251258
/**
252259
* Opens or closes specific actions list.
253260
*

0 commit comments

Comments
 (0)