From 5b6b463b90a8ad1712c06fb10f55ce3c710650c3 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Tue, 1 Oct 2019 21:58:21 -0400 Subject: [PATCH] temp workaround for boost/fav for pixelfed --- .../status/action-bar/action-bar.component.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/components/stream/status/action-bar/action-bar.component.ts b/src/app/components/stream/status/action-bar/action-bar.component.ts index 0c0f41ff..29773f8f 100644 --- a/src/app/components/stream/status/action-bar/action-bar.component.ts +++ b/src/app/components/stream/status/action-bar/action-bar.component.ts @@ -155,7 +155,11 @@ export class ActionBarComponent implements OnInit, OnDestroy { if (boostedStatus.pleroma) { this.bootedStatePerAccountId[account.id] = boostedStatus.reblog !== null; //FIXME: when Pleroma will return the good status } else { - this.bootedStatePerAccountId[account.id] = boostedStatus.reblogged; + let reblogged = boostedStatus.reblogged; //FIXME: when pixelfed will return the good status + if(reblogged === null){ + reblogged = !this.bootedStatePerAccountId[account.id]; + } + this.bootedStatePerAccountId[account.id] = reblogged; } this.checkIfBoosted(); @@ -187,9 +191,12 @@ export class ActionBarComponent implements OnInit, OnDestroy { } }) .then((favoritedStatus: Status) => { - this.favoriteStatePerAccountId[account.id] = favoritedStatus.favourited; + let favourited = favoritedStatus.favourited; //FIXME: when pixelfed will return the good status + if(favourited === null){ + favourited = !this.favoriteStatePerAccountId[account.id]; + } + this.favoriteStatePerAccountId[account.id] = favourited; this.checkIfFavorited(); - // this.isFavorited = !this.isFavorited; }) .catch((err: HttpErrorResponse) => { this.notificationService.notifyHttpError(err, account);