mirror of
https://github.com/block-core/blockcore-notes.git
synced 2024-09-29 14:30:43 +00:00
Display "Following" as total number of following both public and private
This commit is contained in:
parent
1a5dfaf38e
commit
2f7c75ab8f
@ -62,7 +62,7 @@
|
|||||||
<div class="data">
|
<div class="data">
|
||||||
<ul>
|
<ul>
|
||||||
<li>0 <span>Followers</span></li>
|
<li>0 <span>Followers</span></li>
|
||||||
<li>0 <span>Following</span></li>
|
<li *ngIf="profileService.following$ | async as following">{{ following.length }} <span>Following</span></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { NostrProfile, NostrProfileDocument } from './interfaces';
|
import { NostrProfile, NostrProfileDocument } from './interfaces';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, map, Observable } from 'rxjs';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { ApplicationState } from './applicationstate.service';
|
import { ApplicationState } from './applicationstate.service';
|
||||||
|
|
||||||
@ -15,6 +15,21 @@ export class ProfileService {
|
|||||||
|
|
||||||
// #profile: NostrProfileDocument;
|
// #profile: NostrProfileDocument;
|
||||||
|
|
||||||
|
/** TODO: Destroy this array when there are zero subscribers left. */
|
||||||
|
profiles: NostrProfileDocument[] = [];
|
||||||
|
|
||||||
|
#followingChanged: BehaviorSubject<NostrProfileDocument[]> = new BehaviorSubject<NostrProfileDocument[]>(this.profiles);
|
||||||
|
|
||||||
|
get following$(): Observable<NostrProfileDocument[]> {
|
||||||
|
// value.follow == true
|
||||||
|
return this.#profilesChanged.asObservable().pipe(
|
||||||
|
map((data) => {
|
||||||
|
const filtered = data.filter((events) => events.follow == true);
|
||||||
|
return filtered;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#profileChanged: BehaviorSubject<NostrProfileDocument | undefined> = new BehaviorSubject<NostrProfileDocument | undefined>(undefined);
|
#profileChanged: BehaviorSubject<NostrProfileDocument | undefined> = new BehaviorSubject<NostrProfileDocument | undefined>(undefined);
|
||||||
|
|
||||||
/** Profile of the authenticated user. */
|
/** Profile of the authenticated user. */
|
||||||
@ -26,9 +41,6 @@ export class ProfileService {
|
|||||||
this.#profileChanged.next(profile);
|
this.#profileChanged.next(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO: Destroy this array when there are zero subscribers left. */
|
|
||||||
profiles: NostrProfileDocument[] = [];
|
|
||||||
|
|
||||||
#profilesChanged: BehaviorSubject<NostrProfileDocument[]> = new BehaviorSubject<NostrProfileDocument[]>(this.profiles);
|
#profilesChanged: BehaviorSubject<NostrProfileDocument[]> = new BehaviorSubject<NostrProfileDocument[]>(this.profiles);
|
||||||
|
|
||||||
get profiles$(): Observable<NostrProfileDocument[]> {
|
get profiles$(): Observable<NostrProfileDocument[]> {
|
||||||
@ -43,6 +55,7 @@ export class ProfileService {
|
|||||||
|
|
||||||
#updated() {
|
#updated() {
|
||||||
this.#profilesChanged.next(this.profiles);
|
this.#profilesChanged.next(this.profiles);
|
||||||
|
this.#followingChanged.next(this.profiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutedPublicKeys() {
|
mutedPublicKeys() {
|
||||||
|
Loading…
Reference in New Issue
Block a user