Skip to content
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

Add checkbox warning #2909

Merged
merged 11 commits into from
Nov 12, 2020
Merged

Add checkbox warning #2909

merged 11 commits into from
Nov 12, 2020

Conversation

vctt94
Copy link
Member

@vctt94 vctt94 commented Nov 11, 2020

This PR adds a checkbox for allowing sending transaction from other accounts than mixed account. closes #2877

Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM added one suggestion 👍

} = usePrivacy();

const [logs, setLogs] = useState("");
const [showingSendUnmixModal, showModal] = useState(false);
const onToggleSendFromUnmixed = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useCallback here might be useful

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be a callback with multiple function methods on its array dependency, which will be re-rendered each update. That's why I didn't add

Copy link
Member

@amass01 amass01 Nov 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrrmmm i'm not sure if i understand, useCallback will prevent extra re-renders in children components (the one receives onToggleSendFromUnmixed) it will guarantee to keep the same pointer to functions unless one of the deps array updates, in that case it will re-evaluate the useCallback value which will result in new pointer and children components wil re-render, without useCallback each re-render in parent will cause re-evaluation of the function which means new pointer which means children will re-render as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions are comparing by reference, so if I add a function at the array dependency, it will not have much effect. Here: https://hackernoon.com/grasp-by-value-and-by-reference-in-javascript-7ed75efa1293

So I see no reason for adding it. We will not increase performance and the method will be more verbose.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i see, didn't notice these are functions.

showModal(false);
}
};
const onChangeCheckbox = () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above comment

showModal(false);
}
};
const onChangeCheckbox = () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Member

@victorgcramos victorgcramos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Working as expected. Just a few minor visual issues that I noticed:

  • modal background should be a little darker
  • components and files with SeedCopyConfirmModal naming

Screen Shot 2020-11-11 at 5 16 56 PM

Copy link
Member

@jholdstock jholdstock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I just loaded up a wallet which already has privacy enabled and the checkbox was not checked. Perhaps it is using the wrong default value when no value is found in the config file?

  • If I press "Cancel" in the modal, the checkbox value changes anyway

}) => (
<DefaultModal className={style.confirmSendFromUnmixed} {...{ show }}>
<div className={style.titleConfirmSendFromUnmixed}>
<T id="SendFromUnmixed.titleWarning" m="Seed Clipboard Copy Warning" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<T id="SendFromUnmixed.titleWarning" m="Seed Clipboard Copy Warning" />
<T id="SendFromUnmixed.titleWarning" m="Sending from Unmixed Accounts" />

typedConfirmationPhrase.toLowerCase() !==
copyConfirmationPhrase.toLowerCase()
}>
<T id="SendFromUnmixed.btnConfirm" m="Allow send from Unmixed" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<T id="SendFromUnmixed.btnConfirm" m="Allow send from Unmixed" />
<T id="SendFromUnmixed.btnConfirm" m="Enable sending from unmixed accounts" />

label={
<T
id="Privacy.checkbox"
m="Send From Unmixed accounts"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
m="Send From Unmixed accounts"
m="Send from unmixed accounts"

<Checkbox
label={
<T
id="Privacy.checkbox"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the only string ID I have seen starting with a capital letter. We can give it a more descriptive name too, in case we add another checkbox later.

Suggested change
id="Privacy.checkbox"
id="privacy.sendFromUnmixedCheckbox"

@@ -0,0 +1,3 @@
## Allow Send from other unmixed accounts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this heading, because the modal already has one. This one isn't rendered properly anyway, it just appears as a bold line at the start of the paragraph.

@@ -0,0 +1,3 @@
## Allow Send from other unmixed accounts

Currently, you have privacy settings enabled. As part of this, we have turned off the ability to create external spends from non-mixed accounts. Any funds sent from the non-mixed account will not be private and will be able to be tracked. If you would like to turn off this setting please type in 'I understand the risks' below. You may re-engage this setting at any time.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Currently, you have privacy settings enabled. As part of this, we have turned off the ability to create external spends from non-mixed accounts. Any funds sent from the non-mixed account will not be private and will be able to be tracked. If you would like to turn off this setting please type in 'I understand the risks' below. You may re-engage this setting at any time.
Sending from unmixed accounts has been disabled by the privacy settings of this wallet. This is for your protection.
Sending from unmixed accounts is not private and could possibly be traced back to you. If you would like to turn off this setting please type 'I understand the risks' below. You may re-engage this setting at any time.

@alexlyp alexlyp merged commit 4765996 into decred:master Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.6.0-rc2] sending funds is only possible from mixed account
5 participants