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-902]:Added check to uninstall server if not found in KV store #914

Merged
merged 5 commits into from
Jan 18, 2024

Conversation

Kshitij-Katiyar
Copy link
Contributor

Summary

  • Added the additional check to remove the instance from the instance array if the key is not present in the KV store.

Issue

* [MI-2738]:Added check to uninstall server if not found in KV store

* [MI-2738]:Fixed lint errors
@mattermost-build
Copy link
Contributor

Hello @Kshitij-Katiyar,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

server/instances.go Outdated Show resolved Hide resolved
@Kshitij-Katiyar Kshitij-Katiyar changed the title [MI-2738]:Added check to uninstall server if not found in KV store [GH-902]:Added check to uninstall server if not found in KV store Feb 14, 2023
server/instances.go Outdated Show resolved Hide resolved
server/instances.go Outdated Show resolved Hide resolved
server/instances.go Outdated Show resolved Hide resolved
server/instances.go Outdated Show resolved Hide resolved
server/instances.go Outdated Show resolved Hide resolved
@hanzei hanzei added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Feb 21, 2023
@hanzei hanzei linked an issue Feb 21, 2023 that may be closed by this pull request
Comment on lines 216 to 232
func (p *Plugin) disconnectUsers(instance Instance) error {
err := p.userStore.MapUsers(func(user *User) error {
if !user.ConnectedInstances.Contains(instance.GetID()) {
return nil
}

_, err := p.disconnectUser(instance, user)
if err != nil {
p.infof("UninstallInstance: failed to disconnect user: %v", err)
}
return nil
})
if err != nil {
return err
}
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

Just putting this here for discussion. Let me know if you think we should change something @Kshitij-Katiyar

This function will always return nil because the inner function always returns nil

I'm thinking we can pull out the inner function into disconnectUser, and have this called in a loop on line 192, instead of having a disconnectUsers function. It seems the pre-existing code block already had this behavior though.

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 sure I have reverted the changes for disconnectUsers function.

@hanzei hanzei requested review from srkgupta and removed request for trilopin February 22, 2023 06:59
Copy link
Contributor

@srkgupta srkgupta left a comment

Choose a reason for hiding this comment

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

Thanks @Kshitij-Katiyar. The changes LGTM.

@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@codecov-commenter
Copy link

Codecov Report

Patch coverage has no change and project coverage change: -0.21 ⚠️

Comparison is base (7a5c616) 30.14% compared to head (16bcae5) 29.93%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #914      +/-   ##
==========================================
- Coverage   30.14%   29.93%   -0.21%     
==========================================
  Files          49       49              
  Lines        7467     7526      +59     
==========================================
+ Hits         2251     2253       +2     
- Misses       5027     5084      +57     
  Partials      189      189              
Impacted Files Coverage Δ
server/instances.go 29.65% <0.00%> (-0.53%) ⬇️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@hanzei
Copy link
Collaborator

hanzei commented Sep 1, 2023

@AayushChaudhary0001 Would you be open to reviewing this PR?

@hanzei hanzei requested review from AayushChaudhary0001 and removed request for DHaussermann October 16, 2023 20:37
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 this PR for Jira server, working fine. The user is able to uninstall the server instance even if it is not running. Approved

@avas27JTG avas27JTG merged commit ceac791 into mattermost:master Jan 18, 2024
@avas27JTG avas27JTG deleted the MM-902 branch January 18, 2024 10:15
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 Contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to uninstall server
8 participants