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

Ensure owner is removed from community when leaving community #2429

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

0x-r4bbit
Copy link
Member

@0x-r4bbit 0x-r4bbit commented Nov 12, 2021

Prior to this commit, when a community owner leaves her community,
status-go would just set the joined flag to false without updating the
members list. This results in wrong data as the number of members doesn't
match the reality.

This commit removes the owner of the community from the members list
when she's leaving the community.

@ghost
Copy link

ghost commented Nov 12, 2021

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?
  • Have you tested changes with mobile?
  • Have you tested changes with desktop?

@@ -726,8 +726,10 @@ func (m *Manager) LeaveCommunity(id types.HexBytes) (*Community, error) {
if community == nil {
return nil, ErrOrgNotFound
}
community.RemoveUserFromOrg(m.identity)
Copy link
Member Author

Choose a reason for hiding this comment

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

Notice that I'm not handling possible errors here. When this API is called we know that the user exists in the org so removal should always go fine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: github shows some indentation issue

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed!

@status-im-auto
Copy link
Member

status-im-auto commented Nov 12, 2021

Jenkins Builds

Click to see older builds (9)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 5640055 #1 2021-11-12 10:30:53 ~2 min linux 📦zip
✔️ 5640055 #1 2021-11-12 10:32:05 ~4 min ios 📦zip
✔️ 5640055 #1 2021-11-12 10:35:22 ~7 min android 📦aar
✔️ 5fa4337 #2 2021-11-12 11:38:50 ~3 min ios 📦zip
✔️ 5fa4337 #2 2021-11-12 11:39:41 ~4 min linux 📦zip
✔️ 5fa4337 #2 2021-11-12 11:40:43 ~5 min android 📦aar
✔️ 3424e5c #3 2021-11-15 12:03:01 ~3 min linux 📦zip
✔️ 3424e5c #3 2021-11-15 12:03:49 ~4 min ios 📦zip
✔️ 3424e5c #3 2021-11-15 12:05:19 ~5 min android 📦aar
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 44f6685 #4 2021-11-16 10:56:37 ~3 min linux 📦zip
✔️ 44f6685 #4 2021-11-16 10:56:56 ~3 min ios 📦zip
✔️ 44f6685 #4 2021-11-16 10:58:04 ~5 min android 📦aar
✔️ f3c0731 #5 2021-11-16 14:44:39 ~2 min linux 📦zip
✔️ f3c0731 #5 2021-11-16 14:44:44 ~2 min ios 📦zip
✔️ f3c0731 #5 2021-11-16 14:47:52 ~5 min android 📦aar

0x-r4bbit added a commit to status-im/status-desktop that referenced this pull request Nov 12, 2021
…ommunity

When an owner of a community leaves its own community, we optimistically update the
members list in Status Desktop. The `LeaveCommunity` API that is called via status-lib
has been updated to correctly remove that member as well.

This depends on status-im/status-go#2429

Fixes #4074
@@ -726,8 +726,10 @@ func (m *Manager) LeaveCommunity(id types.HexBytes) (*Community, error) {
if community == nil {
return nil, ErrOrgNotFound
}
community.RemoveUserFromOrg(m.identity)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: github shows some indentation issue

@0x-r4bbit 0x-r4bbit force-pushed the fix/leave-community branch 3 times, most recently from 3424e5c to 44f6685 Compare November 16, 2021 10:52
Prior to this commit, when a community owner leaves her community,
status-go would just set the `joined` flag to `false` without updating the
members list. This results in wrong data as the number of members doesn't
match the reality.

This commit removes the owner of the community from the members list
when she's leaving the community.
@0x-r4bbit 0x-r4bbit merged commit 1ffcf23 into develop Nov 17, 2021
@0x-r4bbit 0x-r4bbit deleted the fix/leave-community branch November 17, 2021 10:50
0x-r4bbit added a commit to status-im/status-desktop that referenced this pull request Nov 18, 2021
…ommunity

When an owner of a community leaves its own community, we optimistically update the
members list in Status Desktop. The `LeaveCommunity` API that is called via status-lib
has been updated to correctly remove that member as well.

This depends on status-im/status-go#2429

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

Successfully merging this pull request may close these issues.

4 participants