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

cleanup / removal of inactive users #749

Open
nilesingalls opened this issue Feb 23, 2024 · 6 comments
Open

cleanup / removal of inactive users #749

nilesingalls opened this issue Feb 23, 2024 · 6 comments
Labels
Milestone

Comments

@nilesingalls
Copy link

nilesingalls commented Feb 23, 2024

As a Mattermost administrator, what is the best approach to remove subscriptions for inactive users?

We have a few former users showing up in mattermost logs that I'd like to address.

"timestamp":"2024-02-23 13:30:54.563 Z","level":"warn","msg":"Failed to search for review","caller":"app/plugin_api.go:987","plugin_id":"github","query":"is:pr is:open review-requested:REDACTED archived:false ","userid":"REDACTED","github username":"REDACTED","error":"GET https://api.github.com/search/issues?q=is%3Apr+is%3Aopen+review-requested%3AREDACTED+archived%3Afalse+: 403 API rate limit exceeded for user ID REDACTED. If you reach out to GitHub Support for help, please include the request ID REDACTED [rate reset in 10s]"}

@ayusht2810 ayusht2810 added this to the v2.3.0 milestone Apr 5, 2024
@ayusht2810
Copy link
Contributor

@mickmister Regarding the approach for the above issue, we can implement the UserHasBeenDeactivated Hook, and whenever a user is deactivated, we can check for the subscriptions linked to the user, if any and delete the subscription. What are your thoughts on this approach, or do you have any other solutions for the approach?

@mickmister
Copy link
Member

@ayusht2810 Yeah that sounds great 👍

@nilesingalls Are you wanting to also affect existing deactivated users? That would likely require SQL that we may be able to provide for this

@ayusht2810
Copy link
Contributor

@mickmister Regarding the above issue, I misunderstood it and posted the wrong approach to it. Sorry for that.
I think the issue states that they don't want to receive the subscription for a user who is inactive on GitHub, as shown in the logs "query":"is:pr is:open review-requested:REDACTED archived:false ","userid":"REDACTED","github username":"REDACTED".
But I think the issue is arising from the function HasUnreads (which posts the user's GitHub todos in certain time interval)

query := getReviewSearchQuery(username, config.GitHubOrg)

This function is invoked from the /connected API, which is called at various places from the client, due to which we are getting the above issue.
Isn't deactivating the user from Mattermost server (as the user is also inactive from GitHub) a way to resolve or should we check if the user exist on GitHub and perform further actions?
What are your thoughts on this? Let me know if I am missing something here.

@mickmister
Copy link
Member

@ayusht2810 Yeah it doesn't make much sense that these queries would be getting executed if the user is deactivated, and thus not logged into Mattermost. @nilesingalls Are you certain these particular errors are occurring for users that are deactivated from Mattermost?

@nilesingalls
Copy link
Author

nilesingalls commented Apr 26, 2024

These are users who are active in our Mattermost instance but no longer have a github account associated to our github organization. Perhaps our use case is unique in that regard, but we split off a group of users into a separate company.

@mickmister
Copy link
Member

@nilesingalls Thanks that makes sense. Are you able to have them each run /github disconnect?

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

No branches or pull requests

3 participants