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 {AccountService} from './account.service';
|
||||||
import {CryptoService} from './crypto.service';
|
import {CryptoService} from './crypto.service';
|
||||||
import {GlobalVarsService} from './global-vars.service';
|
import {GlobalVarsService} from './global-vars.service';
|
||||||
import {UserProfile} from '../types/identity';
|
|
||||||
|
|
||||||
export class ProfileEntryResponse {
|
export class ProfileEntryResponse {
|
||||||
Username: string | null = null;
|
Username: string | null = null;
|
||||||
|
@ -66,31 +65,29 @@ export class BackendAPIService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetUserProfiles(
|
GetUsernames(
|
||||||
publicKeys: string[]
|
publicKeys: string[]
|
||||||
): Observable<{[key: string]: UserProfile}> {
|
): Observable<{[key: string]: string}> {
|
||||||
const userProfiles: {[key: string]: any} = {};
|
const usernames: {[key: string]: any} = {};
|
||||||
const req = this.GetUsersStateless(publicKeys, true);
|
const req = this.GetUsersStateless(publicKeys, true);
|
||||||
if (publicKeys.length > 0) {
|
if (publicKeys.length > 0) {
|
||||||
return req.pipe(
|
return req.pipe(
|
||||||
map( res => {
|
map( res => {
|
||||||
for (const user of res.UserList) {
|
for (const user of res.UserList) {
|
||||||
userProfiles[user.PublicKeyBase58Check] = {
|
usernames[user.PublicKeyBase58Check] = user.ProfileEntryResponse?.Username
|
||||||
username: user.ProfileEntryResponse?.Username,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
return userProfiles;
|
return usernames;
|
||||||
})
|
})
|
||||||
).pipe(
|
).pipe(
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
for(const publicKey of publicKeys) {
|
for(const publicKey of publicKeys) {
|
||||||
userProfiles[publicKey] = {};
|
usernames[publicKey] = "";
|
||||||
}
|
}
|
||||||
return of(userProfiles);
|
return of(usernames);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return of(userProfiles);
|
return of(usernames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
<ul class="list-group mt-7px mb-30px saved-seeds-list">
|
<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>
|
<span class="saved-seeds-header d-flex align-items-center"><span>Select an account</span></span>
|
||||||
<div class="saved-seeds-scroll">
|
<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 class="w-100">
|
||||||
<div *ngIf="!item.value.username" class="text-truncate">{{ item.key }}…</div>
|
<div *ngIf="!item.value" class="text-truncate">{{ item.key }}…</div>
|
||||||
<div *ngIf="item.value.username" class="d-flex align-items-center">
|
<div *ngIf="item.value" class="d-flex align-items-center">
|
||||||
<div class="text-truncate">{{ item.value.username }}</div>
|
<div class="text-truncate">{{ item.value }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {AccountService} from '../account.service';
|
||||||
import {IdentityService} from '../identity.service';
|
import {IdentityService} from '../identity.service';
|
||||||
import {GlobalVarsService} from '../global-vars.service';
|
import {GlobalVarsService} from '../global-vars.service';
|
||||||
import {BackendAPIService} from '../backend-api.service';
|
import {BackendAPIService} from '../backend-api.service';
|
||||||
import {UserProfile} from '../../types/identity';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-log-in',
|
selector: 'app-log-in',
|
||||||
|
@ -11,7 +10,7 @@ import {UserProfile} from '../../types/identity';
|
||||||
styleUrls: ['./log-in.component.scss']
|
styleUrls: ['./log-in.component.scss']
|
||||||
})
|
})
|
||||||
export class LogInComponent implements OnInit {
|
export class LogInComponent implements OnInit {
|
||||||
allUsers: {[key: string]: UserProfile} = {};
|
allUsernames: {[key: string]: string} = {};
|
||||||
hasUsers = false;
|
hasUsers = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -25,9 +24,12 @@ export class LogInComponent implements OnInit {
|
||||||
// Load profile pictures and usernames
|
// Load profile pictures and usernames
|
||||||
const publicKeys = this.accountService.getPublicKeys();
|
const publicKeys = this.accountService.getPublicKeys();
|
||||||
this.hasUsers = publicKeys.length > 0;
|
this.hasUsers = publicKeys.length > 0;
|
||||||
this.backendApi.GetUserProfiles(publicKeys)
|
this.backendApi.GetUsernames(publicKeys)
|
||||||
.subscribe(profiles => {
|
.subscribe(usernames => {
|
||||||
this.allUsers = profiles;
|
// 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;
|
accessLevelHmac: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserProfile {
|
|
||||||
username: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum Network {
|
export enum Network {
|
||||||
mainnet = 'mainnet',
|
mainnet = 'mainnet',
|
||||||
testnet = 'testnet',
|
testnet = 'testnet',
|
||||||
|
|
Loading…
Reference in a new issue