Automatically claim initial rewards (new_user & email_verified) when … #6807

Merged
Ruk33 merged 2 commits from 6788-automatically-claim-initial-rewards into master 2021-08-18 18:34:25 +02:00
Ruk33 commented 2021-08-06 20:40:29 +02:00 (Migrated from github.com)

…accessing creating channel, edit channel and upload

PR Checklist

Please check all that apply to this PR using "x":

  • I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
  • I added a line describing my change to CHANGELOG.md
  • I have checked that this PR does not introduce a breaking change
  • This PR introduces breaking changes and I have provided a detailed explanation below

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting)
  • Refactoring (no functional changes)
  • Documentation changes
  • Other - Please describe:

Fixes

Issue Number: https://github.com/lbryio/lbry-desktop/issues/6788

What is the current behavior?

N/A

What is the new behavior?

When a user access to create new channel, edit channel, or upload, we will try to automatically claim the rewards email_verified & new_user.

Other information

…accessing creating channel, edit channel and upload ## PR Checklist <!-- For the checkbox formatting to work properly, make sure there are no spaces on either side of the "x" --> Please check all that apply to this PR using "x": - [x] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged) - [ ] I added a line describing my change to CHANGELOG.md - [x] I have checked that this PR does not introduce a breaking change - [ ] This PR introduces breaking changes and I have provided a detailed explanation below ## PR Type What kind of change does this PR introduce? - [ ] Bugfix - [x] Feature - [ ] Code style update (formatting) - [ ] Refactoring (no functional changes) - [ ] Documentation changes - [ ] Other - Please describe: ## Fixes Issue Number: https://github.com/lbryio/lbry-desktop/issues/6788 ## What is the current behavior? N/A ## What is the new behavior? When a user access to create new channel, edit channel, or upload, we will try to automatically claim the rewards email_verified & new_user. ## Other information <!-- If this PR contains a breaking change, please describe the impact and solution strategy for existing applications below. -->
tzarebczan commented 2021-08-11 22:27:11 +02:00 (Migrated from github.com)

Thanks again @Ruk33 ! We'll get a code review on this soon, but looks right according to our conversation.

Thanks again @Ruk33 ! We'll get a code review on this soon, but looks right according to our conversation.
infinite-persistence (Migrated from github.com) reviewed 2021-08-12 05:14:00 +02:00
infinite-persistence (Migrated from github.com) commented 2021-08-12 05:13:51 +02:00

Room for optimization to not call this every time?

This will get called on every entry. Tom did mention something similar:

Do this when the balance is less than 1 LBC or something.

@tzarebczan, if there's no harm to the unnecessary API call, I guess we can just merge it.

Room for optimization to not call this every time? This will get called on every entry. Tom did mention something similar: > _Do this when the balance is less than 1 LBC or something._ @tzarebczan, if there's no harm to the unnecessary API call, I guess we can just merge it. <img src="https://user-images.githubusercontent.com/64950861/129132705-54006255-e2ef-4687-90ea-72e3bcfe1a5c.png" width="300">
infinite-persistence (Migrated from github.com) reviewed 2021-08-12 05:17:11 +02:00
infinite-persistence (Migrated from github.com) commented 2021-08-12 05:17:11 +02:00

Maybe check selectUnclaimedRewards first before sending the request?

Maybe check `selectUnclaimedRewards` first before sending the request?
tzarebczan (Migrated from github.com) reviewed 2021-08-13 22:40:50 +02:00
tzarebczan (Migrated from github.com) commented 2021-08-13 22:40:50 +02:00

Yea, I thought that was happening..it's probably not a big deal. That's why import { selectUnclaimedRewardValue, selectIsClaimingInitialRewards } from 'redux/selectors/rewards'; was brought in on publish page, but it's never used. @Ruk33 take another look please?

Yea, I thought that was happening..it's probably not a big deal. That's why ```import { selectUnclaimedRewardValue, selectIsClaimingInitialRewards } from 'redux/selectors/rewards';``` was brought in on publish page, but it's never used. @Ruk33 take another look please?
kauffj commented 2021-08-16 17:04:10 +02:00 (Migrated from github.com)

@Ruk33 I think ball is in your court on this one

@Ruk33 I think ball is in your court on this one
Ruk33 (Migrated from github.com) reviewed 2021-08-17 02:29:51 +02:00
Ruk33 (Migrated from github.com) commented 2021-08-17 02:29:51 +02:00

Hello guys, thanks for the review. Not sure how much performance can we gain since when we call doClaimInitialRewards, internally, it calls doClaimRewardType which do checks for already claimed rewards and if it's claimed already, it does nothing. In any case, will update to first make the checks and then call only if required.

Hello guys, thanks for the review. Not sure how much performance can we gain since when we call `doClaimInitialRewards`, internally, it calls `doClaimRewardType` which do checks for already claimed rewards and if it's claimed already, it does nothing. In any case, will update to first make the checks and then call only if required.
Ruk33 commented 2021-08-17 02:34:50 +02:00 (Migrated from github.com)

Hello @kauffj , thanks for the follow-up. On it!

Hello @kauffj , thanks for the follow-up. On it!
infinite-persistence (Migrated from github.com) reviewed 2021-08-17 09:14:22 +02:00
infinite-persistence (Migrated from github.com) commented 2021-08-17 09:14:22 +02:00

I see what you mean and it is indeed redundant. On closer inspection, I think the issue is this:

  • I don't have rewards approved, but the network call was sent regardless.
  • I got the 0.2 LBC for Email Verified despite not having rewards approved (I really didn't want to verify this email, to keep it for testing scenario purposes.).
  • Subsequent visits to "edit" or "publish" results in the screenshot above (repeated network calls).
#### Bug: email verified without user consent I see what you mean and it is indeed redundant. On closer inspection, I think the issue is this: - I don't have rewards approved, but the network call was sent regardless. - [ ] I got the 0.2 LBC for `Email Verified` despite not having rewards approved (I really didn't want to verify this email, to keep it for testing scenario purposes.). - [ ] Subsequent visits to "edit" or "publish" results in the screenshot above (repeated network calls).
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-desktop#6807
No description provided.