Check permissions even if there's an inflight request
This commit is contained in:
parent
932fee2857
commit
ed824bdb06
|
@ -79,7 +79,6 @@
|
||||||
;; incorrect highest permission role.
|
;; incorrect highest permission role.
|
||||||
{:db (update db :communities/permissions-checks-for-selection dissoc community-id)}
|
{:db (update db :communities/permissions-checks-for-selection dissoc community-id)}
|
||||||
(let [{:keys [checking?]} (get-in db [:communities/permissions-checks-for-selection community-id])]
|
(let [{:keys [checking?]} (get-in db [:communities/permissions-checks-for-selection community-id])]
|
||||||
(when-not checking?
|
|
||||||
{:db (assoc-in db [:communities/permissions-checks-for-selection community-id :checking?] true)
|
{:db (assoc-in db [:communities/permissions-checks-for-selection community-id :checking?] true)
|
||||||
:fx [[:json-rpc/call
|
:fx [[:json-rpc/call
|
||||||
[{:method :wakuext_checkPermissionsToJoinCommunity
|
[{:method :wakuext_checkPermissionsToJoinCommunity
|
||||||
|
@ -87,7 +86,7 @@
|
||||||
:on-success [:communities/check-permissions-to-join-during-selection-success
|
:on-success [:communities/check-permissions-to-join-during-selection-success
|
||||||
community-id]
|
community-id]
|
||||||
:on-error [:communities/check-permissions-to-join-during-selection-failure
|
:on-error [:communities/check-permissions-to-join-during-selection-failure
|
||||||
community-id addresses]}]]]}))))
|
community-id addresses]}]]]})))
|
||||||
|
|
||||||
;; This event should be used to check permissions temporarily because it won't
|
;; This event should be used to check permissions temporarily because it won't
|
||||||
;; mutate the state `:communities/permissions-check` (used by many other
|
;; mutate the state `:communities/permissions-check` (used by many other
|
||||||
|
|
|
@ -103,11 +103,4 @@
|
||||||
community-id]
|
community-id]
|
||||||
:on-error [:communities/check-permissions-to-join-during-selection-failure
|
:on-error [:communities/check-permissions-to-join-during-selection-failure
|
||||||
community-id addresses]}]]]}
|
community-id addresses]}]]]}
|
||||||
(sut/check-permissions-to-join-for-selection cofx [community-id addresses])))))
|
(sut/check-permissions-to-join-for-selection cofx [community-id addresses]))))))
|
||||||
|
|
||||||
(testing "when there are addresses to check permissions, but currently checking, then skip the check"
|
|
||||||
(let [addresses ["0xA"]
|
|
||||||
cofx {:db {:communities/permissions-checks-for-selection
|
|
||||||
{"other-comm-id" {}
|
|
||||||
community-id {:checking? true}}}}]
|
|
||||||
(is (nil? (sut/check-permissions-to-join-for-selection cofx [community-id addresses]))))))
|
|
||||||
|
|
Loading…
Reference in New Issue