Skip to content

Conversation

Nazar65
Copy link
Member

@Nazar65 Nazar65 commented May 14, 2020

Description (*)

Fixed Issues (if relevant)

  1. Fixes magento/adobe-stock-integration#1335: Requested default folder is not selected on opening media gallery (current_tree_path parameter)

Manual testing scenarios (*)

  1. Open media gallery from the category image field
  2. Open media gallery from the WYSIWYG

Expected result (*)

  1. catalog/category directory is selected by default
  2. WYSIWYG directory is selected by default

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented May 14, 2020

Hi @Nazar65. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered only manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s). <test-build(s)> is a comma-separated list of build names. Allowed build names are Database Compare, Functional Tests CE, Functional Tests EE, Functional Tests B2B, Integration Tests, Magento Health Index, Sample Data Tests CE, Sample Data Tests EE, Sample Data Tests B2B, Static Tests, Unit Tests, WebAPI Tests.

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@Nazar65
Copy link
Member Author

Nazar65 commented May 14, 2020

@magento run all tests

@Nazar65
Copy link
Member Author

Nazar65 commented May 14, 2020

@magento run all tests

@Nazar65
Copy link
Member Author

Nazar65 commented May 14, 2020

@magento run all tests

@gabrieldagama gabrieldagama changed the title Fix current tree path preselected folder on MediaGallery, after reopen insatnce Fix current tree path preselected folder on MediaGallery, after reopen instance May 14, 2020
Copy link
Contributor

@gabrieldagama gabrieldagama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Nazar65 thanks for your pull request, it looks good! Please follow below some comments. Thanks!

@Nazar65
Copy link
Member Author

Nazar65 commented May 14, 2020

@magento run all tests

1 similar comment
@Nazar65
Copy link
Member Author

Nazar65 commented May 14, 2020

@magento run all tests

@Nazar65
Copy link
Member Author

Nazar65 commented May 15, 2020

@magento run all tests

Copy link
Contributor

@gabrieldagama gabrieldagama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Nazar65, thanks for your changes! Please follow some small comments below.

};

$(window).on('reload.MediaGallery', function () {
encodedPath = Base64.decode(window.MediabrowserUtility.pathId.replace(/--|,,/, '==')).split('/');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this variable name should be decodedPath since it is decoding the pathId, correct?

tree.jstree('deselect_all');

if (encodedPath.length > 1) {
path = _parseCurrentPath(encodedPath);
Copy link
Contributor

@gabrieldagama gabrieldagama May 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _parseCurrentPath doesn't accept any parameter, I believe we can remove the encodedPath from here.

if (isLastElement) {
paths[i] = window.MediabrowserUtility.pathId.replace(',,', '--');
} else {
paths[i] = Base64.encode(val).replace('==', '--');
Copy link
Contributor

@gabrieldagama gabrieldagama May 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the replace here isn't correct and may cause other problems, please follow below the way PHP is handling the encode, I believe we have to perform the same behavior on JS.

file: app/code/Magento/Cms/Helper/Wysiwyg/Images.php
method: idEncode
line: 304
return strtr(base64_encode($string), '+/=', ':_-');

@Nazar65
Copy link
Member Author

Nazar65 commented May 21, 2020

@magento run all tests

@Nazar65
Copy link
Member Author

Nazar65 commented May 21, 2020

@magento run all tests

@Nazar65
Copy link
Member Author

Nazar65 commented May 21, 2020

@magento run all tests

@Nazar65
Copy link
Member Author

Nazar65 commented May 21, 2020

@magento run WebAPI Tests

@magento-engcom-team
Copy link
Contributor

Hi @gabrieldagama, thank you for the review.
ENGCOM-7573 has been created to process this Pull Request
✳️ @gabrieldagama, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@gabrieldagama gabrieldagama added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label May 21, 2020
@engcom-Bravo engcom-Bravo self-assigned this May 22, 2020
@engcom-Bravo
Copy link
Contributor

✔️ QA Passed

Testing Scenario
Precondition:

  1. Adobe Stock Integration branch cloned and required by the composer. (You can find the installation guide here)
  2. Switch Adobe Stock to this if it is not merged yet

Steps:

  1. Open Magento Admin

  2. Go to Stores - Configuration - Advanced tab - System and select Enabled Yes for Enhanced Media Gallery. Save Config

  3. Go to Catalog - Categories
    (the Default Category is selected)

  4. Expand Content

  5. Click Select from Gallery button near the Category Image
    Expected Result: Catalog/Category directory is selected
    cat-cat_2205

  6. Close Media Gallery

  7. Click Insert/edit image from Description editor

  8. From the opened Insert/edit image window click Search button near the Source field
    Expected Result: wysiwyg directory is selected
    cat-wysiwyg_2205

@chalov-anton
Copy link
Contributor

Added test steps to already existing scenario on cucumber studio https://studio.cucumber.io/projects/131313/test-plan/folders/1054245/scenarios/4523889

@chalov-anton chalov-anton added the QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope label May 25, 2020
@slavvka slavvka mentioned this pull request May 28, 2020
@slavvka slavvka merged commit ec5e835 into magento:2.4.0-develop May 28, 2020
@m2-assistant
Copy link

m2-assistant bot commented May 28, 2020

Hi @Nazar65, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Area: Lib/Frontend Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Ui Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Requested default folder is not selected on opening media gallery (current_tree_path parameter)
7 participants