Skip to content

Commit 44648f0

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Accepted Community Pull Requests: - #23535: [2.3] Plain Text Emails are now sent with correct MIME Encoding (by @gwharton) - #23541: fix validation class for max-words (by @sunilit42) - #23528: move breakpoint by -1px to make nav work correctly at viewport 768 (by @bobemoe) - #23523: Issue #23522 UPS shipping booking and label generation gives error when shipper's street given more than 35 chars (by @ankurvr) - #23532: Correct array type hints in Visibility model (by @pmclain) Fixed GitHub Issues: - #22103: Character Encoding in Plain Text Emails Fails since 2.2.8/2.3.0 due to emails no longer being sent as MIME (reported by @gwharton) has been fixed in #23535 by @gwharton in 2.3-develop branch Related commits: 1. fa030f2 2. 7e3bc71 3. b3e1aed - #23199: NO sender in email header for magento 2 sales order and password change emails to customer (reported by @msawyers) has been fixed in #23535 by @gwharton in 2.3-develop branch Related commits: 1. fa030f2 2. 7e3bc71 3. b3e1aed - #23538: wrong validation happen for max-words validation class (reported by @sunilit42) has been fixed in #23541 by @sunilit42 in 2.3-develop branch Related commits: 1. 9e95177 - #8298: Mobile Menu Behavior at Incorrect Breakpoint (reported by @CNanninga) has been fixed in #23528 by @bobemoe in 2.3-develop branch Related commits: 1. c06c1d8 - #23522: UPS shipping booking and label generation gives error when shipper's street given more than 35 chars (reported by @ankurvr) has been fixed in #23523 by @ankurvr in 2.3-develop branch Related commits: 1. 45ac10a 2. c83bf54 3. 4454782 4. 9af8800 5. 4f0763d 6. 56ba3b4
2 parents 5588999 + a96814c commit 44648f0

File tree

6 files changed

+40
-41
lines changed

6 files changed

+40
-41
lines changed

app/code/Magento/Catalog/Model/Product/Visibility.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct(
5555
/**
5656
* Retrieve visible in catalog ids array
5757
*
58-
* @return string[]
58+
* @return int[]
5959
*/
6060
public function getVisibleInCatalogIds()
6161
{
@@ -65,7 +65,7 @@ public function getVisibleInCatalogIds()
6565
/**
6666
* Retrieve visible in search ids array
6767
*
68-
* @return string[]
68+
* @return int[]
6969
*/
7070
public function getVisibleInSearchIds()
7171
{
@@ -75,7 +75,7 @@ public function getVisibleInSearchIds()
7575
/**
7676
* Retrieve visible in site ids array
7777
*
78-
* @return string[]
78+
* @return int[]
7979
*/
8080
public function getVisibleInSiteIds()
8181
{
@@ -86,6 +86,7 @@ public function getVisibleInSiteIds()
8686
* Retrieve option array
8787
*
8888
* @return array
89+
* phpcs:disable Magento2.Functions.StaticFunction
8990
*/
9091
public static function getOptionArray()
9192
{
@@ -134,6 +135,7 @@ public static function getOptionText($optionId)
134135
$options = self::getOptionArray();
135136
return isset($options[$optionId]) ? $options[$optionId] : null;
136137
}
138+
//phpcs:enable Magento2.Functions.StaticFunction
137139

138140
/**
139141
* Retrieve flat column definition
@@ -251,7 +253,7 @@ public function addValueSortToCollection($collection, $dir = 'asc')
251253
}
252254

253255
/**
254-
* {@inheritdoc}
256+
* @inheritdoc
255257
*/
256258
public function toOptionArray()
257259
{

app/code/Magento/Ups/Model/Carrier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ protected function _formShipmentRequest(\Magento\Framework\DataObject $request)
13801380
$shipperPart->addChild('PhoneNumber', $request->getShipperContactPhoneNumber());
13811381

13821382
$addressPart = $shipperPart->addChild('Address');
1383-
$addressPart->addChild('AddressLine1', $request->getShipperAddressStreet());
1383+
$addressPart->addChild('AddressLine1', $request->getShipperAddressStreet1());
13841384
$addressPart->addChild('AddressLine2', $request->getShipperAddressStreet2());
13851385
$addressPart->addChild('City', $request->getShipperAddressCity());
13861386
$addressPart->addChild('CountryCode', $request->getShipperAddressCountryCode());

lib/internal/Magento/Framework/Mail/Message.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Message implements MailMessageInterface
2323
*
2424
* @var string
2525
*/
26-
private $messageType = self::TYPE_TEXT;
26+
private $messageType = Mime::TYPE_TEXT;
2727

2828
/**
2929
* Initialize dependencies.
@@ -58,8 +58,8 @@ public function setMessageType($type)
5858
*/
5959
public function setBody($body)
6060
{
61-
if (is_string($body) && $this->messageType === MailMessageInterface::TYPE_HTML) {
62-
$body = self::createHtmlMimeFromString($body);
61+
if (is_string($body)) {
62+
$body = self::createMimeFromString($body, $this->messageType);
6363
}
6464
$this->zendMessage->setBody($body);
6565
return $this;
@@ -157,18 +157,19 @@ public function getRawMessage()
157157
}
158158

159159
/**
160-
* Create HTML mime message from the string.
160+
* Create mime message from the string.
161161
*
162-
* @param string $htmlBody
162+
* @param string $body
163+
* @param string $messageType
163164
* @return \Zend\Mime\Message
164165
*/
165-
private function createHtmlMimeFromString($htmlBody)
166+
private function createMimeFromString($body, $messageType)
166167
{
167-
$htmlPart = new Part($htmlBody);
168-
$htmlPart->setCharset($this->zendMessage->getEncoding());
169-
$htmlPart->setType(Mime::TYPE_HTML);
168+
$part = new Part($body);
169+
$part->setCharset($this->zendMessage->getEncoding());
170+
$part->setType($messageType);
170171
$mimeMessage = new \Zend\Mime\Message();
171-
$mimeMessage->addPart($htmlPart);
172+
$mimeMessage->addPart($part);
172173
return $mimeMessage;
173174
}
174175

@@ -177,7 +178,7 @@ private function createHtmlMimeFromString($htmlBody)
177178
*/
178179
public function setBodyHtml($html)
179180
{
180-
$this->setMessageType(self::TYPE_HTML);
181+
$this->setMessageType(Mime::TYPE_HTML);
181182
return $this->setBody($html);
182183
}
183184

@@ -186,7 +187,7 @@ public function setBodyHtml($html)
186187
*/
187188
public function setBodyText($text)
188189
{
189-
$this->setMessageType(self::TYPE_TEXT);
190+
$this->setMessageType(Mime::TYPE_TEXT);
190191
return $this->setBody($text);
191192
}
192193
}

lib/internal/Magento/Framework/Mail/Test/Unit/MessageTest.php

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,40 @@
55
*/
66
namespace Magento\Framework\Mail\Test\Unit;
77

8+
/**
9+
* test Magento\Framework\Mail\Message
10+
*/
811
class MessageTest extends \PHPUnit\Framework\TestCase
912
{
1013
/**
11-
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Mail\Message
14+
* @var \Magento\Framework\Mail\Message
1215
*/
13-
protected $_messageMock;
16+
protected $message;
1417

1518
protected function setUp()
1619
{
17-
$this->_messageMock = $this->createPartialMock(
18-
\Magento\Framework\Mail\Message::class,
19-
['setBody', 'setMessageType']
20-
);
20+
$this->message = new \Magento\Framework\Mail\Message();
2121
}
2222

2323
public function testSetBodyHtml()
2424
{
25-
$this->_messageMock->expects($this->once())
26-
->method('setMessageType')
27-
->with('text/html');
25+
$this->message->setBodyHtml('body');
2826

29-
$this->_messageMock->expects($this->once())
30-
->method('setBody')
31-
->with('body');
32-
33-
$this->_messageMock->setBodyHtml('body');
27+
$part = $this->message->getBody()->getParts()[0];
28+
$this->assertEquals('text/html', $part->getType());
29+
$this->assertEquals('8bit', $part->getEncoding());
30+
$this->assertEquals('utf-8', $part->getCharset());
31+
$this->assertEquals('body', $part->getContent());
3432
}
3533

3634
public function testSetBodyText()
3735
{
38-
$this->_messageMock->expects($this->once())
39-
->method('setMessageType')
40-
->with('text/plain');
41-
42-
$this->_messageMock->expects($this->once())
43-
->method('setBody')
44-
->with('body');
36+
$this->message->setBodyText('body');
4537

46-
$this->_messageMock->setBodyText('body');
38+
$part = $this->message->getBody()->getParts()[0];
39+
$this->assertEquals('text/plain', $part->getType());
40+
$this->assertEquals('8bit', $part->getEncoding());
41+
$this->assertEquals('utf-8', $part->getCharset());
42+
$this->assertEquals('body', $part->getContent());
4743
}
4844
}

lib/web/mage/menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ define([
2222
showDelay: 42,
2323
hideDelay: 300,
2424
delay: 0,
25-
mediaBreakpoint: '(max-width: 768px)'
25+
mediaBreakpoint: '(max-width: 767px)'
2626
},
2727

2828
/**

lib/web/mage/validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
rules = {
227227
'max-words': [
228228
function (value, element, params) {
229-
return this.optional(element) || $.mage.stripHtml(value).match(/\b\w+\b/g).length < params;
229+
return this.optional(element) || $.mage.stripHtml(value).match(/\b\w+\b/g).length <= params;
230230
},
231231
$.mage.__('Please enter {0} words or less.')
232232
],

0 commit comments

Comments
 (0)