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

Fixes publisher info getting lost on publishers not in activity table #1823

Merged
merged 1 commit into from
Mar 4, 2019
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
10 changes: 7 additions & 3 deletions components/brave_rewards/browser/rewards_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1039,19 +1039,23 @@ void RewardsServiceImpl::LoadActivityInfo(
0, 2, filter, publisher_info_backend_.get()),
base::Bind(&RewardsServiceImpl::OnActivityInfoLoaded,
AsWeakPtr(),
callback));
callback,
filter.id));
}

void RewardsServiceImpl::OnActivityInfoLoaded(
ledger::PublisherInfoCallback callback,
const std::string& publisher_key,
const ledger::PublisherInfoList list) {
if (!Connected()) {
return;
}

// activity info not found
if (list.size() == 0) {
callback(ledger::Result::NOT_FOUND,
std::unique_ptr<ledger::PublisherInfo>());
// we need to try to get at least publisher info in this case
// this way we preserve publisher info
LoadPublisherInfo(publisher_key, callback);
return;
} else if (list.size() > 1) {
callback(ledger::Result::TOO_MANY_RESULTS,
Expand Down
3 changes: 2 additions & 1 deletion components/brave_rewards/browser/rewards_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ class RewardsServiceImpl : public RewardsService,
std::unique_ptr<ledger::PublisherInfo> info,
bool success);
void OnActivityInfoLoaded(ledger::PublisherInfoCallback callback,
const ledger::PublisherInfoList list);
const std::string& publisher_key,
const ledger::PublisherInfoList list);
void OnMediaPublisherInfoSaved(bool success);
void OnPublisherInfoLoaded(ledger::PublisherInfoCallback callback,
std::unique_ptr<ledger::PublisherInfo> info);
Expand Down