-
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
c9afb54
Merge pull request #1797 from symbol/dev
rg911 52baa8a
feature: blacklist/whitelist contacts in address book
bassemmagdy 673aad4
increase testing coverage and linting
bassemmagdy 226f83e
update unit tests
bassemmagdy b8f1c5d
update package-lock
bassemmagdy 2c43be2
Merge branch 'main' of https://github.com/symbol/desktop-wallet into …
bassemmagdy cd78095
fix console error
bassemmagdy b21e306
add type for qrCodeCapturer
bassemmagdy 15f8b79
check network type before adding new contact
bassemmagdy 507a8aa
highlight malicious transactions button when clicked
bassemmagdy 138e7f9
fix contact list ui
bassemmagdy 3ed01a6
Add new contact modals
bassemmagdy 54bc9ac
add translation
bassemmagdy 5941d2e
update
bassemmagdy 0a491b3
fix msig modification signing
bassemmagdy 757c71b
update ModalTransactionCosignature.vue
bassemmagdy 11556bd
fix ui issues in #1823
bassemmagdy ad0bde0
fix checkbox margin
bassemmagdy bb94484
update blacklist filter to show empty list when there is not blacklis…
bassemmagdy b1e3544
fix filtering and update unit tests
bassemmagdy 919d1a7
fix ui issues
bassemmagdy 108836e
fix: address book (#1847)
OlegMakarenko 4e5e8b1
task: merge commit
OlegMakarenko 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { AddressBook, IContact } from 'symbol-address-book'; | ||
|
||
export const addressBookMock: AddressBook = new AddressBook(); | ||
const contact1: IContact = { | ||
id: '5c9093c7-2da2-476e-bc28-87f24a83cd0c', | ||
address: 'TAVVVJBBCTYJDWC7TQPSVNHK2IPNY6URKK4DTHY', | ||
name: 'Alice', | ||
phone: '+34 000000000', | ||
isBlackListed: true, | ||
}; | ||
addressBookMock.addContact(contact1); |
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 |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
@@ -108,6 +110,27 @@ describe('services/TransactionFilterService', () => { | |
done(); | ||
}); | ||
|
||
test('should return transactions only received from blacklisted contacts', async (done) => { | ||
const addressBook = addressBookMock; | ||
const contact1: IContact = { | ||
id: '5c9093c7-2da2-476e-bc28-87f24a83cd23', | ||
address: recepient.address.plain(), | ||
name: 'BlackListed', | ||
phone: '+34 000000000', | ||
isBlackListed: true, | ||
}; | ||
addressBook.addContact(contact1); | ||
transactionState.filterOptions = new TransactionFilterOptionsState(); | ||
transactionState.filterOptions.isReceivedSelected = true; | ||
const result = TransactionFilterService.filter( | ||
transactionState, | ||
currentSigner.address.plain(), | ||
addressBook.getBlackListedContacts(), | ||
); | ||
expect(result.length).toBe(1); | ||
done(); | ||
}); | ||
|
||
test('should return correct transactions on multiple criterias', async (done) => { | ||
transactionState.filterOptions = new TransactionFilterOptionsState(); | ||
transactionState.filterOptions.isConfirmedSelected = true; | ||
|
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 |
---|---|---|
|
@@ -32,4 +32,15 @@ describe('utils/CommonHelpers', () => { | |
expect(addresses.length).toBe(2); | ||
}); | ||
}); | ||
|
||
describe('truncate(address)', () => { | ||
test('returns truncated string', () => { | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}); | ||
}); | ||
}); |
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
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.
would be good to add a test when
isBlackListFilterActivated == true
to cover else branch too