-
Notifications
You must be signed in to change notification settings - Fork 985
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
Move selected addresses for permissions to app db #18430
Merged
ajayesivan
merged 1 commit into
develop
from
18405-move-selected-addresses-state-to-app-db
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(ns status-im.contexts.communities.events-test | ||
(:require [cljs.test :refer [deftest is]] | ||
matcher-combinators.test | ||
[status-im.contexts.communities.events :as events])) | ||
|
||
(deftest initialize-permission-addresses-test | ||
(let [initial-db {:db {:wallet {:accounts {"0x1" {:address "0x1"} | ||
"0x2" {:address "0x2"}}}}} | ||
expected-db {:db (assoc (:db initial-db) | ||
:communities/previous-permission-addresses #{"0x1" "0x2"} | ||
:communities/selected-permission-addresses #{"0x1" "0x2"})}] | ||
(is (match? expected-db (events/initialize-permission-addresses initial-db))))) | ||
|
||
(deftest toggle-selected-permission-address-test | ||
(let [initial-db {:db {:communities/selected-permission-addresses #{"0x1" "0x2"}}}] | ||
(is (match? {:db {:communities/selected-permission-addresses #{"0x1"}}} | ||
(events/toggle-selected-permission-address initial-db ["0x2"]))) | ||
(is (match? {:db {:communities/selected-permission-addresses #{"0x1" "0x2" "0x3"}}} | ||
(events/toggle-selected-permission-address initial-db ["0x3"]))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:communities/selected-permission-addresses
- This key will track the selected address for both passing it to the status-go API and displaying it in the UI.:communities/previous-permission-addresses
- This key is specifically for storing the previously selected state. It enables us to reset to the previous address when the user clicks 'Cancel' after making an edit.@ilmotta, I hope these new key names make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's perfect @ajayesivan. You even managed to come up with names with the same length, god mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a pain 😓 I renamed it 4 or 5 times and finally ended up with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.