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

Shows only completed tips in tip list (uplift to 1.7.x) #5135

Merged
merged 1 commit into from
Apr 1, 2020
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 @@ -1178,7 +1178,7 @@ void Contribution::OnExternalWalletServerPublisherInfo(
double amount,
const ledger::ExternalWallet& wallet,
const ledger::RewardsType type) {
if (!info || info->status != ledger::PublisherStatus::VERIFIED) {
if (!info) {
BLOG(ledger_, ledger::LogLevel::LOG_ERROR) << "Publisher not found";
ledger_->ContributionCompleted(
ledger::Result::LEDGER_ERROR,
Expand All @@ -1188,6 +1188,24 @@ void Contribution::OnExternalWalletServerPublisherInfo(
return;
}

if (info->status != ledger::PublisherStatus::VERIFIED) {
BLOG(ledger_, ledger::LogLevel::LOG_ERROR) << "Publisher not verified";

// we don't need callback as there is nothing to report back
SavePendingContribution(
info->publisher_key,
amount,
type,
[](const ledger::Result){});

ledger_->ContributionCompleted(
ledger::Result::LEDGER_ERROR,
amount,
contribution_id,
type);
return;
}

auto completed_callback = std::bind(&Contribution::ExternalWalletCompleted,
this,
_1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ void DatabaseContributionInfo::GetOneTimeTips(
"ON spi.publisher_key = pi.publisher_id "
"WHERE strftime('%%m', datetime(ci.created_at, 'unixepoch')) = ? AND "
"strftime('%%Y', datetime(ci.created_at, 'unixepoch')) = ? "
"AND ci.type = ?",
"AND ci.type = ? AND ci.step = ?",
table_name_,
child_table_name_);

Expand All @@ -586,6 +586,8 @@ void DatabaseContributionInfo::GetOneTimeTips(
BindString(command.get(), 1, std::to_string(year));
BindInt(command.get(), 2,
static_cast<int>(ledger::RewardsType::ONE_TIME_TIP));
BindInt(command.get(), 3,
static_cast<int>(ledger::ContributionStep::STEP_COMPLETED));

command->record_bindings = {
ledger::DBCommand::RecordBindingType::STRING_TYPE,
Expand Down