Skip to content

Commit

Permalink
Merge branch '2.3-develop' of github.com:magento/graphql-ce into Grap…
Browse files Browse the repository at this point in the history
…hQl-890-Replaced-usage-of-CartItemQuantity-with-CartItemInterface
  • Loading branch information
lenaorobei committed Oct 23, 2019
2 parents 795931f + cc599e5 commit c9c13a6
Show file tree
Hide file tree
Showing 1,513 changed files with 40,310 additions and 9,623 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Fields marked with (*) are required. Please don't remove the template.

### Preconditions (*)
<!---
Provide the exact Magento version (example: 2.2.5) and any important information on the environment where bug is reproducible.
Provide the exact Magento version (example: 2.3.2) and any important information on the environment where bug is reproducible.
-->
1.
2.
Expand Down
412 changes: 412 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a

## Install Magento

* [Installation Guide](https://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).
* [Installation Guide](https://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).

## Learn More About GraphQL in Magento 2

Expand All @@ -18,7 +18,7 @@ Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a
<h2>Contributing to the Magento 2 Code Base</h2>
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.

To learn about how to make a contribution, click [here][1].
To learn about how to contribute, click [here][1].

To learn about issues, click [here][2]. To open an issue, click [here][3].

Expand All @@ -37,7 +37,7 @@ The members of this team have been recognized for their outstanding commitment t
</a>

<h3>Top Contributors</h3>
Magento is thankful for any contribution that can improve our code base, documentation or increase test coverage. We always recognize our most active members, as their contributions are the foundation of the Magento Open Source platform.
Magento is thankful for any contribution that can improve our codebase, documentation or increase test coverage. We always recognize our most active members, as their contributions are the foundation of the Magento Open Source platform.
<a href="https://magento.com/magento-contributors">
<img src="https://raw.githubusercontent.com/wiki/magento/magento2/images/contributors.png"/>
</a>
Expand All @@ -48,7 +48,7 @@ Please review the [Code Contributions guide](https://devdocs.magento.com/guides/

## Reporting Security Issues

To report security vulnerabilities or learn more about reporting security issues in Magento software or web sites visit the [Magento Bug Bounty Program](https://hackerone.com/magento) on hackerone. Please create a hackerone account [there](https://hackerone.com/magento) to submit and follow-up your issue.
To report security vulnerabilities or learn more about reporting security issues in Magento software or web sites visit the [Magento Bug Bounty Program](https://hackerone.com/magento) on hackerone. Please create a hackerone account [there](https://hackerone.com/magento) to submit and follow-up on your issue.

Stay up-to-date on the latest security news and patches for Magento by signing up for [Security Alert Notifications](https://magento.com/security/sign-up).

Expand All @@ -64,7 +64,7 @@ Please see LICENSE_EE.txt for the full text of the MEE License or visit https://

## Community Engineering Slack

To connect with Magento and the Community, join us on the [Magento Community Engineering Slack](https://magentocommeng.slack.com). If you are interested in joining Slack, or a specific channel, send us request at [engcom@adobe.com](mailto:engcom@adobe.com) or [self signup](https://tinyurl.com/engcom-slack).
To connect with Magento and the Community, join us on the [Magento Community Engineering Slack](https://magentocommeng.slack.com). If you are interested in joining Slack, or a specific channel, send us a request at [engcom@adobe.com](mailto:engcom@adobe.com) or [self signup](https://opensource.magento.com/slack).


We have channels for each project. These channels are recommended for new members:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\AdminAnalytics\Controller\Adminhtml\Config;

use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger as NotificationLogger;
use Magento\Framework\App\ProductMetadataInterface;
use Magento\Framework\Controller\ResultInterface;
use Magento\Config\Model\Config\Factory;

/**
* Controller to record Admin analytics usage log
*/
class DisableAdminUsage extends Action implements HttpPostActionInterface
{
/**
* @var Factory
*/
private $configFactory;

/**
* @var ProductMetadataInterface
*/
private $productMetadata;

/**
* @var NotificationLogger
*/
private $notificationLogger;

/**
* DisableAdminUsage constructor.
*
* @param Action\Context $context
* @param ProductMetadataInterface $productMetadata
* @param NotificationLogger $notificationLogger
* @param Factory $configFactory
*/
public function __construct(
Action\Context $context,
ProductMetadataInterface $productMetadata,
NotificationLogger $notificationLogger,
Factory $configFactory
) {
parent::__construct($context);
$this->configFactory = $configFactory;
$this->productMetadata = $productMetadata;
$this->notificationLogger = $notificationLogger;
}

/**
* Change the value of config/admin/usage/enabled
*/
private function disableAdminUsage()
{
$configModel = $this->configFactory->create();
$configModel->setDataByPath('admin/usage/enabled', 0);
$configModel->save();
}

/**
* Log information about the last admin usage selection
*
* @return ResultInterface
*/
private function markUserNotified(): ResultInterface
{
$responseContent = [
'success' => $this->notificationLogger->log(
$this->productMetadata->getVersion()
),
'error_message' => ''
];

$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
return $resultJson->setData($responseContent);
}

/**
* Log information about the last shown advertisement
*
* @return ResultInterface
*/
public function execute()
{
$this->disableAdminUsage();
$this->markUserNotified();
}

/**
* @inheritDoc
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed(static::ADMIN_RESOURCE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\AdminAnalytics\Controller\Adminhtml\Config;

use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger as NotificationLogger;
use Magento\Framework\App\ProductMetadataInterface;
use Magento\Framework\Controller\ResultInterface;
use Magento\Config\Model\Config\Factory;

/**
* Controller to record that the current admin user has responded to Admin Analytics notice
*/
class EnableAdminUsage extends Action implements HttpPostActionInterface
{
/**
* @var Factory
*/
private $configFactory;

/**
* @var ProductMetadataInterface
*/
private $productMetadata;

/**
* @var NotificationLogger
*/
private $notificationLogger;

/**
* @param Action\Context $context
* @param ProductMetadataInterface $productMetadata
* @param NotificationLogger $notificationLogger
* @param Factory $configFactory
*/
public function __construct(
Action\Context $context,
ProductMetadataInterface $productMetadata,
NotificationLogger $notificationLogger,
Factory $configFactory
) {
parent::__construct($context);
$this->configFactory = $configFactory;
$this->productMetadata = $productMetadata;
$this->notificationLogger = $notificationLogger;
}

/**
* Change the value of config/admin/usage/enabled
*/
private function enableAdminUsage()
{
$configModel = $this->configFactory->create();
$configModel->setDataByPath('admin/usage/enabled', 1);
$configModel->save();
}

/**
* Log information about the last user response
*
* @return ResultInterface
*/
private function markUserNotified(): ResultInterface
{
$responseContent = [
'success' => $this->notificationLogger->log(
$this->productMetadata->getVersion()
),
'error_message' => ''
];

$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
return $resultJson->setData($responseContent);
}

/**
* Log information about the last shown advertisement
*
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
$this->enableAdminUsage();
$this->markUserNotified();
}

/**
* @inheritDoc
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed(static::ADMIN_RESOURCE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\AdminAnalytics\Model\Condition;

use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger;
use Magento\Framework\View\Layout\Condition\VisibilityConditionInterface;
use Magento\Framework\App\CacheInterface;

/**
* Dynamic validator for UI admin analytics notification, control UI component visibility.
*/
class CanViewNotification implements VisibilityConditionInterface
{
/**
* Unique condition name.
*
* @var string
*/
private static $conditionName = 'can_view_admin_usage_notification';

/**
* Prefix for cache
*
* @var string
*/
private static $cachePrefix = 'admin-usage-notification-popup';

/**
* @var Logger
*/
private $viewerLogger;

/**
* @var CacheInterface
*/
private $cacheStorage;

/**
* @param Logger $viewerLogger
* @param CacheInterface $cacheStorage
*/
public function __construct(
Logger $viewerLogger,
CacheInterface $cacheStorage
) {
$this->viewerLogger = $viewerLogger;
$this->cacheStorage = $cacheStorage;
}

/**
* Validate if notification popup can be shown and set the notification flag
*
* @param array $arguments Attributes from element node.
* @inheritdoc
*/
public function isVisible(array $arguments): bool
{
$cacheKey = self::$cachePrefix;
$value = $this->cacheStorage->load($cacheKey);
if ($value !== 'log-exists') {
$logExists = $this->viewerLogger->checkLogExists();
if ($logExists) {
$this->cacheStorage->save('log-exists', $cacheKey);
}
return !$logExists;
}
return false;
}

/**
* Get condition name
*
* @return string
*/
public function getName(): string
{
return self::$conditionName;
}
}
Loading

0 comments on commit c9c13a6

Please sign in to comment.