From 5a52ccbc1fda23ba406eb7d80fd2e4146a418259 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Fri, 12 Jan 2018 09:04:34 +0200 Subject: [PATCH] Improve transition docs --- .../TransactionPage/TransactionPage.duck.js | 4 ++-- src/util/types.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/containers/TransactionPage/TransactionPage.duck.js b/src/containers/TransactionPage/TransactionPage.duck.js index 069bb552..ea007131 100644 --- a/src/containers/TransactionPage/TransactionPage.duck.js +++ b/src/containers/TransactionPage/TransactionPage.duck.js @@ -374,7 +374,7 @@ export const sendMessage = (txId, message) => (dispatch, getState, sdk) => { const REVIEW_TX_INCLUDES = ['reviews', 'reviews.author', 'reviews.subject']; // If other party has already sent a review, we need to make transition to -// TX_TRANSITION_REVIEW_BY__SECOND +// TRANSITION_REVIEW_2_BY_ const sendReviewAsSecond = (id, params, role, dispatch, sdk) => { const transition = role === CUSTOMER ? TRANSITION_REVIEW_2_BY_CUSTOMER : TRANSITION_REVIEW_2_BY_PROVIDER; @@ -398,7 +398,7 @@ const sendReviewAsSecond = (id, params, role, dispatch, sdk) => { }; // If other party has not yet sent a review, we need to make transition to -// TX_TRANSITION_REVIEW_BY__FIRST +// TRANSITION_REVIEW_1_BY_ // However, the other party might have made the review after previous data synch point. // So, error is likely to happen and then we must try another state transition // by calling sendReviewAsSecond(). diff --git a/src/util/types.js b/src/util/types.js index 1d3bf893..f08978a4 100644 --- a/src/util/types.js +++ b/src/util/types.js @@ -183,9 +183,9 @@ export const TRANSITION_CANCEL = 'transition/cancel'; // The backend will mark the transaction completed. export const TRANSITION_COMPLETE = 'transition/mark-delivered'; -// Review transitions -// Reviews are given through transaction transitions. -// Either party (provider or customer) can be the first to give a review. +// Reviews are given through transaction transitions. Review 1 can be +// by provider or customer, and review 2 will be the other party of +// the transaction. export const TRANSITION_REVIEW_1_BY_PROVIDER = 'transition/review-by-provider-first'; export const TRANSITION_REVIEW_2_BY_PROVIDER = 'transition/review-by-provider-second'; export const TRANSITION_REVIEW_1_BY_CUSTOMER = 'transition/review-by-customer-first'; @@ -194,7 +194,7 @@ export const TRANSITION_EXPIRE_CUSTOMER_REVIEW_PERIOD = 'transition/mark-reviewe export const TRANSITION_EXPIRE_PROVIDER_REVIEW_PERIOD = 'transition/mark-reviewed-by-provider'; export const TRANSITION_EXPIRE_REVIEW_PERIOD = 'transition/auto-complete-without-reviews'; -export const TX_TRANSITIONS = [ +export const TRANSITIONS = [ TRANSITION_ACCEPT, TRANSITION_CANCEL, TRANSITION_COMPLETE, @@ -253,7 +253,7 @@ export const txIsReviewed = tx => areReviewsCompleted(txLastTransition(tx)); propTypes.transition = shape({ at: instanceOf(Date).isRequired, by: oneOf(TX_TRANSITION_ACTORS).isRequired, - transition: oneOf(TX_TRANSITIONS).isRequired, + transition: oneOf(TRANSITIONS).isRequired, }); const firstReviewTransitions = [TRANSITION_REVIEW_1_BY_CUSTOMER, TRANSITION_REVIEW_1_BY_PROVIDER]; @@ -306,7 +306,7 @@ propTypes.transaction = shape({ attributes: shape({ createdAt: instanceOf(Date).isRequired, lastTransitionedAt: instanceOf(Date).isRequired, - lastTransition: oneOf(TX_TRANSITIONS).isRequired, + lastTransition: oneOf(TRANSITIONS).isRequired, // An enquiry won't need a total sum nor a booking so these are // optional.