Expose which transitions lead to request

This commit is contained in:
Vesa Luusua 2019-01-22 21:46:11 +02:00
parent 419dbb05d8
commit c33afc9b0c
2 changed files with 4 additions and 6 deletions

View file

@ -3,7 +3,7 @@ import isUndefined from 'lodash/isUndefined';
import config from '../config';
import { denormalisedResponseEntities, ensureOwnListing } from '../util/data';
import { storableError } from '../util/errors';
import { TRANSITION_REQUEST, TRANSITION_REQUEST_AFTER_ENQUIRY } from '../util/transaction';
import { transitionsToRequested } from '../util/transaction';
import { LISTING_STATE_DRAFT } from '../util/types';
import * as log from '../util/log';
import { authInfo } from './Auth.duck';
@ -316,7 +316,7 @@ export const fetchCurrentUserNotifications = () => (dispatch, getState, sdk) =>
const apiQueryParams = {
only: 'sale',
last_transitions: [TRANSITION_REQUEST, TRANSITION_REQUEST_AFTER_ENQUIRY],
last_transitions: transitionsToRequested,
page: 1,
per_page: NOTIFICATION_PAGE_SIZE,
};

View file

@ -56,10 +56,8 @@ const txLastTransition = tx => ensureTransaction(tx).attributes.lastTransition;
export const txIsEnquired = tx => txLastTransition(tx) === TRANSITION_ENQUIRE;
export const txIsRequested = tx => {
const transition = txLastTransition(tx);
return transition === TRANSITION_REQUEST || transition === TRANSITION_REQUEST_AFTER_ENQUIRY;
};
export const transitionsToRequested = [TRANSITION_REQUEST, TRANSITION_REQUEST_AFTER_ENQUIRY];
export const txIsRequested = tx => transitionsToRequested.includes(txLastTransition(tx));
export const txIsAccepted = tx => txLastTransition(tx) === TRANSITION_ACCEPT;