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

gui: Enable masking of cpid in privacy mode #2420

Merged
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
3 changes: 2 additions & 1 deletion src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,12 @@ void OverviewPage::setPrivacy(bool privacy)

ui->recentTransactionsNoResult->setVisible(m_privacy || !transaction_count);
ui->listTransactions->setVisible(!m_privacy && transaction_count);
if (researcherModel) researcherModel->setMaskAccrualAndMagnitude(m_privacy);
if (researcherModel) researcherModel->setMaskCpidMagnitudeAccrual(m_privacy);

LogPrint(BCLog::LogFlags::QT, "INFO: %s: m_privacy = %u", __func__, m_privacy);

updateTransactions();
updateResearcherStatus();
updatePendingAccrual();
}

Expand Down
12 changes: 9 additions & 3 deletions src/qt/researcher/researchermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void ResearcherModel::setTheme(const QString& theme_name)
emit beaconChanged();
}

void ResearcherModel::setMaskAccrualAndMagnitude(bool privacy)
void ResearcherModel::setMaskCpidMagnitudeAccrual(bool privacy)
{
m_privacy_enabled = privacy;

Expand Down Expand Up @@ -306,7 +306,13 @@ QString ResearcherModel::email() const

QString ResearcherModel::formatCpid() const
{
return QString::fromStdString(m_researcher->Id().ToString());
QString text = QString::fromStdString(m_researcher->Id().ToString());

if (m_privacy_enabled) {
text = "################################";
}

return text;
}

QString ResearcherModel::formatMagnitude() const
Expand All @@ -315,7 +321,7 @@ QString ResearcherModel::formatMagnitude() const

if (outOfSync()) {
text = "...";
} else if (m_privacy_enabled){
} else if (m_privacy_enabled) {
text = "#";
} else {
text = QString::fromStdString(m_researcher->Magnitude().ToString());
Expand Down
2 changes: 1 addition & 1 deletion src/qt/researcher/researchermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ResearcherModel : public QObject

void showWizard(WalletModel* wallet_model);
void setTheme(const QString& theme_name);
void setMaskAccrualAndMagnitude(bool privacy);
void setMaskCpidMagnitudeAccrual(bool privacy);

bool configuredForInvestorMode() const;
bool outOfSync() const;
Expand Down