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

Notifications: wiring and integration with API #318

Merged
merged 40 commits into from
May 25, 2020

Conversation

rperez89
Copy link
Contributor

Working branch for better review and deployment

@rperez89 rperez89 requested a review from sohkai May 12, 2020 19:18
@vercel
Copy link

vercel bot commented May 12, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/aragon/court-dashboard/bk10y5r6m
✅ Preview: https://court-dashboard-git-email-notifications-testing.aragon.now.sh

Copy link
Contributor

@sohkai sohkai left a comment

Choose a reason for hiding this comment

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

My last comment builds off of #316. I'm understanding how everything is hooked up, but still think we could improve where the logic lives and how to create good abstractions around it.

In terms of moving forward, should we merge all the other PRs, then merge development into this PR, and continue working off of it?

@@ -0,0 +1,3 @@
export const UNAUTHORIZED_RESPONSE = 401
Copy link
Contributor

Choose a reason for hiding this comment

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

src/hooks/usePreferences.js Outdated Show resolved Hide resolved
<React.Fragment>
{!fetching && (
<Modal
width={Math.min(76 * GU, width - 40)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
width={Math.min(76 * GU, width - 40)}
width={Math.min(76 * GU, width - 5 * GU)}

.join(', ')

return {
needsSignature:
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like these error and authentication validation bits could be taken out and abstracted into a function, e.g.

function notificationsApi(req) {
  const rawResponse = await req()

  if (!rawResponse.ok) {
    const errors = jsonResponse.errors
      .map(err => Object.values(err).join(', '))
      .join(', ')

    return {
      needsSignature:
        rawResponse.status === UNAUTHORIZED_RESPONSE ||
        rawResponse.status === USER_NOT_FOUND ||
        rawResponse.status === FORBIDDEN_RESPONSE,
      error: errors,
    }
  }

  return rawResponse
}

src/hooks/useEmailNotifications.js Show resolved Hide resolved
@sohkai sohkai changed the base branch from development to master May 15, 2020 18:46
@sohkai sohkai changed the base branch from master to development May 15, 2020 18:46
@sohkai sohkai changed the title Notifications [WIP]: Email notifications testing Notifications: wiring and integration with API May 19, 2020
Copy link
Contributor

@sohkai sohkai left a comment

Choose a reason for hiding this comment

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

🙌🙌🙌 I think we've squashed the bugs and we're good to go!

@rperez89
Copy link
Contributor Author

🙌🙌🙌 I think we've squashed the bugs and we're good to go!

would love a bit more of testing from our folks? did you guys have a chance to try it?

…#337)

* testing ref

* Global preferences:  Animate Notifications Box height (#336)

* Email notifications manager: Animate Box height

* Screens: Adjust padding and margins

* unnecessary margin on preferences mode

Co-authored-by: Rodrigo Perez <rodrigopi1989@gmail.com>

* Email: prevent same email address to be updated

Co-authored-by: Fabrizio Vigevani <fabriziovigevani@gmail.com>
* Use Input hook and screens refactors

* Change URL endpoint for the services
@rperez89 rperez89 merged commit 8c8f253 into development May 25, 2020
@rperez89 rperez89 deleted the email-notifications-testing branch May 25, 2020 20:44
@sohkai sohkai mentioned this pull request Jun 3, 2020
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.

2 participants