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

feat: new re-authorization flow for Microsoft #9510

Merged
merged 11 commits into from
May 23, 2024
Merged

Conversation

scmmishra
Copy link
Member

@scmmishra scmmishra commented May 21, 2024

This PR adds a cleaner re-authorization flow to Microsoft. This PR has the following changes

  1. Use reauthorization_required value for Microsoft Channel
  2. Refactor InboxReconnectionRequired to reuse the banner component
  3. Refactor microsoft/Reauthorize.vue to reuse InboxReconnectionRequired component
  4. Update reauthorizable.rb to update cache keys if the model has an inbox
  5. Update microsoft/callbacks_controller.rb to handle the reauthorization case with a redirect to the inbox settings page if the inbox already exists at the time of authorization.

How Has This Been Tested?

  • Local Instance
  • Staging Instance
  • Unit tests

Pending Tasks

  • Success Toast will do this in a follow-up PR with the screen

Demo

The following video shows the whole process of creation and re-authorization of the Microsoft channel

https://www.loom.com/share/e5cd9bd4439c4741b0dcfe66d67f88b3?sid=100f3642-43e4-46b3-8123-88a5dd9d8509

Copy link

linear bot commented May 21, 2024

@scmmishra scmmishra marked this pull request as ready for review May 21, 2024 09:15
@scmmishra
Copy link
Member Author

scmmishra commented May 21, 2024

@pranavrajs I figured the flow is simple enough that we don't need an additional screen for the reauthorization, let me know how it looks, I've attached a demo video.

However I can see the value added by the dedicated pages, easier to provide more information also more detailed error messages. Let me know how this flow looks, I can create a PR on top of this to add the additional screens

@scmmishra scmmishra requested a review from pranavrajs May 21, 2024 09:17
@pranavrajs
Copy link
Member

@scmmishra, great job! We wanted a separate page to display the error or success messages resulting from the flow.

Currently, during our initial inbox setup process, we redirect users to the dashboard when an error occurs, which can be confusing. This has led to multiple reports from people who don't fully understand the error.

This flow is fine. However, if we can ensure that the follow-up includes the screen mentioned in the issue, we can proceed with merging the PRs.

Copy link
Member

@pranavrajs pranavrajs left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise looks good.

@@ -20,6 +20,7 @@
get '/app/accounts/:account_id/settings/inboxes/new/microsoft', to: 'dashboard#index', as: 'app_new_microsoft_inbox'
get '/app/accounts/:account_id/settings/inboxes/new/:inbox_id/agents', to: 'dashboard#index', as: 'app_twitter_inbox_agents'
get '/app/accounts/:account_id/settings/inboxes/new/:inbox_id/agents', to: 'dashboard#index', as: 'app_microsoft_inbox_agents'
get '/app/accounts/:account_id/settings/inboxes/:inbox_id', to: 'dashboard#index', as: 'app_microsoft_inbox_settings'
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

The original callback redirected to the app_microsoft_inbox_agents this is the onboarding page where the admin is asked to add agents. The new route is for the inbox settings page, the user is redirected here when reauthorized, I can rename it to app_inbox_settings since it is not Microsoft specific

@scmmishra scmmishra requested a review from muhsin-k May 22, 2024 04:36
@scmmishra
Copy link
Member Author

scmmishra commented May 22, 2024

@muhsin-k need your review on this PR, also if you can test it once, it'd be great!

@scmmishra scmmishra temporarily deployed to staging-chatwoot May 22, 2024 04:38 Inactive
@muhsin-k muhsin-k temporarily deployed to chatwoot-pr-9510 May 22, 2024 05:06 Inactive
@scmmishra scmmishra temporarily deployed to chatwoot-pr-9510 May 23, 2024 07:21 Inactive
@scmmishra scmmishra temporarily deployed to chatwoot-pr-9510 May 23, 2024 10:03 Inactive
@scmmishra scmmishra merged commit eafd3ae into develop May 23, 2024
15 checks passed
@scmmishra scmmishra deleted the feature/cw-3291 branch May 23, 2024 10:33
clairton pushed a commit to clairton/chatwoot that referenced this pull request Jun 13, 2024
This PR adds a cleaner re-authorization flow to Microsoft. This PR has
the following changes

1. Use `reauthorization_required` value for Microsoft Channel
2. Refactor `InboxReconnectionRequired` to reuse the `banner` component
3. Refactor `microsoft/Reauthorize.vue` to reuse
`InboxReconnectionRequired` component
4. Update `reauthorizable.rb` to update cache keys if the model has an
inbox
5. Update `microsoft/callbacks_controller.rb` to handle the
reauthorization case with a redirect to the inbox settings page if the
inbox already exists at the time of authorization.

## How Has This Been Tested?

- [x] Local Instance
- [ ] Staging Instance
- [x] Unit tests

## Pending Tasks

- [ ] ~Success Toast~ will do this in a follow-up PR with the screen

## Demo

The following video shows the whole process of creation and
re-authorization of the Microsoft channel


https://www.loom.com/share/e5cd9bd4439c4741b0dcfe66d67f88b3?sid=100f3642-43e4-46b3-8123-88a5dd9d8509

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants