added following functionality
This commit is contained in:
parent
b02979430c
commit
63c2385644
|
@ -12,7 +12,7 @@
|
|||
<img class="content__expand content__expand--smaller" src="assets/img/account.png" /><br />
|
||||
</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
|
||||
</a>
|
||||
</p>
|
||||
|
|
|
@ -10,8 +10,20 @@
|
|||
transition: all .2s;
|
||||
box-shadow: inset 0 0 5px rgb(0, 84, 122);
|
||||
|
||||
&:hover, &:focus {
|
||||
&:hover,
|
||||
&:focus {
|
||||
text-decoration: none;
|
||||
background-color: rgb(0, 84, 122);
|
||||
}
|
||||
|
||||
&__disabled {
|
||||
opacity: .15;
|
||||
border: 1px solid gray;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
text-decoration: none;
|
||||
background-color: gray;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +1,41 @@
|
|||
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({
|
||||
selector: 'app-thankyou-tutorial',
|
||||
templateUrl: './thankyou-tutorial.component.html',
|
||||
styleUrls: ['../tutorial-enhanced.component.scss', './thankyou-tutorial.component.scss']
|
||||
})
|
||||
export class ThankyouTutorialComponent implements OnInit {
|
||||
followingDisabled: boolean;
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private readonly notificationService: NotificationService,
|
||||
private readonly mastodonService: MastodonWrapperService,
|
||||
private readonly toolsService: ToolsService) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,11 @@ export class ToolsService {
|
|||
return regAccounts.filter(x => x.isSelected);
|
||||
}
|
||||
|
||||
getAllAccounts(): AccountInfo[] {
|
||||
let regAccounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts;
|
||||
return regAccounts;
|
||||
}
|
||||
|
||||
getAccountById(accountId: string): AccountInfo {
|
||||
let regAccounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts;
|
||||
return regAccounts.find(x => x.id === accountId);
|
||||
|
|
Loading…
Reference in New Issue