Chocobozzz/PeerTube

View on GitHub
client/src/app/+admin/moderation/registration-list/process-registration-modal.component.html

Summary

Maintainability
Test Coverage
<ng-template #modal>
  <div class="modal-header">
    <h4 i18n class="modal-title">
      <ng-container *ngIf="isAccept()">Accept {{ registration.username }} registration</ng-container>
      <ng-container *ngIf="isReject()">Reject {{ registration.username }} registration</ng-container>
    </h4>

    <button class="border-0 p-0" title="Close this modal" i18n-title (click)="hide()">
      <my-global-icon iconName="cross"></my-global-icon>
    </button>
  </div>

  <form novalidate [formGroup]="form" (ngSubmit)="processRegistration()">
    <div class="modal-body mb-3">

      <my-alert i18n *ngIf="!registration.emailVerified" type="warning">
        Registration email has not been verified. Email delivery has been disabled by default.
      </my-alert>

      <div class="description">
        <ng-container *ngIf="isAccept()">
          <p i18n>
            <strong>Accepting</strong>&nbsp;<em>{{ registration.username }}</em> registration will create the account and channel.
          </p>

          <p *ngIf="isEmailEnabled()" i18n [ngClass]="{ 'text-decoration-line-through': isPreventEmailDeliveryChecked() }">
            An email will be sent to <em>{{ registration.email }}</em> explaining its account has been created with the moderation response you'll write below.
          </p>

          <my-alert *ngIf="!isEmailEnabled()" type="warning" i18n>
            Emails are not enabled on this instance so PeerTube won't be able to send an email to <em>{{ registration.email }}</em> explaining its account has been created.
          </my-alert>
        </ng-container>

        <ng-container *ngIf="isReject()">
          <p i18n [ngClass]="{ 'text-decoration-line-through': isPreventEmailDeliveryChecked() }">
            An email will be sent to <em>{{ registration.email }}</em> explaining its registration request has been <strong>rejected</strong> with the moderation response you'll write below.
          </p>

          <my-alert *ngIf="!isEmailEnabled()" type="warning" i18n>
            Emails are not enabled on this instance so PeerTube won't be able to send an email to <em>{{ registration.email }}</em> explaining its registration request has been rejected.
          </my-alert>
        </ng-container>
      </div>

      <div class="form-group">
        <label for="moderationResponse" i18n>Send a message to the user</label>

        <textarea
          formControlName="moderationResponse" ngbAutofocus name="moderationResponse" id="moderationResponse"
          [ngClass]="{ 'input-error': formErrors['moderationResponse'] }" class="form-control"
        ></textarea>

        <div *ngIf="formErrors.moderationResponse" class="form-error" role="alert">
          {{ formErrors.moderationResponse }}
        </div>
      </div>

      <div class="form-group">
        <my-peertube-checkbox
          inputName="preventEmailDelivery" formControlName="preventEmailDelivery" [disabled]="!isEmailEnabled()"
          i18n-labelText labelText="Prevent email from being sent to the user"
        ></my-peertube-checkbox>
      </div>
    </div>

    <div class="modal-footer inputs">
      <input
        type="button" role="button" i18n-value value="Cancel" class="peertube-button grey-button"
        (click)="hide()" (key.enter)="hide()"
      >

      <input type="submit" [value]="getSubmitValue()" class="peertube-button orange-button" [disabled]="!form.valid">
    </div>
  </form>
</ng-template>