Compare commits
2 Commits
186a26fae1
...
a9e9f1f03a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9e9f1f03a | ||
|
|
beb5cd496a |
|
|
@ -52,7 +52,8 @@
|
||||||
<input matInput placeholder="Discord ID" [(ngModel)]="discordId"
|
<input matInput placeholder="Discord ID" [(ngModel)]="discordId"
|
||||||
minlength="17" maxlength="18" pattern="^[0-9]+$">
|
minlength="17" maxlength="18" pattern="^[0-9]+$">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<button mat-raised-button (click)="checkPunishment()" [disabled]="authService.username() == null">
|
<button mat-raised-button (click)="checkPunishment()"
|
||||||
|
[disabled]="punishmentLoading || authService.username() == null">
|
||||||
Check punishments
|
Check punishments
|
||||||
</button>
|
</button>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -148,7 +149,7 @@
|
||||||
}
|
}
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<button mat-raised-button (click)="onSubmit()" [disabled]="form.invalid">
|
<button mat-raised-button (click)="onSubmit()" [disabled]="formSubmitting || form.invalid">
|
||||||
Submit Appeal
|
Submit Appeal
|
||||||
</button>
|
</button>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import {MatIconModule} from '@angular/material/icon';
|
||||||
import {VerifyMailDialogComponent} from '@pages/forms/verify-mail-dialog/verify-mail-dialog.component';
|
import {VerifyMailDialogComponent} from '@pages/forms/verify-mail-dialog/verify-mail-dialog.component';
|
||||||
import {MatDialog} from '@angular/material/dialog';
|
import {MatDialog} from '@angular/material/dialog';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
|
import {finalize} from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-discord-appeal',
|
selector: 'app-discord-appeal',
|
||||||
|
|
@ -131,7 +132,12 @@ export class DiscordAppealComponent implements OnInit {
|
||||||
return this.currentPageIndex === this.totalPages.length - 1;
|
return this.currentPageIndex === this.totalPages.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected punishmentLoading: boolean = false;
|
||||||
|
|
||||||
protected checkPunishment() {
|
protected checkPunishment() {
|
||||||
|
if (this.punishmentLoading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (window.location.hostname === 'localhost') {
|
if (window.location.hostname === 'localhost') {
|
||||||
this.bannedUser = {
|
this.bannedUser = {
|
||||||
isBanned: false,
|
isBanned: false,
|
||||||
|
|
@ -146,6 +152,9 @@ export class DiscordAppealComponent implements OnInit {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.appealService.getBannedUser(this.discordId)
|
this.appealService.getBannedUser(this.discordId)
|
||||||
|
.pipe(
|
||||||
|
finalize(() => this.punishmentLoading = false)
|
||||||
|
)
|
||||||
.subscribe(user => {
|
.subscribe(user => {
|
||||||
this.bannedUser = user
|
this.bannedUser = user
|
||||||
this.nextPage();
|
this.nextPage();
|
||||||
|
|
@ -171,7 +180,12 @@ export class DiscordAppealComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected formSubmitting: boolean = false;
|
||||||
|
|
||||||
private sendForm() {
|
private sendForm() {
|
||||||
|
if (this.formSubmitting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const rawValue = this.form.getRawValue();
|
const rawValue = this.form.getRawValue();
|
||||||
const uuid = this.authService.getUuid();
|
const uuid = this.authService.getUuid();
|
||||||
if (uuid === null) {
|
if (uuid === null) {
|
||||||
|
|
@ -182,7 +196,11 @@ export class DiscordAppealComponent implements OnInit {
|
||||||
appeal: rawValue.appeal,
|
appeal: rawValue.appeal,
|
||||||
email: rawValue.email,
|
email: rawValue.email,
|
||||||
}
|
}
|
||||||
this.appealService.submitDiscordAppeal(appeal).subscribe((result) => {
|
this.appealService.submitDiscordAppeal(appeal)
|
||||||
|
.pipe(
|
||||||
|
finalize(() => this.formSubmitting = false)
|
||||||
|
)
|
||||||
|
.subscribe((result) => {
|
||||||
if (!result.verified_mail) {
|
if (!result.verified_mail) {
|
||||||
throw new Error('Mail not verified');
|
throw new Error('Mail not verified');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user