added following functionality

This commit is contained in:
Nicolas Constant 2020-09-12 14:01:35 -04:00
parent b02979430c
commit 63c2385644
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 43 additions and 3 deletions

View File

@ -12,7 +12,7 @@
<img class="content__expand content__expand--smaller" src="assets/img/account.png" /><br /> <img class="content__expand content__expand--smaller" src="assets/img/account.png" /><br />
</a> </a>
<a class="follow" href (click)="follow()" title="follow @Sengi_app with all your account(s)"> <a class="follow" href (click)="follow()" title="follow @Sengi_app with all your account(s)" [class.follow__disabled]="followingDisabled">
Follow @Sengi_app Follow @Sengi_app
</a> </a>
</p> </p>

View File

@ -10,8 +10,20 @@
transition: all .2s; transition: all .2s;
box-shadow: inset 0 0 5px rgb(0, 84, 122); box-shadow: inset 0 0 5px rgb(0, 84, 122);
&:hover, &:focus { &:hover,
&:focus {
text-decoration: none; text-decoration: none;
background-color: rgb(0, 84, 122); background-color: rgb(0, 84, 122);
} }
&__disabled {
opacity: .15;
border: 1px solid gray;
&:hover,
&:focus {
text-decoration: none;
background-color: gray;
}
}
} }

View File

@ -1,18 +1,41 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ToolsService } from '../../../services/tools.service';
import { MastodonWrapperService } from '../../../services/mastodon-wrapper.service';
import { NotificationService } from '../../../services/notification.service';
@Component({ @Component({
selector: 'app-thankyou-tutorial', selector: 'app-thankyou-tutorial',
templateUrl: './thankyou-tutorial.component.html', templateUrl: './thankyou-tutorial.component.html',
styleUrls: ['../tutorial-enhanced.component.scss', './thankyou-tutorial.component.scss'] styleUrls: ['../tutorial-enhanced.component.scss', './thankyou-tutorial.component.scss']
}) })
export class ThankyouTutorialComponent implements OnInit { export class ThankyouTutorialComponent implements OnInit {
followingDisabled: boolean;
constructor() { } constructor(
private readonly notificationService: NotificationService,
private readonly mastodonService: MastodonWrapperService,
private readonly toolsService: ToolsService) { }
ngOnInit() { ngOnInit() {
} }
follow(): boolean { follow(): boolean {
if(this.followingDisabled) return;
this.followingDisabled = true;
const accounts = this.toolsService.getAllAccounts();
for (let acc of accounts) {
this.toolsService.findAccount(acc, "@sengi_app@mastodon.social")
.then(sengi => {
return this.mastodonService.follow(acc, sengi);
})
.catch(err => {
this.followingDisabled = false;
this.notificationService.notifyHttpError(err, acc);
});
}
return false; return false;
} }
} }

View File

@ -119,6 +119,11 @@ export class ToolsService {
return regAccounts.filter(x => x.isSelected); return regAccounts.filter(x => x.isSelected);
} }
getAllAccounts(): AccountInfo[] {
let regAccounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts;
return regAccounts;
}
getAccountById(accountId: string): AccountInfo { getAccountById(accountId: string): AccountInfo {
let regAccounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts; let regAccounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts;
return regAccounts.find(x => x.id === accountId); return regAccounts.find(x => x.id === accountId);