diff --git a/src/app/backend-api.service.ts b/src/app/backend-api.service.ts index 652b66c..8b2d378 100644 --- a/src/app/backend-api.service.ts +++ b/src/app/backend-api.service.ts @@ -7,7 +7,6 @@ import {SigningService} from './signing.service'; import {AccountService} from './account.service'; import {CryptoService} from './crypto.service'; import {GlobalVarsService} from './global-vars.service'; -import {UserProfile} from '../types/identity'; export class ProfileEntryResponse { Username: string | null = null; @@ -66,31 +65,29 @@ export class BackendAPIService { ); } - GetUserProfiles( + GetUsernames( publicKeys: string[] - ): Observable<{[key: string]: UserProfile}> { - const userProfiles: {[key: string]: any} = {}; + ): Observable<{[key: string]: string}> { + const usernames: {[key: string]: any} = {}; const req = this.GetUsersStateless(publicKeys, true); if (publicKeys.length > 0) { return req.pipe( map( res => { for (const user of res.UserList) { - userProfiles[user.PublicKeyBase58Check] = { - username: user.ProfileEntryResponse?.Username, - }; + usernames[user.PublicKeyBase58Check] = user.ProfileEntryResponse?.Username } - return userProfiles; + return usernames; }) ).pipe( catchError(() => { for(const publicKey of publicKeys) { - userProfiles[publicKey] = {}; + usernames[publicKey] = ""; } - return of(userProfiles); + return of(usernames); }) ); } else { - return of(userProfiles); + return of(usernames); } } } diff --git a/src/app/log-in/log-in.component.html b/src/app/log-in/log-in.component.html index 41212b3..88629a7 100644 --- a/src/app/log-in/log-in.component.html +++ b/src/app/log-in/log-in.component.html @@ -9,11 +9,11 @@ <ul class="list-group mt-7px mb-30px saved-seeds-list"> <span class="saved-seeds-header d-flex align-items-center"><span>Select an account</span></span> <div class="saved-seeds-scroll"> - <li *ngFor="let item of allUsers | keyvalue" class="list-group-item list-group-item-action cursor-pointer saved-seed" (click)="selectAccount(item.key)"> + <li *ngFor="let item of allUsernames | keyvalue" class="list-group-item list-group-item-action cursor-pointer saved-seed" (click)="selectAccount(item.key)"> <div class="w-100"> - <div *ngIf="!item.value.username" class="text-truncate">{{ item.key }}…</div> - <div *ngIf="item.value.username" class="d-flex align-items-center"> - <div class="text-truncate">{{ item.value.username }}</div> + <div *ngIf="!item.value" class="text-truncate">{{ item.key }}…</div> + <div *ngIf="item.value" class="d-flex align-items-center"> + <div class="text-truncate">{{ item.value }}</div> </div> </div> </li> diff --git a/src/app/log-in/log-in.component.ts b/src/app/log-in/log-in.component.ts index caa65af..4773539 100644 --- a/src/app/log-in/log-in.component.ts +++ b/src/app/log-in/log-in.component.ts @@ -3,7 +3,6 @@ import {AccountService} from '../account.service'; import {IdentityService} from '../identity.service'; import {GlobalVarsService} from '../global-vars.service'; import {BackendAPIService} from '../backend-api.service'; -import {UserProfile} from '../../types/identity'; @Component({ selector: 'app-log-in', @@ -11,7 +10,7 @@ import {UserProfile} from '../../types/identity'; styleUrls: ['./log-in.component.scss'] }) export class LogInComponent implements OnInit { - allUsers: {[key: string]: UserProfile} = {}; + allUsernames: {[key: string]: string} = {}; hasUsers = false; constructor( @@ -25,9 +24,12 @@ export class LogInComponent implements OnInit { // Load profile pictures and usernames const publicKeys = this.accountService.getPublicKeys(); this.hasUsers = publicKeys.length > 0; - this.backendApi.GetUserProfiles(publicKeys) - .subscribe(profiles => { - this.allUsers = profiles; + this.backendApi.GetUsernames(publicKeys) + .subscribe(usernames => { + // TODO - LBRY - probably gut this whole page, don't need to list + // users. we're not going to have a login history like this. but go + // over the html to make sure. + this.allUsernames = usernames; }); } diff --git a/src/types/identity.ts b/src/types/identity.ts index c2d4c6a..fd1b6cd 100644 --- a/src/types/identity.ts +++ b/src/types/identity.ts @@ -13,10 +13,6 @@ export interface PublicUserInfo { accessLevelHmac: string; } -export interface UserProfile { - username: string; -} - export enum Network { mainnet = 'mainnet', testnet = 'testnet',