Open nilesingalls opened 6 months ago
@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?
@ayusht2810 Yeah that sounds great :+1:
@nilesingalls Are you wanting to also affect existing deactivated users? That would likely require SQL that we may be able to provide for this
@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) https://github.com/mattermost/mattermost-plugin-github/blob/fba634d51d347d2c0eddfd9b9110faef289662fc/server/plugin/plugin.go#L916
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.
@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?
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.
@nilesingalls Thanks that makes sense. Are you able to have them each run /github disconnect
?
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.