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

[GH-371] Fixed issue: Getting multiple DMs when Oauth token is revoked #408

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

raghavaggarwal2308
Copy link
Contributor

@raghavaggarwal2308 raghavaggarwal2308 commented Oct 9, 2023

Summary

  • The issue was caused because of the multiple API calls inside goroutines.
  • Created a single API to get the data for LHS and todo command.

Screenshots

image

Possible risks:

What to test?

  • Getting a single DM when we try to refresh the count in the left-hand sidebar after the OAuth token is revoked from GitLab.
  • We are getting proper data in the RHS.
Steps to reproduce:
  1. Connect your GItlab account.
  2. Revoke the OAuth token for your app from the application page on Gitlab.
  3. Refresh the counts in the left-hand sidebar.
    image
Environment:

MM version: v7.8.2
Node version: 14.18.0
Go version: 1.19.0

Ticket Link

Fixes #371

…ed (#42)

* [MI-3561] Fixed issue: Getting multiple DMs when Oauth token is revoked
- Created a single API to get the data for LHS and todo command.

* [MI-3561] Review fixes
1. Replaced 'babel-eslint' package with '@babel/eslint-parser' as the previous one was deprecated

* [MI-3561] Review fixes

* [MI-3561] Review fix
Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

LGTM. Great improvement for consolidating LHS data into one API request as well

One thing that comes to mind is the behavior when there are multiple tabs of Mattermost open. For instance, the desktop app his 3 instances of the Mattermost webapp running at once.

this.props.actions.getYourPrs(),
this.props.actions.getYourAssignments(),
]);
await this.props.actions.getLHSData();
Copy link
Contributor

Choose a reason for hiding this comment

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

Any thoughts on error handling here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mickmister In the left-hand sidebar we will not have any place to display the error. I think the only place we will be able to display the error will be the RHS. Currently, we are just logging the error in the server logs. Do you have any suggestions on it?

Copy link
Contributor

Choose a reason for hiding this comment

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

The main thing I noticed is that we call this.setState({refreshing: false}) here, which will not run if an error happens. Even if it's as simple as logging the error, I think we should have some sort of error handling there to make sure we still clean up the state after the call.

@raghavaggarwal2308
Copy link
Contributor Author

One thing that comes to mind is the behavior when there are multiple tabs of Mattermost open. For instance, the desktop app his 3 instances of the Mattermost webapp running at once.

@mickmister I am not sure what you are asking here. Can you please add some details?

@mickmister
Copy link
Contributor

mickmister commented Oct 10, 2023

@raghavaggarwal2308 When multiple tabs of Mattermost are open, they all receive the same websocket messages. It's possible two browsers call the LHS data endpoint at the same time because of the websocket message syncing. It's probably unlikely for them to be that simultaneous, enough to not take it into account, but it's still worth bringing up for discussion since we're changing how the LHS data works for the purpose of avoiding race conditions. If you think there are no issues, then that's good with me

@raghavaggarwal2308
Copy link
Contributor Author

@mickmister I have tested what you are saying for the following cases:

  • When a user reconnects his account.
  • When a webhook request is sent from Gitlab.
  • When a user clicks on the screen after a certain period of time: In this case if multiple tabs are open, then only the tab the user had clicked on will be updated and on the remaining tabs, the user has to refresh manually. I think that's how it should work ideally. Please correct me if I am wrong.

Everything was working fine. So, I don't think it will be an issue.

@mickmister
Copy link
Contributor

mickmister commented Oct 16, 2023

@raghavaggarwal2308 A server restart would be another reason why each tab needs to contact the server again, though reconnecting the account should do so as well. I think no further testing is needed here on your part

@mickmister mickmister added the 3: QA Review Requires review by a QA tester label Oct 16, 2023
Copy link

@AayushChaudhary0001 AayushChaudhary0001 left a comment

Choose a reason for hiding this comment

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

Tested and approved, working fine for single Dm and correct data shown in RHS, LGTM.

@avas27JTG avas27JTG merged commit c56accf into mattermost:master Nov 21, 2023
7 checks passed
@avas27JTG avas27JTG deleted the fix_issue_371 branch November 21, 2023 10:36
@avas27JTG avas27JTG mentioned this pull request Nov 29, 2023
@avas27JTG avas27JTG added this to the v1.8.0 milestone Nov 29, 2023
@mickmister mickmister mentioned this pull request Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: QA Review Requires review by a QA tester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DMs to inform the user their oAuth token has been revoked are received 3 or 4 times
4 participants