display icon on relationship error

This commit is contained in:
Nicolas Constant 2020-03-11 21:07:57 -04:00
parent 8ae2edf164
commit d9c570a1bf
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 19 additions and 14 deletions

View File

@ -21,7 +21,7 @@
class="waiting-icon profile-header__follow--waiting">
</app-waiting-animation>
<div *ngIf="!loadingRelationShip">
<div *ngIf="!loadingRelationShip && !relationShipError">
<a href class="profile-header__follow--button profile-header__follow--unfollowed" title="follow"
(click)="follow()" *ngIf="!relationship.following && !relationship.requested">
<fa-icon [icon]="faUserRegular"></fa-icon>
@ -35,6 +35,11 @@
<fa-icon [icon]="faHourglassHalf"></fa-icon>
</a>
</div>
<div *ngIf="!loadingRelationShip && relationShipError">
<a class="profile-header__follow--button profile-header__follow--followed" title="error when retrieving relationship">
<fa-icon [icon]="faExclamationTriangle"></fa-icon>
</a>
</div>
</div>
</div>
</div>
@ -68,7 +73,7 @@
class="waiting-icon profile-header__follow--waiting">
</app-waiting-animation>
<div *ngIf="!loadingRelationShip">
<div *ngIf="!loadingRelationShip && !relationShipError">
<a href class="profile-header__follow--button profile-header__follow--unfollowed" title="follow"
(click)="follow()" *ngIf="!relationship.following && !relationship.requested">
<fa-icon [icon]="faUserRegular"></fa-icon>
@ -82,6 +87,11 @@
<fa-icon [icon]="faHourglassHalf"></fa-icon>
</a>
</div>
<div *ngIf="!loadingRelationShip && relationShipError">
<a class="profile-header__follow--button profile-header__follow--followed" title="error when retrieving relationship">
<fa-icon [icon]="faExclamationTriangle"></fa-icon>
</a>
</div>
</div>
<div class="profile-header__state"
*ngIf="relationship && !displayedAccount.moved && !loadingRelationShip">

View File

@ -1,6 +1,6 @@
import { Component, OnInit, Input, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';
import { faUser, faHourglassHalf, faUserCheck } from "@fortawesome/free-solid-svg-icons";
import { faUser, faHourglassHalf, faUserCheck, faExclamationTriangle } from "@fortawesome/free-solid-svg-icons";
import { faUser as faUserRegular } from "@fortawesome/free-regular-svg-icons";
import { Observable, Subscription } from 'rxjs';
import { Store } from '@ngxs/store';
@ -26,6 +26,7 @@ export class UserProfileComponent implements OnInit {
faUserRegular = faUserRegular;
faHourglassHalf = faHourglassHalf;
faUserCheck = faUserCheck;
faExclamationTriangle = faExclamationTriangle;
displayedAccount: Account;
hasNote: boolean;
@ -34,6 +35,7 @@ export class UserProfileComponent implements OnInit {
isLoading: boolean;
loadingRelationShip = false;
relationShipError = false;
showFloatingHeader = false;
showFloatingStatusMenu = false;
@ -101,12 +103,14 @@ export class UserProfileComponent implements OnInit {
const userAccount = accounts.filter(x => x.isSelected)[0];
this.loadingRelationShip = true;
this.relationShipError = false;
this.toolsService.findAccount(userAccount, this.lastAccountName)
.then((account: Account) => {
return this.getFollowStatus(userAccount, account);
})
.catch((err: HttpErrorResponse) => {
this.notificationService.notifyHttpError(err, userAccount);
console.error(err);
this.relationShipError = true;
})
.then(() => {
this.loadingRelationShip = false;
@ -153,12 +157,6 @@ export class UserProfileComponent implements OnInit {
this.currentlyUsedAccount = this.toolsService.getSelectedAccounts()[0];
return this.toolsService.findAccount(this.currentlyUsedAccount, this.lastAccountName)
// .then((account: Account) => {
// if(account != null) return account;
// let fullName = `https://${this.lastAccountName.split('@')[2]}/@${this.lastAccountName.split('@')[1]}`;
// return this.toolsService.findAccount(this.currentlyUsedAccount, fullName);
// })
.then((account: Account) => {
this.isLoading = false;
this.statusLoading = true;
@ -176,7 +174,7 @@ export class UserProfileComponent implements OnInit {
return Promise.all([getFollowStatusPromise, getStatusesPromise, getPinnedStatusesPromise]);
})
.catch((err: HttpErrorResponse) => {
//this.notificationService.notifyHttpError(err, this.currentlyUsedAccount);
console.error(err);
})
.then(() => {
this.isLoading = false;

View File

@ -129,11 +129,8 @@ export class ToolsService {
return findAccountFunc(results);
})
.then((foundAccount: Account) => {
console.warn(accountName);
if (foundAccount != null) return Promise.resolve(foundAccount);
console.error('tada');
let fullName = `https://${accountName.split('@')[1]}/@${accountName.split('@')[0]}`;
return this.mastodonService.search(account, fullName, searchVersion, true)
.then((results: Results) => {