fix(Communities): ensure members count is updated when owner leaves community
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 https://github.com/status-im/status-go/pull/2429 Fixes #4074
This commit is contained in:
parent
23b72a9e8d
commit
14f75692c4
|
@ -136,6 +136,7 @@ QtObject:
|
||||||
proc setPubKey*(self: ChatsView, pubKey: string) =
|
proc setPubKey*(self: ChatsView, pubKey: string) =
|
||||||
self.pubKey = pubKey
|
self.pubKey = pubKey
|
||||||
self.messageView.pubKey = pubKey
|
self.messageView.pubKey = pubKey
|
||||||
|
self.communities.pubKey = pubKey
|
||||||
|
|
||||||
proc getFormatInput(self: ChatsView): QVariant {.slot.} = newQVariant(self.formatInputView)
|
proc getFormatInput(self: ChatsView): QVariant {.slot.} = newQVariant(self.formatInputView)
|
||||||
QtProperty[QVariant] formatInputView:
|
QtProperty[QVariant] formatInputView:
|
||||||
|
|
|
@ -41,6 +41,7 @@ QtObject:
|
||||||
myCommunityRequests*: seq[CommunityMembershipRequest]
|
myCommunityRequests*: seq[CommunityMembershipRequest]
|
||||||
importingCommunityState: CommunityImportState
|
importingCommunityState: CommunityImportState
|
||||||
communityImportingProcessId: string
|
communityImportingProcessId: string
|
||||||
|
pubKey*: string
|
||||||
|
|
||||||
proc setup(self: CommunitiesView) =
|
proc setup(self: CommunitiesView) =
|
||||||
self.QObject.setup
|
self.QObject.setup
|
||||||
|
@ -60,6 +61,7 @@ QtObject:
|
||||||
result.observedCommunity = newCommunityItemView(status)
|
result.observedCommunity = newCommunityItemView(status)
|
||||||
result.communityList = newCommunityList(status)
|
result.communityList = newCommunityList(status)
|
||||||
result.joinedCommunityList = newCommunityList(status)
|
result.joinedCommunityList = newCommunityList(status)
|
||||||
|
result.pubKey = ""
|
||||||
result.setup
|
result.setup
|
||||||
|
|
||||||
proc importingCommunityStateChanged*(self: CommunitiesView, state: int, communityImportingProcessId: string) {.signal.}
|
proc importingCommunityStateChanged*(self: CommunitiesView, state: int, communityImportingProcessId: string) {.signal.}
|
||||||
|
@ -390,6 +392,8 @@ QtObject:
|
||||||
self.joinedCommunitiesChanged()
|
self.joinedCommunitiesChanged()
|
||||||
var updatedCommunity = self.communityList.getCommunityById(communityId)
|
var updatedCommunity = self.communityList.getCommunityById(communityId)
|
||||||
updatedCommunity.joined = false
|
updatedCommunity.joined = false
|
||||||
|
let i = updatedCommunity.members.find(self.pubKey)
|
||||||
|
updatedCommunity.members.delete(i)
|
||||||
self.communityList.replaceCommunity(updatedCommunity)
|
self.communityList.replaceCommunity(updatedCommunity)
|
||||||
self.communitiesChanged()
|
self.communitiesChanged()
|
||||||
self.communityChanged(communityId)
|
self.communityChanged(communityId)
|
||||||
|
|
Loading…
Reference in New Issue