Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed indicating products that are invalid for publication #3147

Merged
merged 11 commits into from
Nov 20, 2017

Conversation

aanchirinah
Copy link
Contributor

@aanchirinah aanchirinah commented Oct 20, 2017

Partly resolves #2690 ,

This PR adds a red badge at the top of products that have failed validation before being published. I added a checkValidation function in gridItemControlContainer.js that uses Simple Schema validation method to check validity of a product including it's variants before publishing it. And also added a condition to also add the appropriate badge for when a product is invalid in gridItemControl.js component.

HOW TO TEST

Some context before proceeding to test, so initially it was quite confusing for a user to differentiate between products that require to be published and those that required all fields to be completed as it indicated a green info badge on the affected products in the product grid. To understand what is trying to be fixed here, the test below is going to include how to create these 2 instances of products.

How to test for the green badge

- Login as Admin
- Create a product fill out all the fields required
- Navigate to the product grid
- Observe that the product you just created has a green badge at the top right corner.

How to test for the red badge

- Login as Admin
- Create a product but leave "Label" blank
- Navigate to the product grid
- Observe that the product you just created has a red badge at the top right corner.

@brent-hoover
Copy link
Collaborator

@aanchirinah What's the status on this?

@codejockie
Copy link
Contributor

I have tested this out and everything is working fine.

@aanchirinah
Copy link
Contributor Author

@zenweasel , I was still testing it out but everything works as it should now

@aanchirinah aanchirinah changed the title [WIP] Fixed indicating products that are invalid for publication Fixed indicating products that are invalid for publication Oct 23, 2017
@brent-hoover
Copy link
Collaborator

@aanchirinah So there appears to be quite a few problems here. The most obvious one being that when I add a product in a merchant shop, an error is thrown in the primary shop

TypeError: Cannot read property 'isValid' of undefined
    at GridItemControlsContainer._this.checkValidation (gridItemControlsContainer.js:49)
    at GridItemControlsContainer.componentWillMount (gridItemControlsContainer.js:32)
    at modules.js?hash=7ee907e6d17784321fe48b45f09bcaa0f5d0b366:108247
    at measureLifeCyclePerf (modules.js?hash=7ee907e6d17784321fe48b45f09bcaa0f5d0b366:107975)
    at ReactCompositeComponentWrapper.performInitialMount (modules.js?hash=7ee907e6d17784321fe48b45f09bcaa0f5d0b366:108246)
    at ReactCompositeComponentWrapper.mountComponent (modules.js?hash=7ee907e6d17784321fe48b45f09bcaa0f5d0b366:108157)
    at Object.mountComponent (modules.js?hash=7ee907e6d17784321fe48b45f09bcaa0f5d0b366:100918)
    at ReactCompositeComponentWrapper.performInitialMount (modules.js?hash=7ee907e6d17784321fe48b45f09bcaa0f5d0b366:108270)
    at ReactCompositeComponentWrapper.mountComponent (modules.js?hash=7ee907e6d17784321fe48b45f09bcaa0f5d0b366:108157)
    at Object.mountComponent (modules.js?hash=7ee907e6d17784321fe48b45f09bcaa0f5d0b366:100918)

Steps to reproduce

  1. Create a marketplace shop
  2. Create an invalid product in your marketplace shop
  3. Navigate back to the primary shop
  4. Observe an error is thrown in the console.

Copy link
Collaborator

@brent-hoover brent-hoover left a comment

Choose a reason for hiding this comment

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

Seeing errors when adding products in marketplace shops

@aanchirinah
Copy link
Contributor Author

@zenweasel , I just pulled recent 1.5.6 and tested the PR severely once again with 2 marketplace shops but didn't experience any of the bugs you were facing can you please pull the branch again and try again.

@brent-hoover
Copy link
Collaborator

reaction1_and_reaction1_and_reaction_docs_-_merchant_shop_setup

When I correct the problems with a product in the marketplace shop, the red dot does not appear to get removed in the primary shop.

Steps to replicate

  1. Invite a shop
  2. Create an invalid product in that shop (leave out the label)
  3. Observe that the "red dot" correctly appears in the marketplace shop and the primary shop
  4. Correct the product in the marketplace shop and publish
  5. Observe that the red dot does disappear in the marketplace shop but does not in the primary shop

You also have a lint error that needs to be resolved.

/Users/brenthoover/Projects/js/reaction/imports/plugins/included/product-variant/containers/gridItemControlsContainer.js
  46:52  error  Trailing spaces not allowed  no-trailing-spaces

@aanchirinah
Copy link
Contributor Author

@zenweasel , I have fixed your requested changes

@brent-hoover
Copy link
Collaborator

Tested. Verified working.

@spencern spencern changed the base branch from master to release-1.5.9 November 20, 2017 23:54
@spencern spencern merged commit c1dce96 into release-1.5.9 Nov 20, 2017
@spencern spencern deleted the audax-fix-issue-2690 branch November 20, 2017 23:55
@spencern spencern mentioned this pull request Nov 21, 2017
Akarshit pushed a commit that referenced this pull request Jan 7, 2018
Fixed indicating products that are invalid for publication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants