From 8f540c48f82b61428f66fa834e5ba9b86d6cb944 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 15 Jun 2019 14:03:29 -0400 Subject: [PATCH] added avatar link in my profile --- .../manage-account.component.html | 36 ++++++++----------- .../manage-account.component.ts | 19 ++++++++++ src/app/models/account.models.ts | 4 --- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/app/components/floating-column/manage-account/manage-account.component.html b/src/app/components/floating-column/manage-account/manage-account.component.html index 37314bfb..2e52ec73 100644 --- a/src/app/components/floating-column/manage-account/manage-account.component.html +++ b/src/app/components/floating-column/manage-account/manage-account.component.html @@ -2,7 +2,9 @@

Manage Account

- + + + - @@ -27,27 +28,18 @@
- - - - - - + \ No newline at end of file diff --git a/src/app/components/floating-column/manage-account/manage-account.component.ts b/src/app/components/floating-column/manage-account/manage-account.component.ts index 9bd9ff5b..e8f6cab2 100644 --- a/src/app/components/floating-column/manage-account/manage-account.component.ts +++ b/src/app/components/floating-column/manage-account/manage-account.component.ts @@ -6,6 +6,10 @@ import { Subscription } from 'rxjs'; import { AccountWrapper } from '../../../models/account.models'; import { UserNotificationService, UserNotification } from '../../../services/user-notification.service'; import { OpenThreadEvent } from '../../../services/tools.service'; +import { MastodonService } from '../../../services/mastodon.service'; +import { Account } from "../../../services/models/mastodon.interfaces"; +import { NotificationService } from '../../../services/notification.service'; +import { AccountInfo } from '../../../states/accounts.state'; @Component({ @@ -25,6 +29,8 @@ export class ManageAccountComponent implements OnInit, OnDestroy { hasNotifications = false; hasMentions = false; + userAccount: Account; + @Output() browseAccountEvent = new EventEmitter(); @Output() browseHashtagEvent = new EventEmitter(); @Output() browseThreadEvent = new EventEmitter(); @@ -33,6 +39,7 @@ export class ManageAccountComponent implements OnInit, OnDestroy { set account(acc: AccountWrapper) { this._account = acc; this.checkNotifications(); + this.getUserUrl(acc.info); } get account(): AccountWrapper { return this._account; @@ -42,6 +49,8 @@ export class ManageAccountComponent implements OnInit, OnDestroy { private _account: AccountWrapper; constructor( + private readonly mastodonService: MastodonService, + private readonly notificationService: NotificationService, private readonly userNotificationService: UserNotificationService) { } ngOnInit() { @@ -52,6 +61,16 @@ export class ManageAccountComponent implements OnInit, OnDestroy { this.userNotificationServiceSub.unsubscribe(); } + private getUserUrl(account: AccountInfo){ + this.mastodonService.retrieveAccountDetails(this.account.info) + .then((acc: Account) => { + this.userAccount = acc; + }) + .catch(err => { + this.notificationService.notifyHttpError(err); + }); + } + private checkNotifications(){ if(this.userNotificationServiceSub){ this.userNotificationServiceSub.unsubscribe(); diff --git a/src/app/models/account.models.ts b/src/app/models/account.models.ts index c18f51bf..359e3d27 100644 --- a/src/app/models/account.models.ts +++ b/src/app/models/account.models.ts @@ -5,10 +5,6 @@ export class AccountWrapper { constructor() { } -// id: number; -// username: string; -// display_name: string; - info: AccountInfo; avatar: string; }