fix the retriaval of relationships from other accounts
This commit is contained in:
parent
3a0dc99783
commit
dca563e176
|
@ -11,15 +11,15 @@
|
|||
|
||||
<div class="profile-header__follow" *ngIf="relationship">
|
||||
<button class="profile-header__follow--button profile-header__follow--unfollowed" title="follow"
|
||||
(click)="folow()" *ngIf="!relationship.following && !relationship.requested">
|
||||
(click)="follow()" *ngIf="!relationship.following && !relationship.requested">
|
||||
<fa-icon [icon]="faUserRegular"></fa-icon>
|
||||
</button>
|
||||
<button class="profile-header__follow--button profile-header__follow--followed" title="unfollow"
|
||||
(click)="unfolow()" *ngIf="relationship.following">
|
||||
(click)="unfollow()" *ngIf="relationship.following">
|
||||
<fa-icon [icon]="faUserCheck"></fa-icon>
|
||||
</button>
|
||||
<button class="profile-header__follow--button profile-header__follow--followed" title="pending"
|
||||
(click)="unfolow()" *ngIf="relationship.requested">
|
||||
(click)="unfollow()" *ngIf="relationship.requested">
|
||||
<fa-icon [icon]="faHourglassHalf"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -62,8 +62,16 @@ export class UserProfileComponent implements OnInit {
|
|||
ngOnInit() {
|
||||
this.accountSub = this.accounts$.subscribe((accounts: AccountInfo[]) => {
|
||||
if (this.account) {
|
||||
const userAccount = accounts.filter(x => x.isSelected)[0];
|
||||
this.getFollowStatus(userAccount, this.account);
|
||||
this.relationship = null;
|
||||
const userAccount = accounts.filter(x => x.isSelected)[0];
|
||||
|
||||
this.toolsService.findAccount(userAccount, this.lastAccountName)
|
||||
.then((account: Account) => {
|
||||
this.getFollowStatus(userAccount, account);
|
||||
})
|
||||
.catch((err: HttpErrorResponse) => {
|
||||
this.notificationService.notifyHttpError(err);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -81,7 +89,7 @@ export class UserProfileComponent implements OnInit {
|
|||
this.lastAccountName = accountName;
|
||||
this.currentlyUsedAccount = this.toolsService.getSelectedAccounts()[0];
|
||||
|
||||
return this.toolsService.findAccount(this.currentlyUsedAccount, accountName)
|
||||
return this.toolsService.findAccount(this.currentlyUsedAccount, this.lastAccountName)
|
||||
.then((account: Account) => {
|
||||
this.isLoading = false;
|
||||
this.statusLoading = true;
|
||||
|
@ -138,4 +146,19 @@ export class UserProfileComponent implements OnInit {
|
|||
browseThread(openThreadEvent: OpenThreadEvent): void {
|
||||
this.browseThreadEvent.next(openThreadEvent);
|
||||
}
|
||||
|
||||
follow(): boolean {
|
||||
|
||||
this.mastodonService.follow(this.currentlyUsedAccount, this.account)
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
return false;
|
||||
}
|
||||
|
||||
unfollow(): boolean {
|
||||
this.mastodonService.unfollow(this.currentlyUsedAccount, this.account)
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,6 +178,13 @@ export class MastodonService {
|
|||
const headers = new HttpHeaders({ 'Authorization': `Bearer ${account.token.access_token}` });
|
||||
return this.httpClient.get<Relationship[]>(route, { headers: headers }).toPromise();
|
||||
}
|
||||
|
||||
unfollow(currentlyUsedAccount: AccountInfo, account: Account): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
follow(currentlyUsedAccount: AccountInfo, account: Account): any {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}
|
||||
|
||||
export enum VisibilityEnum {
|
||||
|
|
Loading…
Reference in New Issue