Merge pull request #623 from sharetribe/fix-listingpage-category-check

Fix: there was no null check for config.customAttributes
This commit is contained in:
Vesa Luusua 2018-01-05 12:54:46 +02:00 committed by GitHub
commit bb60793a54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 73 additions and 1 deletions

View file

@ -4388,6 +4388,10 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -4401,6 +4405,9 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -100,
"currency": "USD",
@ -4642,6 +4649,10 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -4655,6 +4666,9 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -100,
"currency": "USD",
@ -4764,6 +4778,10 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -4777,6 +4795,9 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -100,
"currency": "USD",
@ -5004,6 +5025,10 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -5017,6 +5042,9 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -100,
"currency": "USD",
@ -5220,6 +5248,10 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -5233,6 +5265,9 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -100,
"currency": "USD",
@ -5345,6 +5380,10 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -5358,6 +5397,9 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -100,
"currency": "USD",
@ -5467,6 +5509,10 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -5480,6 +5526,9 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -100,
"currency": "USD",
@ -5589,6 +5638,10 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -5602,6 +5655,9 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -100,
"currency": "USD",
@ -5829,6 +5885,10 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -5842,6 +5902,9 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -100,
"currency": "USD",
@ -6039,6 +6102,10 @@ exports[`TransactionPanel - Sale accepted matches snapshot 1`] = `
"lineItems": Array [
Object {
"code": "line-item/night",
"includeFor": Array [
"customer",
"provider",
],
"lineTotal": Money {
"amount": 16500,
"currency": "USD",
@ -6052,6 +6119,9 @@ exports[`TransactionPanel - Sale accepted matches snapshot 1`] = `
},
Object {
"code": "line-item/provider-commission",
"includeFor": Array [
"provider",
],
"lineTotal": Money {
"amount": -1000,
"currency": "USD",

View file

@ -232,8 +232,10 @@ export class ListingPageComponent extends Component {
} = currentListing.attributes;
const { customAttributes } = currentListing.attributes;
const hasCategoryConfig = config.customAttributes && config.customAttributes.category;
const hasCategoryAttribute = customAttributes && customAttributes.category;
const category =
config.customAttributes.category && customAttributes && customAttributes.category ? (
hasCategoryConfig && hasCategoryAttribute ? (
<span>
<FormattedMessage id={`ListingPage.category.${customAttributes.category}`} />
<span className={css.separator}></span>