Skip to content

Commit

Permalink
Open uphold links in the same tab
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Aug 1, 2019
1 parent 779c86b commit bb2a756
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
14 changes: 1 addition & 13 deletions components/brave_rewards/browser/rewards_service_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2327,10 +2327,6 @@ IN_PROC_BROWSER_TEST_F(BraveRewardsBrowserTest,
content::ISOLATED_WORLD_ID_CONTENT_END));
}

content::WindowedNotificationObserver auth_obs(
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllSources());

// Click on verify button in on boarding
{
ASSERT_TRUE(ExecJs(contents(),
Expand All @@ -2339,8 +2335,6 @@ IN_PROC_BROWSER_TEST_F(BraveRewardsBrowserTest,
content::ISOLATED_WORLD_ID_CONTENT_END));
}

auth_obs.Wait();

// Check if we are redirected to uphold
{
const GURL current_url = contents()->GetURL();
Expand All @@ -2353,13 +2347,7 @@ IN_PROC_BROWSER_TEST_F(BraveRewardsBrowserTest,
// Fake successful authentication
ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
browser(),
uphold_auth_url(), 2);

content::WindowedNotificationObserver kyc_obs(
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllSources());

kyc_obs.Wait();
uphold_auth_url(), 1);

// Check if we are redirected to KYC page
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class PageWallet extends React.Component<Props, State> {

this.actions.onOnBoardingDisplayed()

window.open(link, '_blank')
window.open(link, '_self')
}

onVerifyClick = () => {
Expand Down Expand Up @@ -390,14 +390,14 @@ class PageWallet extends React.Component<Props, State> {
switch (action) {
case 'add': {
if (externalWallet.addUrl) {
window.open(externalWallet.addUrl, '_blank')
window.open(externalWallet.addUrl, '_self')
return
}
break
}
case 'withdraw': {
if (externalWallet.withdrawUrl) {
window.open(externalWallet.withdrawUrl, '_blank')
window.open(externalWallet.withdrawUrl, '_self')
return
}
break
Expand All @@ -418,7 +418,7 @@ class PageWallet extends React.Component<Props, State> {
return
}

window.open(externalWallet.accountUrl, '_blank')
window.open(externalWallet.accountUrl, '_self')
}

getUserName = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ const rewardsReducer: Reducer<Rewards.State | undefined> = (state: Rewards.State
if (data.action === 'authorization') {
const url = data.args['redirect_url']
if (url && url.length > 0) {
window.open(url)
window.open(url, '_self')
}
ui.modalRedirect = 'hide'
break
Expand Down

0 comments on commit bb2a756

Please sign in to comment.