Skip to content

Commit

Permalink
Fixes tip format for media publishers
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Nov 4, 2018
1 parent e2acc42 commit 4808869
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
8 changes: 6 additions & 2 deletions components/brave_rewards/browser/publisher_info_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ void PublisherInfoDatabase::GetRecurringDonations(ledger::PublisherInfoList* lis
return;

sql::Statement info_sql(
db_.GetUniqueStatement("SELECT pi.publisher_id, pi.name, pi.url, pi.favIcon, rd.amount, rd.added_date, pi.verified "
db_.GetUniqueStatement("SELECT pi.publisher_id, pi.name, pi.url, pi.favIcon, "
"rd.amount, rd.added_date, pi.verified, pi.provider "
"FROM recurring_donation as rd "
"INNER JOIN publisher_info AS pi ON rd.publisher_id = pi.publisher_id "));

Expand All @@ -601,6 +602,7 @@ void PublisherInfoDatabase::GetRecurringDonations(ledger::PublisherInfoList* lis
publisher.weight = info_sql.ColumnDouble(4);
publisher.reconcile_stamp = info_sql.ColumnInt64(5);
publisher.verified = info_sql.ColumnBool(6);
publisher.provider = info_sql.ColumnString(7);

list->push_back(publisher);
}
Expand All @@ -616,7 +618,8 @@ void PublisherInfoDatabase::GetTips(ledger::PublisherInfoList* list, ledger::PUB
return;

sql::Statement info_sql(
db_.GetUniqueStatement("SELECT pi.publisher_id, pi.name, pi.url, pi.favIcon, ci.probi, ci.date, pi.verified "
db_.GetUniqueStatement("SELECT pi.publisher_id, pi.name, pi.url, pi.favIcon, "
"ci.probi, ci.date, pi.verified, pi.provider "
"FROM contribution_info as ci "
"INNER JOIN publisher_info AS pi ON ci.publisher_id = pi.publisher_id "
"AND ci.month = ? AND ci.year = ? "
Expand All @@ -638,6 +641,7 @@ void PublisherInfoDatabase::GetTips(ledger::PublisherInfoList* list, ledger::PUB
publisher.weight = info_sql.ColumnDouble(4);
publisher.reconcile_stamp = info_sql.ColumnInt64(5);
publisher.verified = info_sql.ColumnBool(6);
publisher.provider = info_sql.ColumnString(7);

list->push_back(publisher);
}
Expand Down
14 changes: 2 additions & 12 deletions components/brave_rewards/resources/ui/components/donationsBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,14 @@ class DonationBox extends React.Component<Props, State> {
let recurring: DetailRow[] = []
if (recurringList) {
recurring = recurringList.map((item: Rewards.Publisher) => {
let name = item.name
if (item.provider) {
name = `${name} ${getLocale('on')} ${item.provider}`
}

let faviconUrl = `chrome://favicon/size/48@1x/${item.url}`
if (item.favIcon) {
faviconUrl = `chrome://favicon/size/48@1x/${item.favIcon}`
}

return {
profile: {
name,
name: item.name,
verified: item.verified,
provider: (item.provider ? item.provider : undefined) as Provider,
src: faviconUrl
Expand All @@ -140,11 +135,6 @@ class DonationBox extends React.Component<Props, State> {
let tips: DetailRow[] = []
if (tipsList) {
tips = tipsList.map((item: Rewards.Publisher) => {
let name = item.name
if (item.provider) {
name = `${name} ${getLocale('on')} ${item.provider}`
}

let faviconUrl = `chrome://favicon/size/48@1x/${item.url}`
if (item.favIcon) {
faviconUrl = `chrome://favicon/size/48@1x/${item.favIcon}`
Expand All @@ -154,7 +144,7 @@ class DonationBox extends React.Component<Props, State> {

return {
profile: {
name,
name: item.name,
verified: item.verified,
provider: (item.provider ? item.provider : undefined) as Provider,
src: faviconUrl
Expand Down

0 comments on commit 4808869

Please sign in to comment.