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

Feature see guest responses #193

Merged
merged 3 commits into from
Mar 29, 2017
Merged

Conversation

justinl-y
Copy link
Collaborator

Completes issue #25

<View style={styles.imageView}>
{(guest[1] === '+' && <Image source={inviteConfirmationStatus.YES.imageSource} />)
|| (guest[1] === '-' && <Image source={inviteConfirmationStatus.NO.imageSource} />)
|| <Image source={inviteConfirmationStatus.UNKNOWN.imageSource} />}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is terrifying. It's nice to see that you understand short circuits, but this one goes pretty far!

You should write a function that takes a guest (or whatever guest[1] is) and returns an image component.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

inviteResponses[key].forEach((item) => {
guestResponses.push([item, '?']);
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest a refactor to write a function:

const createGuestResponse = (key, item) => {
  const responseMap = {
    userAccept: [`${item.firstName} ${item.lastName}`, '+'],
    userReject: [`${item.firstName} ${item.lastName}`, '-'],
    ...etc
  }

  return responseMap[key];
}

And just throw in a guard clause to handle the inviteResponses[key].length > 0 repetition.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.


const getPotluckInviteResponses = (potluckId) => {
const promises = [
processtPotluckUserInviteResponses(potluckId, getGuestInviteUserDetailsAccept) || [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo? processt

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@BlakeTurner BlakeTurner merged commit c182bc9 into develop Mar 29, 2017
@BlakeTurner BlakeTurner deleted the feature-see-guest-responses branch March 29, 2017 20:31
@justinl-y
Copy link
Collaborator Author

PR issues actioned.

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.

None yet

2 participants