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

star/un-star a conversation #28

Merged
merged 22 commits into from
Jul 24, 2019
Merged

star/un-star a conversation #28

merged 22 commits into from
Jul 24, 2019

Conversation

breitman
Copy link
Collaborator

No description provided.

@hallettj
Copy link
Contributor

I'd like to use a star character that is more colorful, like this one: ⭐

@hallettj
Copy link
Contributor

I'm sorry, it's my fault that the Apollo client cache was not updating after mock responses. I explained that when Apollo reads a response from a mutation it can look up a value in the cache with the same type and id and update that value automatically, and I explained that responses must include an id property for that to work. What I forgot is that responses also need to have a __typename property. You don't need to request __typename in operations - it is included automatically in graphql responses. But because the test fixture responses are handwritten we do need to put in __typename properties explicitly there.

I pushed a change to add the necessary __typename properties, and now you're tests pass. You can remove the second $.getAccountMock because the response from $.flagMock is sufficient to update client state. I also made a configuration change so that we will see warnings in test output if there are missing __typename properties in the future.

@breitman breitman requested a review from hallettj July 18, 2019 15:21
Copy link
Contributor

@hallettj hallettj left a comment

Choose a reason for hiding this comment

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

This is great work! You have implemented a feature that touches nearly every part of the tech stack for this app, and you have shown good initiative.

packages/client/src/Conversation.tsx Outdated Show resolved Hide resolved
packages/client/src/Conversation.tsx Outdated Show resolved Hide resolved
packages/client/src/Conversation.tsx Outdated Show resolved Hide resolved
packages/client/src/Conversation.tsx Show resolved Hide resolved
packages/client/src/Dashboard.test.tsx Show resolved Hide resolved
packages/main/jest.config.js Show resolved Hide resolved
packages/main/schema/schema.graphql Show resolved Hide resolved
packages/main/src/models/conversation.ts Outdated Show resolved Hide resolved
packages/main/src/queue/index.ts Outdated Show resolved Hide resolved
@breitman breitman requested a review from hallettj July 19, 2019 20:11
Copy link
Contributor

@hallettj hallettj left a comment

Choose a reason for hiding this comment

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

There is lots of good progress here. Please remember to either remove or update the isStarred calculation in models/conversation.ts.

packages/client/src/Conversation.tsx Show resolved Hide resolved
packages/client/src/Dashboard.test.tsx Show resolved Hide resolved
})
//if not all selected star, we want to star instead of unstar
if (isStarred && selected.length > 1) {
isStarred =
Copy link
Contributor

Choose a reason for hiding this comment

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

Assigning isStarred twice is a code smell. The logic for this second assignment is correct - using every instead of reduce covers the cases that you need. The first assignment is redundant. You can delete the first assignment, and delare isStarred with const.

{isStarred ? <StarBorder /> : <StarIcon />}
</IconButton>
<Tooltip
title="Archive Selected Conversation"
Copy link
Contributor

Choose a reason for hiding this comment

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

These tooltips are great! But please pluralize "Conversations" for the list view actions.

packages/client/src/testing/fixtures.ts Outdated Show resolved Hide resolved
flag: handler({
enqueue(params: { accountId: ID; box: { name: string }; uids: number[] }) {
cache.addFlag({ ...params, flag: "\\Flagged" })
setFlagged: handler({
Copy link
Contributor

Choose a reason for hiding this comment

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

Good stuff. Would you remove the unFlag handler now that it is not used anymore?

packages/main/src/queue/index.ts Outdated Show resolved Hide resolved
packages/main/src/resolvers/conversation.ts Outdated Show resolved Hide resolved
@breitman breitman requested a review from hallettj July 23, 2019 14:52
Copy link
Contributor

@hallettj hallettj left a comment

Choose a reason for hiding this comment

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

More good progress! But there are some outstanding comments from my previous review.

packages/main/src/models/conversation.ts Outdated Show resolved Hide resolved
packages/main/src/resolvers/conversation.ts Outdated Show resolved Hide resolved
@breitman breitman requested a review from hallettj July 23, 2019 19:54
@breitman breitman merged commit 08e6387 into master Jul 24, 2019
@breitman breitman deleted the BR/Star branch July 24, 2019 15:46
@hallettj
Copy link
Contributor

hallettj commented Nov 3, 2019

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@hallettj
Copy link
Contributor

hallettj commented Nov 4, 2019

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants