fix(CommunityMembershipSetupDialog): wait for the Join Permission response only
- introduce a new boolean property `checkingPermissionToJoinInProgress` and use it to enable/disable the Join (share addresses) button when joining a community - we don't have to wait for both join and channels permissions check to finish, as the former is much faster - renamed `joinPermissionsCheckSuccessful` to `joinPermissionsCheckCompletedWithoutErrors` to avoid confusion Fixes #14680
This commit is contained in:
parent
e82207c7cb
commit
93d808d020
|
@ -267,3 +267,6 @@ method removeCommunityChat*(self: AccessInterface, communityId: string, channelI
|
|||
|
||||
method promoteSelfToControlNode*(self: AccessInterface, communityId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getCheckingPermissionToJoinInProgress*(self: AccessInterface): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
|
|
@ -97,6 +97,7 @@ method setAllCommunities*(self: Module, communities: seq[CommunityDto])
|
|||
method setCuratedCommunities*(self: Module, curatedCommunities: seq[CommunityDto])
|
||||
proc buildTokensAndCollectiblesFromAllCommunities(self: Module)
|
||||
proc buildTokensAndCollectiblesFromCommunities(self: Module, communities: seq[CommunityDto])
|
||||
proc setCheckingPermissionToJoinInProgress(self: Module, inProgress: bool)
|
||||
|
||||
proc newModule*(
|
||||
delegate: delegate_interface.AccessInterface,
|
||||
|
@ -131,7 +132,7 @@ proc newModule*(
|
|||
result.moduleLoaded = false
|
||||
result.events = events
|
||||
result.curatedCommunitiesLoaded = false
|
||||
result.checkingPermissionToJoinInProgress = false
|
||||
result.setCheckingPermissionToJoinInProgress(false)
|
||||
result.checkingAllChannelPermissionsInProgress = false
|
||||
|
||||
method delete*(self: Module) =
|
||||
|
@ -859,7 +860,7 @@ method checkPermissions*(self: Module, communityId: string, sharedAddresses: seq
|
|||
|
||||
self.controller.asyncCheckPermissionsToJoin(communityId, sharedAddresses)
|
||||
self.view.setJoinPermissionsCheckSuccessful(false)
|
||||
self.checkingPermissionToJoinInProgress = true
|
||||
self.setCheckingPermissionToJoinInProgress(true)
|
||||
|
||||
self.controller.asyncCheckAllChannelsPermissions(communityId, sharedAddresses)
|
||||
self.view.setChannelsPermissionsCheckSuccessful(false)
|
||||
|
@ -938,9 +939,18 @@ proc updateCheckingPermissionsInProgressIfNeeded(self: Module, inProgress = fals
|
|||
return
|
||||
self.view.setCheckingPermissionsInProgress(inProgress)
|
||||
|
||||
method getCheckingPermissionToJoinInProgress*(self: Module): bool =
|
||||
self.checkingPermissionToJoinInProgress
|
||||
|
||||
proc setCheckingPermissionToJoinInProgress(self: Module, inProgress: bool) =
|
||||
if self.checkingPermissionToJoinInProgress == inProgress:
|
||||
return
|
||||
self.checkingPermissionToJoinInProgress = inProgress
|
||||
self.view.checkingPermissionToJoinInProgressChanged()
|
||||
|
||||
method onCommunityCheckPermissionsToJoinFailed*(self: Module, communityId: string, error: string) =
|
||||
self.view.setJoinPermissionsCheckSuccessful(false)
|
||||
self.checkingPermissionToJoinInProgress = false
|
||||
self.setCheckingPermissionToJoinInProgress(false)
|
||||
self.updateCheckingPermissionsInProgressIfNeeded(inProgress = false)
|
||||
|
||||
method onCommunityCheckAllChannelPermissionsFailed*(self: Module, communityId: string, error: string) =
|
||||
|
@ -954,7 +964,7 @@ method onCommunityCheckPermissionsToJoinResponse*(self: Module, communityId: str
|
|||
self.joiningCommunityDetails.communityIdForPermissions != communityId:
|
||||
return
|
||||
self.applyPermissionResponse(communityId, checkPermissionsToJoinResponse.permissions)
|
||||
self.checkingPermissionToJoinInProgress = false
|
||||
self.setCheckingPermissionToJoinInProgress(false)
|
||||
self.view.setJoinPermissionsCheckSuccessful(true)
|
||||
self.updateCheckingPermissionsInProgressIfNeeded(inProgress = false)
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ QtObject:
|
|||
discordImportHasCommunityImage: bool
|
||||
downloadingCommunityHistoryArchives: bool
|
||||
checkingPermissionsInProgress: bool
|
||||
joinPermissionsCheckSuccessful: bool
|
||||
joinPermissionsCheckCompletedWithoutErrors: bool
|
||||
channelsPermissionsCheckSuccessful: bool
|
||||
myRevealedAddressesStringForCurrentCommunity: string
|
||||
myRevealedAirdropAddressForCurrentCommunity: string
|
||||
|
@ -123,7 +123,7 @@ QtObject:
|
|||
result.collectiblesListModel = newTokenListModel()
|
||||
result.collectiblesListModelVariant = newQVariant(result.collectiblesListModel)
|
||||
result.checkingPermissionsInProgress = false
|
||||
result.joinPermissionsCheckSuccessful = false
|
||||
result.joinPermissionsCheckCompletedWithoutErrors = false
|
||||
result.channelsPermissionsCheckSuccessful = false
|
||||
|
||||
proc load*(self: View) =
|
||||
|
@ -802,17 +802,26 @@ QtObject:
|
|||
read = getCheckingPermissionsInProgress
|
||||
notify = checkingPermissionsInProgressChanged
|
||||
|
||||
proc getCheckingPermissionToJoinInProgress*(self: View): bool {.slot.} =
|
||||
self.delegate.getCheckingPermissionToJoinInProgress
|
||||
|
||||
proc checkingPermissionToJoinInProgressChanged*(self: View) {.signal.}
|
||||
|
||||
QtProperty[bool] checkingPermissionToJoinInProgress:
|
||||
read = getCheckingPermissionToJoinInProgress
|
||||
notify = checkingPermissionToJoinInProgressChanged
|
||||
|
||||
proc joinPermissionsCheckSuccessfulChanged*(self: View) {.signal.}
|
||||
|
||||
proc setJoinPermissionsCheckSuccessful*(self: View, successful: bool) =
|
||||
if (self.joinPermissionsCheckSuccessful == successful): return
|
||||
self.joinPermissionsCheckSuccessful = successful
|
||||
if (self.joinPermissionsCheckCompletedWithoutErrors == successful): return
|
||||
self.joinPermissionsCheckCompletedWithoutErrors = successful
|
||||
self.joinPermissionsCheckSuccessfulChanged()
|
||||
|
||||
proc getJoinPermissionsCheckSuccessful*(self: View): bool {.slot.} =
|
||||
return self.joinPermissionsCheckSuccessful
|
||||
return self.joinPermissionsCheckCompletedWithoutErrors
|
||||
|
||||
QtProperty[bool] joinPermissionsCheckSuccessful:
|
||||
QtProperty[bool] joinPermissionsCheckCompletedWithoutErrors:
|
||||
read = getJoinPermissionsCheckSuccessful
|
||||
notify = joinPermissionsCheckSuccessfulChanged
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick.Layouts 1.14
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQml 2.15
|
||||
|
||||
import Storybook 1.0
|
||||
import Models 1.0
|
||||
|
@ -38,7 +39,7 @@ SplitView {
|
|||
closePolicy: Popup.NoAutoClose
|
||||
|
||||
isEditMode: ctrlIsEditMode.checked
|
||||
communityId: "community_id"
|
||||
communityId: "ddls"
|
||||
communityName: ctrlCommunityName.text
|
||||
communityIcon: {
|
||||
if (ctrlIconStatus.checked)
|
||||
|
@ -55,7 +56,8 @@ SplitView {
|
|||
|
||||
isInvitationPending: ctrlIsInvitationPending.checked
|
||||
requirementsCheckPending: ctrlRequirementsCheckPending.checked
|
||||
joinPermissionsCheckSuccessful: ctrlJoinPermissionsCheckSuccessful.checked
|
||||
checkingPermissionToJoinInProgress: ctrlCheckingPermissionToJoinInProgress.checked
|
||||
joinPermissionsCheckCompletedWithoutErrors: ctrlJoinPermissionsCheckCompletedWithoutErrors.checked
|
||||
|
||||
walletAccountsModel: WalletAccountsModel {}
|
||||
walletAssetsModel: root.walletAssetStore.groupedAccountAssetsModel
|
||||
|
@ -220,10 +222,24 @@ Nemo enim 😋 ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
|
|||
}
|
||||
|
||||
CheckBox {
|
||||
Layout.leftMargin: 12
|
||||
id: ctrlJoinPermissionsCheckSuccessful
|
||||
Layout.leftMargin: 20
|
||||
id: ctrlCheckingPermissionToJoinInProgress
|
||||
enabled: !ctrlRequirementsCheckPending.checked
|
||||
visible: !ctrlIsInvitationPending.checked
|
||||
text: "Join permission successful"
|
||||
text: "Checking perms to join"
|
||||
|
||||
Binding on checked {
|
||||
when: ctrlRequirementsCheckPending.checked
|
||||
value: true
|
||||
restoreMode: Binding.RestoreValue
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
Layout.leftMargin: 12
|
||||
id: ctrlJoinPermissionsCheckCompletedWithoutErrors
|
||||
visible: !ctrlIsInvitationPending.checked
|
||||
text: "Join perm. check completed w/o errors"
|
||||
checked: true
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,9 @@ Control {
|
|||
required property bool allAddressesToRevealBelongToSingleNonProfileKeypair
|
||||
required property int /*PermissionTypes.Type*/ eligibleToJoinAs
|
||||
|
||||
property bool requirementsCheckPending: false
|
||||
property bool joinPermissionsCheckSuccessful
|
||||
property bool requirementsCheckPending
|
||||
property bool checkingPermissionToJoinInProgress
|
||||
property bool joinPermissionsCheckCompletedWithoutErrors
|
||||
|
||||
required property string communityId
|
||||
required property string communityName
|
||||
|
@ -103,18 +104,18 @@ Control {
|
|||
}
|
||||
|
||||
readonly property string tooltipText: {
|
||||
if (root.requirementsCheckPending)
|
||||
if (root.requirementsCheckPending || root.checkingPermissionToJoinInProgress)
|
||||
return qsTr("Requirements check pending")
|
||||
|
||||
if (!root.joinPermissionsCheckSuccessful)
|
||||
return qsTr("Checking permissions to join failed")
|
||||
if (!root.joinPermissionsCheckCompletedWithoutErrors)
|
||||
return qsTr("Checking permissions failed")
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
readonly property var saveButton: StatusButton {
|
||||
visible: root.isEditMode
|
||||
interactive: d.dirty && !root.requirementsCheckPending && root.joinPermissionsCheckSuccessful
|
||||
interactive: d.dirty && !root.requirementsCheckPending && root.joinPermissionsCheckCompletedWithoutErrors
|
||||
loading: root.requirementsCheckPending
|
||||
type: d.lostCommunityPermission || d.lostChannelPermissions ? StatusBaseButton.Type.Danger : StatusBaseButton.Type.Normal
|
||||
tooltip.text: {
|
||||
|
@ -164,8 +165,8 @@ Control {
|
|||
|
||||
readonly property var shareAddressesButton: StatusButton {
|
||||
visible: !root.isEditMode
|
||||
interactive: root.eligibleToJoinAs !== PermissionTypes.Type.None && root.joinPermissionsCheckSuccessful
|
||||
loading: root.requirementsCheckPending
|
||||
interactive: !root.checkingPermissionToJoinInProgress && root.eligibleToJoinAs !== PermissionTypes.Type.None && root.joinPermissionsCheckCompletedWithoutErrors
|
||||
loading: root.checkingPermissionToJoinInProgress
|
||||
tooltip.text: {
|
||||
if (interactive)
|
||||
return ""
|
||||
|
@ -331,7 +332,8 @@ Control {
|
|||
assetsModel: root.assetsModel
|
||||
collectiblesModel: root.collectiblesModel
|
||||
requirementsCheckPending: root.requirementsCheckPending
|
||||
joinPermissionsCheckSuccessful: root.joinPermissionsCheckSuccessful
|
||||
checkingPermissionToJoinInProgress: root.checkingPermissionToJoinInProgress
|
||||
joinPermissionsCheckCompletedWithoutErrors: root.joinPermissionsCheckCompletedWithoutErrors
|
||||
communityName: root.communityName
|
||||
communityIcon: root.communityIcon
|
||||
eligibleToJoinAs: root.eligibleToJoinAs
|
||||
|
|
|
@ -32,7 +32,8 @@ Rectangle {
|
|||
property var collectiblesModel
|
||||
|
||||
property bool requirementsCheckPending
|
||||
property bool joinPermissionsCheckSuccessful
|
||||
property bool checkingPermissionToJoinInProgress
|
||||
property bool joinPermissionsCheckCompletedWithoutErrors
|
||||
|
||||
readonly property bool lostPermissionToJoin: d.lostPermissionToJoin
|
||||
readonly property bool lostChannelPermissions: d.lostChannelPermissions
|
||||
|
@ -257,7 +258,7 @@ Rectangle {
|
|||
|
||||
CommunityEligibilityTag {
|
||||
id: eligibilityHintBubble
|
||||
visible: !root.requirementsCheckPending && root.joinPermissionsCheckSuccessful
|
||||
visible: !root.checkingPermissionToJoinInProgress && root.joinPermissionsCheckCompletedWithoutErrors
|
||||
eligibleToJoinAs: root.eligibleToJoinAs
|
||||
isEditMode: root.isEditMode
|
||||
isDirty: root.isDirty
|
||||
|
|
|
@ -18,7 +18,8 @@ QtObject {
|
|||
property var communitiesModuleInst: communitiesModule
|
||||
property bool newVersionAvailable: false
|
||||
readonly property bool requirementsCheckPending: communitiesModuleInst.requirementsCheckPending
|
||||
readonly property bool joinPermissionsCheckSuccessful: communitiesModuleInst.joinPermissionsCheckSuccessful
|
||||
readonly property bool checkingPermissionToJoinInProgress: communitiesModuleInst.checkingPermissionToJoinInProgress
|
||||
readonly property bool joinPermissionsCheckCompletedWithoutErrors: communitiesModuleInst.joinPermissionsCheckCompletedWithoutErrors
|
||||
readonly property bool channelsPermissionsCheckSuccessful: communitiesModuleInst.channelsPermissionsCheckSuccessful
|
||||
property string latestVersion
|
||||
property string downloadURL
|
||||
|
|
|
@ -718,7 +718,8 @@ QtObject {
|
|||
id: dialogRoot
|
||||
|
||||
requirementsCheckPending: root.rootStore.requirementsCheckPending
|
||||
joinPermissionsCheckSuccessful: root.rootStore.joinPermissionsCheckSuccessful
|
||||
checkingPermissionToJoinInProgress: root.rootStore.checkingPermissionToJoinInProgress
|
||||
joinPermissionsCheckCompletedWithoutErrors: root.rootStore.joinPermissionsCheckCompletedWithoutErrors
|
||||
|
||||
walletAccountsModel: root.rootStore.walletAccountsModel
|
||||
walletCollectiblesModel: WalletStore.RootStore.collectiblesStore.allCollectiblesModel
|
||||
|
@ -968,7 +969,8 @@ QtObject {
|
|||
communityIcon: chatStore.sectionDetails.image
|
||||
|
||||
requirementsCheckPending: root.rootStore.requirementsCheckPending
|
||||
joinPermissionsCheckSuccessful: root.rootStore.joinPermissionsCheckSuccessful
|
||||
checkingPermissionToJoinInProgress: root.rootStore.checkingPermissionToJoinInProgress
|
||||
joinPermissionsCheckCompletedWithoutErrors: root.rootStore.joinPermissionsCheckCompletedWithoutErrors
|
||||
|
||||
introMessage: chatStore.sectionDetails.introMessage
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ StatusStackModal {
|
|||
required property string communityIcon
|
||||
required property bool requirementsCheckPending
|
||||
|
||||
property bool joinPermissionsCheckSuccessful
|
||||
property bool checkingPermissionToJoinInProgress
|
||||
property bool joinPermissionsCheckCompletedWithoutErrors
|
||||
|
||||
property string introMessage
|
||||
|
||||
|
@ -87,26 +88,23 @@ StatusStackModal {
|
|||
|
||||
finishButton: StatusButton {
|
||||
interactive: {
|
||||
if (root.isInvitationPending)
|
||||
if (root.isInvitationPending || d.accessType !== Constants.communityChatOnRequestAccess)
|
||||
return true
|
||||
|
||||
if (root.requirementsCheckPending || !root.joinPermissionsCheckSuccessful)
|
||||
if (root.checkingPermissionToJoinInProgress || !root.joinPermissionsCheckCompletedWithoutErrors)
|
||||
return false
|
||||
|
||||
if (d.accessType !== Constants.communityChatOnRequestAccess)
|
||||
return true
|
||||
|
||||
return d.eligibleToJoinAs !== PermissionTypes.Type.None
|
||||
}
|
||||
loading: root.requirementsCheckPending && !root.isInvitationPending
|
||||
loading: root.checkingPermissionToJoinInProgress && !root.isInvitationPending
|
||||
tooltip.text: {
|
||||
if (interactive)
|
||||
return ""
|
||||
|
||||
if (root.requirementsCheckPending)
|
||||
if (root.checkingPermissionToJoinInProgress)
|
||||
return qsTr("Requirements check pending")
|
||||
|
||||
if (!root.joinPermissionsCheckSuccessful)
|
||||
if (!root.joinPermissionsCheckCompletedWithoutErrors)
|
||||
return qsTr("Checking permissions to join failed")
|
||||
|
||||
return ""
|
||||
|
@ -199,6 +197,7 @@ StatusStackModal {
|
|||
property int eligibleToJoinAs: PermissionsHelpers.isEligibleToJoinAs(root.permissionsModel)
|
||||
readonly property var _con: Connections {
|
||||
target: root.permissionsModel
|
||||
ignoreUnknownSignals: true
|
||||
function onTokenCriteriaUpdated() {
|
||||
d.eligibleToJoinAs = PermissionsHelpers.isEligibleToJoinAs(root.permissionsModel)
|
||||
}
|
||||
|
@ -362,7 +361,8 @@ StatusStackModal {
|
|||
communityName: root.communityName
|
||||
communityIcon: root.communityIcon
|
||||
requirementsCheckPending: root.requirementsCheckPending
|
||||
joinPermissionsCheckSuccessful: root.joinPermissionsCheckSuccessful
|
||||
checkingPermissionToJoinInProgress: root.checkingPermissionToJoinInProgress
|
||||
joinPermissionsCheckCompletedWithoutErrors: root.joinPermissionsCheckCompletedWithoutErrors
|
||||
|
||||
walletAccountsModel: d.initialAddressesModel
|
||||
|
||||
|
@ -454,7 +454,7 @@ StatusStackModal {
|
|||
StatusRoundedImage {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.preferredWidth: 64
|
||||
Layout.preferredHeight: Layout.preferredWidth
|
||||
Layout.preferredHeight: width
|
||||
visible: ((image.status == Image.Loading) ||
|
||||
(image.status == Image.Ready)) &&
|
||||
!image.isError
|
||||
|
@ -477,7 +477,7 @@ StatusStackModal {
|
|||
anchors.bottomMargin: Style.current.bigPadding
|
||||
eligibleToJoinAs: d.eligibleToJoinAs
|
||||
isEditMode: root.isEditMode
|
||||
visible: !root.isInvitationPending && !root.requirementsCheckPending && root.joinPermissionsCheckSuccessful &&
|
||||
visible: !root.isInvitationPending && !root.checkingPermissionToJoinInProgress && root.joinPermissionsCheckCompletedWithoutErrors &&
|
||||
d.accessType === Constants.communityChatOnRequestAccess
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue