Skip to content

Commit a3f60e1

Browse files
committed
Merge remote-tracking branch 'upstream/2.4-develop' into ui/admin/roles-tree
2 parents 3aa6cd9 + f00af58 commit a3f60e1

File tree

23 files changed

+916
-221
lines changed

23 files changed

+916
-221
lines changed

.github/CODE_OF_CONDUCT.md

+54-20
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,80 @@
1-
# Contributor Covenant Code of Conduct
1+
# Magento Code of Conduct
22

33
## Our Pledge
44

5-
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
5+
We as members, contributors, and leaders pledge to make participation in our project and community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8+
69

710
## Our Standards
811

9-
Examples of behavior that contributes to creating a positive environment include:
12+
Examples of behavior that contribute to a positive environment for our project and community include:
13+
14+
15+
* Demonstrating empathy and kindness toward other people
16+
* Being respectful of differing opinions, viewpoints, and experiences
17+
* Giving and gracefully accepting constructive feedback
18+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
19+
* Focusing on what is best, not just for us as individuals but for the overall community
1020

11-
* Using welcoming and inclusive language
12-
* Being respectful of differing viewpoints and experiences
13-
* Gracefully accepting constructive criticism
14-
* Focusing on what is best for the community
15-
* Showing empathy towards other community members
1621

1722
Examples of unacceptable behavior by participants include:
1823

19-
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20-
* Trolling, insulting/derogatory comments, and personal or political attacks
24+
* The use of sexualized language or imagery and sexual attention or advances of any kind
25+
* Trolling, insulting or derogatory comments, and personal or political attacks
2126
* Public or private harassment
22-
* Publishing others' private information, such as a physical or electronic address, without explicit permission
27+
* Publishing others private information, such as a physical or email address, without their explicit permission
2328
* Other conduct which could reasonably be considered inappropriate in a professional setting
2429

30+
2531
## Our Responsibilities
2632

27-
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
33+
Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any instances of unacceptable behavior.
2834

29-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
35+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for behaviors that they deem inappropriate, threatening, offensive, or harmful.
3036

3137
## Scope
3238

33-
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
39+
This Code of Conduct applies when an individual is representing the project or its community both within project spaces and in public spaces. Examples of representing a project or community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
3440

3541
## Enforcement
3642

37-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at engcom@magento.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
43+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by first contacting the project team at engcom@adobe.com. Oversight of Adobe projects is handled by the Adobe Open Source Office, which has final say in any violations and enforcement of this Code of Conduct and can be reached at [email protected]. All complaints will be reviewed and investigated promptly and fairly.
3844

39-
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
45+
The project team must respect the privacy and security of the reporter of any incident.
4046

41-
## Attribution
47+
Project maintainers who do not follow or enforce the Code of Conduct may face temporary or permanent repercussions as determined by other members of the project's leadership or the Adobe Open Source Office.
48+
49+
50+
## Enforcement Guidelines
51+
52+
Project maintainers will follow these Community Impact Guidelines in determining the consequences for any action they deem to be in violation of this Code of Conduct:
53+
54+
### 1. Correction
55+
56+
Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
57+
Consequence: A private, written warning from project maintainers describing the violation and why the behavior was unacceptable. A public apology may be requested from the violator before any further involvement in the project by violator.
4258

43-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
59+
### 2. Warning
60+
61+
Community Impact: A relatively minor violation through a single incident or series of actions.
62+
63+
Consequence: A written warning from project maintainers that includes stated consequences for continued unacceptable behavior. Violator must refrain from interacting with the people involved for a specified period of time as determined by the project maintainers, including, but not limited to, unsolicited interaction with those enforcing the Code of Conduct through channels such as community spaces and social media. Continued violations may lead to a temporary or permanent ban.
64+
65+
### 3. Temporary Ban
66+
67+
Community Impact: A more serious violation of community standards, including sustained unacceptable behavior.
68+
69+
Consequence: A temporary ban from any interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Failure to comply with the temporary ban may lead to a permanent ban.
70+
71+
### 4. Permanent Ban
72+
73+
Community Impact: Demonstrating a consistent pattern of violation of community standards or an egregious violation of community standards, including, but not limited to, sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
74+
75+
Consequence: A permanent ban from any interaction with the community.
76+
77+
78+
## Attribution
4479

45-
[homepage]: http://contributor-covenant.org
46-
[version]: http://contributor-covenant.org/version/1/4/
80+
This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.

app/code/Magento/CatalogInventory/Observer/ReindexQuoteInventoryObserver.php

+59-36
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,58 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
declare(strict_types=1);
8+
79
namespace Magento\CatalogInventory\Observer;
810

11+
use Magento\CatalogInventory\Model\Indexer\Stock\Processor as StockProcessor;
12+
use Magento\Catalog\Model\Indexer\Product\Price\Processor as PriceProcessor;
913
use Magento\Framework\Event\Observer as EventObserver;
1014
use Magento\Framework\Event\ObserverInterface;
15+
use Magento\Framework\Exception\LocalizedException;
16+
use Psr\Log\LoggerInterface;
1117

18+
/**
19+
* Responsible for re-indexing stock items after a successful order.
20+
*/
1221
class ReindexQuoteInventoryObserver implements ObserverInterface
1322
{
1423
/**
15-
* @var \Magento\CatalogInventory\Model\Indexer\Stock\Processor
24+
* @var StockProcessor
1625
*/
17-
protected $stockIndexerProcessor;
26+
private StockProcessor $stockIndexerProcessor;
1827

1928
/**
20-
* @var \Magento\Catalog\Model\Indexer\Product\Price\Processor
29+
* @var PriceProcessor
2130
*/
22-
protected $priceIndexer;
31+
private PriceProcessor $priceIndexer;
2332

2433
/**
25-
* @var \Magento\CatalogInventory\Observer\ItemsForReindex
34+
* @var ItemsForReindex
2635
*/
27-
protected $itemsForReindex;
36+
private ItemsForReindex $itemsForReindex;
2837

2938
/**
30-
* @param \Magento\CatalogInventory\Model\Indexer\Stock\Processor $stockIndexerProcessor
31-
* @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer
39+
* @var LoggerInterface
40+
*/
41+
private LoggerInterface $logger;
42+
43+
/**
44+
* @param StockProcessor $stockIndexerProcessor
45+
* @param PriceProcessor $priceIndexer
3246
* @param ItemsForReindex $itemsForReindex
47+
* @param LoggerInterface $logger
3348
*/
3449
public function __construct(
35-
\Magento\CatalogInventory\Model\Indexer\Stock\Processor $stockIndexerProcessor,
36-
\Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer,
37-
ItemsForReindex $itemsForReindex
50+
StockProcessor $stockIndexerProcessor,
51+
PriceProcessor $priceIndexer,
52+
ItemsForReindex $itemsForReindex,
53+
LoggerInterface $logger
3854
) {
3955
$this->stockIndexerProcessor = $stockIndexerProcessor;
4056
$this->priceIndexer = $priceIndexer;
4157
$this->itemsForReindex = $itemsForReindex;
58+
$this->logger = $logger;
4259
}
4360

4461
/**
@@ -47,37 +64,43 @@ public function __construct(
4764
* @param EventObserver $observer
4865
* @return void
4966
*/
50-
public function execute(EventObserver $observer)
67+
public function execute(EventObserver $observer): void
5168
{
52-
// Reindex quote ids
53-
$quote = $observer->getEvent()->getQuote();
54-
$productIds = [];
55-
foreach ($quote->getAllItems() as $item) {
56-
$productIds[$item->getProductId()] = $item->getProductId();
57-
$children = $item->getChildrenItems();
58-
if ($children) {
59-
foreach ($children as $childItem) {
60-
$productIds[$childItem->getProductId()] = $childItem->getProductId();
69+
try {
70+
// Reindex quote ids
71+
$quote = $observer->getEvent()->getData('quote');
72+
$productIds = [];
73+
foreach ($quote->getAllItems() as $item) {
74+
$productIds[$item->getData('product_id')] = $item->getData('product_id');
75+
$children = $item->getData('children_items');
76+
if ($children) {
77+
foreach ($children as $childItem) {
78+
$productIds[$childItem->getData('product_id')] = $childItem->getData('product_id');
79+
}
6180
}
6281
}
63-
}
6482

65-
if ($productIds) {
66-
$this->stockIndexerProcessor->reindexList($productIds);
67-
}
83+
if ($productIds) {
84+
$this->stockIndexerProcessor->reindexList($productIds);
85+
}
6886

69-
// Reindex previously remembered items
70-
$productIds = [];
71-
foreach ($this->itemsForReindex->getItems() as $item) {
72-
$item->save();
73-
$productIds[] = $item->getProductId();
74-
}
87+
// Reindex previously remembered items
88+
$productIds = [];
89+
foreach ($this->itemsForReindex->getItems() as $item) {
90+
$item->save();
91+
$productIds[] = $item->getData('product_id');
92+
}
7593

76-
if (!empty($productIds)) {
77-
$this->priceIndexer->reindexList($productIds);
78-
}
94+
if (!empty($productIds)) {
95+
$this->priceIndexer->reindexList($productIds);
96+
}
7997

80-
$this->itemsForReindex->clear();
81-
// Clear list of remembered items - we don't need it anymore
98+
$this->itemsForReindex->clear();
99+
// Clear list of remembered items - we don't need it anymore
100+
} catch (LocalizedException $exception) {
101+
$this->logger->error('Error while re-indexing order items: ' . $exception->getLogMessage());
102+
$this->stockIndexerProcessor->markIndexerAsInvalid();
103+
$this->priceIndexer->markIndexerAsInvalid();
104+
}
82105
}
83106
}

0 commit comments

Comments
 (0)