Merge pull request #2573 from mempool/nymkappa/bugfix/ranking-page-tor

Fix "undefined" location in node ranking
This commit is contained in:
softsimon 2022-09-22 18:17:01 +02:00 committed by GitHub
commit 63417c9179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,18 +31,26 @@ export class GeolocationComponent implements OnChanges {
} }
if (this.type === 'list-country') { if (this.type === 'list-country') {
if (this.data.city) { if (!this.data.city) {
this.formattedLocation = '-';
}
else if (this.data.city) {
this.formattedLocation += ' ' + city; this.formattedLocation += ' ' + city;
if (this.data.subdivision) { if (this.data.subdivision) {
this.formattedLocation += ', ' + subdivision; this.formattedLocation += ', ' + subdivision;
} }
} else {
this.formattedLocation += '-';
} }
} }
if (this.type === 'list-isp') { if (this.type === 'list-isp') {
if (!this.data.country && !this.data.city) {
this.formattedLocation = '-';
} else {
if (this.data.country) {
this.formattedLocation = getFlagEmoji(this.data.iso); this.formattedLocation = getFlagEmoji(this.data.iso);
} else {
this.formattedLocation = '';
}
if (this.data.city) { if (this.data.city) {
this.formattedLocation += ' ' + city; this.formattedLocation += ' ' + city;
if (this.data.subdivision) { if (this.data.subdivision) {
@ -52,6 +60,7 @@ export class GeolocationComponent implements OnChanges {
this.formattedLocation += ' ' + this.data.country; this.formattedLocation += ' ' + this.data.country;
} }
} }
}
if (this.type === 'node') { if (this.type === 'node') {
const city = this.data.city ? this.data.city : ''; const city = this.data.city ? this.data.city : '';