From 0e1d39cb8697079fb9801c4ea5c963a1486edf19 Mon Sep 17 00:00:00 2001 From: Jenni Nurmi Date: Fri, 31 May 2019 11:07:38 +0300 Subject: [PATCH 1/3] Fix bug in review link --- src/components/ActivityFeed/ActivityFeed.js | 36 +++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/components/ActivityFeed/ActivityFeed.js b/src/components/ActivityFeed/ActivityFeed.js index 95ab2616..7e9bb04d 100644 --- a/src/components/ActivityFeed/ActivityFeed.js +++ b/src/components/ActivityFeed/ActivityFeed.js @@ -25,6 +25,7 @@ import { isCustomerReview, isProviderReview, txRoleIsProvider, + txRoleIsCustomer, getUserTxRole, isRelevantPastTransition, } from '../../util/transaction'; @@ -94,10 +95,10 @@ Review.propTypes = { }; const hasUserLeftAReviewFirst = (userRole, transaction) => { - const isProvider = txRoleIsProvider(userRole); - return isProvider - ? txIsInFirstReviewBy(transaction, isProvider) - : txIsInFirstReviewBy(transaction, !isProvider); + // Because function txIsInFirstReviewBy uses isCustomer to check in which state the reviews are + // we should also use isCustomer insted of isProvider + const isCustomer = txRoleIsCustomer(userRole); + return txIsInFirstReviewBy(transaction, isCustomer); }; const resolveTransitionMessage = ( @@ -145,20 +146,21 @@ const resolveTransitionMessage = ( case TRANSITION_CANCEL: return ; case TRANSITION_COMPLETE: - // Show the leave a review link if the state is delivered or - // if current user is not the first to leave a review + // Show the leave a review link if the state is delivered and if the current user is the first to leave a review const reviewPeriodJustStarted = txIsDelivered(transaction); - const reviewPeriodIsOver = txIsReviewed(transaction); - const userHasLeftAReview = hasUserLeftAReviewFirst(ownRole, transaction); - const reviewLink = - reviewPeriodJustStarted || !(reviewPeriodIsOver || userHasLeftAReview) ? ( - - - - ) : null; + const reviewAsFirstLink = reviewPeriodJustStarted ? ( + + + + ) : null; - return ; + return ( + + ); case TRANSITION_REVIEW_1_BY_PROVIDER: case TRANSITION_REVIEW_1_BY_CUSTOMER: @@ -169,7 +171,7 @@ const resolveTransitionMessage = ( // one to leave a review const reviewPeriodIsOver = txIsReviewed(transaction); const userHasLeftAReview = hasUserLeftAReviewFirst(ownRole, transaction); - const reviewLink = !(reviewPeriodIsOver || userHasLeftAReview) ? ( + const reviewAsSecondLink = !(reviewPeriodIsOver || userHasLeftAReview) ? ( @@ -177,7 +179,7 @@ const resolveTransitionMessage = ( return ( ); } From 10c273962990b1f5b53d0bce7fabb0722f3258f9 Mon Sep 17 00:00:00 2001 From: Jenni Nurmi Date: Mon, 10 Jun 2019 11:02:45 +0300 Subject: [PATCH 2/3] Temporarily skip audit warning about axios --- .auditrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.auditrc b/.auditrc index 3fa278e1..c37bf8c1 100644 --- a/.auditrc +++ b/.auditrc @@ -2,4 +2,6 @@ exports.exceptions = [ // Add exceptions to audit script: // // Severity: low, lodash (< 4.17.5), used heavily in our CRA fork // "https://npmjs.com/advisories/577", + // Temporarily skip warning about axios until SDK is updated + "https://npmjs.com/advisories/880", ]; From e43572ce9ca355598accf5fdeaf5a91711de9ea9 Mon Sep 17 00:00:00 2001 From: Jenni Nurmi Date: Mon, 3 Jun 2019 13:36:44 +0300 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 759b6178..82efe230 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2019-XX-XX +- [fix] Fix a bug in showing review links. Because of the bug the second review link was not visible + in `ActivityFeed`. [#1106](https://github.com/sharetribe/flex-template-web/pull/1106) - [fix] Emptying the priceFilter component in the searchPage caused a page breaking error. [#1101](https://github.com/sharetribe/flex-template-web/pull/1101)