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

Deprecate CONNECTED publisher status (uplift to 1.45.x) #15176

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ IN_PROC_BROWSER_TEST_F(RewardsContributionBrowserTest,

const double amount = 5.0;
contribution_->TipViaCode("bumpsmack.com", amount,
ledger::mojom::PublisherStatus::CONNECTED, 1);
contribution_->VerifyTip(amount, true, false, true);
ledger::mojom::PublisherStatus::NOT_VERIFIED, 0);
contribution_->VerifyTip(amount, false, false, true);
}

IN_PROC_BROWSER_TEST_F(
Expand All @@ -498,8 +498,8 @@ IN_PROC_BROWSER_TEST_F(

const double amount = 5.0;
contribution_->TipViaCode("bumpsmack.com", amount,
ledger::mojom::PublisherStatus::CONNECTED, 1);
contribution_->VerifyTip(amount, true, false, true);
ledger::mojom::PublisherStatus::NOT_VERIFIED, 0);
contribution_->VerifyTip(amount, false, false, true);
}

// Reenable when https://github.com/brave/brave-browser/issues/19982 is fixed.
Expand All @@ -512,7 +512,7 @@ IN_PROC_BROWSER_TEST_F(RewardsContributionBrowserTest,

const double amount = 5.0;
contribution_->TipViaCode("bumpsmack.com", amount,
ledger::mojom::PublisherStatus::CONNECTED, 0);
ledger::mojom::PublisherStatus::NOT_VERIFIED, 0);

contribution_->IsBalanceCorrect();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ IN_PROC_BROWSER_TEST_F(
rewards_browsertest_util::GetUrl(https_server_.get(), "duckduckgo.com"),
verified);
context_helper_->VisitPublisher(
rewards_browsertest_util::GetUrl(https_server_.get(), "bumpsmack.com"),
rewards_browsertest_util::GetUrl(https_server_.get(), "3zsistemi.si"),
verified);
context_helper_->VisitPublisher(
rewards_browsertest_util::GetUrl(https_server_.get(), "brave.com"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,15 @@ IN_PROC_BROWSER_TEST_F(RewardsPublisherBrowserTest, VisitUnverifiedPublisher) {
false);
}

// Registered publishers without a wallet address are displayed as verified
// Registered publishers without a wallet address are displayed as not verified
IN_PROC_BROWSER_TEST_F(RewardsPublisherBrowserTest, VisitRegisteredPublisher) {
rewards_browsertest_util::CreateRewardsWallet(rewards_service_);
rewards_service_->SetAutoContributeEnabled(true);
context_helper_->LoadRewardsPage();
context_helper_->VisitPublisher(
rewards_browsertest_util::GetUrl(
https_server_.get(),
"registeredsite.com"),
true);
rewards_browsertest_util::GetUrl(https_server_.get(),
"registeredsite.com"),
false);
}

} // namespace rewards_browsertest
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const char kTableName[] = "server_publisher_info";
} // namespace

namespace ledger {

namespace database {

DatabaseServerPublisherInfo::DatabaseServerPublisherInfo(
Expand Down Expand Up @@ -144,6 +145,12 @@ void DatabaseServerPublisherInfo::OnGetRecord(
info->updated_at = GetInt64Column(record, 2);
info->banner = banner.Clone();

// The `CONNECTED` status is deprecated. If this value appears in the database
// convert it to a valid status.
if (info->status == mojom::PublisherStatus::CONNECTED) {
info->status = mojom::PublisherStatus::NOT_VERIFIED;
}

callback(std::move(info));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void GetPublisherStatusFromMessage(
const publishers_pb::ChannelResponse& response,
ledger::mojom::ServerPublisherInfo* info) {
DCHECK(info);
info->status = ledger::mojom::PublisherStatus::CONNECTED;
info->status = ledger::mojom::PublisherStatus::NOT_VERIFIED;
for (const auto& wallet : response.wallets()) {
if (wallet.has_uphold_wallet()) {
auto& uphold = wallet.uphold_wallet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ TEST_F(GetPublisherTest, EmptyWalletAddress) {
EXPECT_EQ(result, mojom::Result::LEDGER_OK);
ASSERT_TRUE(info);
EXPECT_EQ(info->publisher_key, "brave.com");
EXPECT_EQ(info->status, mojom::PublisherStatus::CONNECTED);
EXPECT_EQ(info->status, mojom::PublisherStatus::NOT_VERIFIED);
EXPECT_EQ(info->address, "");
}

Expand Down