-
Notifications
You must be signed in to change notification settings - Fork 72
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
Feat: blacklist whitelist contacts #1814
Conversation
bassemmagdy
commented
Dec 9, 2021
•
edited
Loading
edited
- Added feature blacklist/whitelist contacts
- Separated contact list to blacklisted and whitelisted
- By default now, transactions received from blacklisted contacts don't appear in transaction history
Dev -> Main
8309396
to
b119669
Compare
b119669
to
60fd197
Compare
60fd197
to
52baa8a
Compare
src/components/TransactionList/TransactionListFilters/TransactionListFiltersTs.ts
Outdated
Show resolved
Hide resolved
@Jaguar0625 All comments are addressed, please recheck :) |
const address = Address.createFromRawAddress('TAD5BAHLOIXCRRB6GU2H72HPXMBBVAEUQRYPHBY'); | ||
const truncatedAddress = CommonHelpers.truncate(address.plain()); | ||
const string = 'string'; | ||
expect(truncatedAddress.length).toBe(15); | ||
expect(truncatedAddress.substring(truncatedAddress.length - 6)).toEqual('...HBY'); | ||
expect(CommonHelpers.truncate(string).length).toBe(6); |
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 probably better to rename
string
to something more descriptive likeshortString
- in future, generally would try to group Arrange / Act / Assert [see https://hackmd.io/WrKdAaohRXKgCbzd_4ZMxA]
@@ -17,6 +17,8 @@ import { TransactionFilterOptionsState, TransactionState } from '@/store/Transac | |||
import { TransactionFilterService } from '@/services/TransactionFilterService'; | |||
import { getTestAccount } from '@MOCKS/Accounts'; | |||
import { TransferTransaction } from 'symbol-sdk'; | |||
import { addressBookMock } from '@MOCKS/AddressBookMock'; | |||
import { IContact } from 'symbol-address-book'; | |||
|
|||
const currentSigner = getTestAccount('remoteTestnet'); | |||
const recepient = getTestAccount('remoteTestnetRecipient'); |
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.
- not something you need to fix as part of this PR, but it's a bit confusing to use currentSigner as recipient address
- recepient is spelled wrong
test("should not call the 'account/SET_CURRENT_SIGNER' without address", () => { | ||
vm.onSignerSelectorChange(); | ||
expect(vm.$store.dispatch).not.toBeCalled(); | ||
}); | ||
|
||
test("should call 'transaction/filterTransactions' with blacklisted contacts", () => { |
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.
would be good to add a test when isBlackListFilterActivated == true
to cover else branch too
@Jaguar0625 All feedbacks should be now addressed :) |
…feat-blacklist-whitelist-contacts
@bassemmagdy @coiki I think the address book/blocked transactions mechanic and UX/UI has to be re-think. It's not intuitive for me.
How filtering should work? It should show valid + blacklisted transactions or should show only blacklisted? Currently, it's the second one. Could you tell me how filtering currently works for aggregate transactions where signed and initiator can be different? Which field is used to filter? https://share.getcloudapp.com/7Kuqg54L
|
@cryptoBeliever |
@cryptoBeliever - do you think the new approach is intuitive enough or do you have more suggestions for improvements? |
@cryptoBeliever how to delete address from the blacklist? Do we have this functionality? |
@NikolaiB by using "Delete Contact" in the address book. Same as for "White List" contacts.
a) Figma: And wallet:
At this moment blacklisting change only visibility on the transaction list. But maybe we should present some warning on transaction details (if the user decides to open a transaction to sign anyway or by mistake). My proposition is to not allow sign partial transactions if the user already added an address to blacklist.
View in wallet: Screens on Figma: Transaction details when opened (I think for whitelisted addresses we could move to Caution warning and skip this step): When the user reject there is an option to blacklist contact: There is also an option to "Archive". @coiki what it does? It should hide transactions? It should be implemented here or there will be a separate issue for the feature (as I understand it's an option to hide transactions without blacklisting address)? The user can also "Accept..." and on the next screen, he can see Caution, and on the next screen provides a password to accept. At the end of process, there should be a way to add contact into "Whitelist". Also currently warning is not presented if account is in relation with user multisig (to don't show a lot of warnings). We can communicate around that what flow in case of multisig relation of this account should be. |
@cryptoBeliever I checked your questions and I’ve tried to sum up my answers. We already spoke on the chat that we need to create a new task for this, or reuse the one that already touched this subject (and delete it if not).
Regarding showing the blacklisted transactions alongside the whitelisted, we want to treat it as a sort of ‘spam folder’ where all the toxic txs live. I think there are use cases where it would be helpful having them alongisde. Let’s see what we can do with this idea. I would also prefer view/hide, but we wanted to manage it like this due to the malicious attacks. Regarding the new ‘signing area’ of the transactions: Q: What is Archive? A: It just hides that view (so the user only rejects but doesn’t blacklist). Let’s change the text to “Close”. |
@bassemmagdy I reported a few issues: I think those should be fixed in this PR: Those could be done in separate PR: Also depends on @coiki answers for questions in https://www.figma.com/file/lkhDQWxq5FlUrMNZYIJ2wT/Symbol-Wallet---Legacy?node-id=168%3A14032 I may report some further issues because currently there is no difference in flow between the situation when accounts is whitelisted/unknown/blacklisted. |
This pull request introduces 1 alert when merging ad0bde0 into 8b236aa - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging b1e3544 into 8b236aa - view on LGTM.com new alerts:
|
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
* fix: address book list styles. feat: add option to blacklist new contact * fix: rewrite ModalTransactionCosignature warning section, fix flow, fix checkbox styles, add escape option * feat: add blocked contact transaction view, add unblock option. fix: 'jumping' form * fix: display contact name in the tx signer field * task: replace pretty addresses with a plain ones * feat: add signer address to tx details * feat: make address filed redirectable to explorer page * feat: add address popover with explorer url * task: require blacklist contact name * fix: aggregate txs get random names from the address book, fix tx filter * fix: styles of the new address detected modal * fix: detected address input styles, new transaction incorrect address * fix: the accounts selector jumping action buttons * fix: contact address edition doesn't work * fix: rename blacklist => block and lint * fix: missing property error * fix: the contact list jumping action buttons * fix: rename show blacklisted transactions => show blocked transactions * fix: edit contact with the same address * feat: improve cosignature warning, show unknown signer address, add explorer link, add caution text * fix: account balance widget address label size * task: change address row explorer link popover layout and styles * fix: remove unused commented style props * fix: presentation for multilevel multisig tree * fix: show warning for blocked multisig address * fix: remove unnecessary tx detail scroll to sign form * task: change copy requires => awaiting * task: add ModalTransactionCosignature component test * task: update translations * fix: translation * task: cleanup test * task: update copy * fix: the transaction list action icons position * fix: remove blacklisted contacts from the send form * feat: add tad for blocked addresses, fix modal aligment, remove blacklist contact name input * fix: lint * task: update translations, add locale unit test * feat: add the scam alert link * fix: typo
@@ -1,5 +1,5 @@ | |||
/* | |||
* (C) Symbol Contributors 2021 Foundation |
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.
😂