Don't need UserProfile struct anymore. We'll make a new one if this separation matters again.
This commit is contained in:
parent
44f65ab93e
commit
51e089f9a9
4 changed files with 19 additions and 24 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,6 @@ export interface PublicUserInfo {
|
|||
accessLevelHmac: string;
|
||||
}
|
||||
|
||||
export interface UserProfile {
|
||||
username: string;
|
||||
}
|
||||
|
||||
export enum Network {
|
||||
mainnet = 'mainnet',
|
||||
testnet = 'testnet',
|
||||
|
|
Loading…
Reference in a new issue