X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Ffollows%2Ffollowing-list%2Ffollow-modal.component.ts;h=bac7b2b0186d8605dfba9a862962597de2ba44c8;hb=eaa529528cafcfb291009f9f99d296c81e792899;hp=dc69092002714072d7509ea38b64a94d9304f786;hpb=421ff4618da64f0849353383f690a014024c40da;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+admin/follows/following-list/follow-modal.component.ts b/client/src/app/+admin/follows/following-list/follow-modal.component.ts index dc6909200..bac7b2b01 100644 --- a/client/src/app/+admin/follows/following-list/follow-modal.component.ts +++ b/client/src/app/+admin/follows/following-list/follow-modal.component.ts @@ -1,5 +1,6 @@ import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' import { Notifier } from '@app/core' +import { prepareIcu } from '@app/helpers' import { splitAndGetNotEmpty, UNIQUE_HOSTS_OR_HANDLE_VALIDATOR } from '@app/shared/form-validators/host-validators' import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' import { InstanceFollowService } from '@app/shared/shared-instance' @@ -54,16 +55,23 @@ export class FollowModalComponent extends FormReactive implements OnInit { return window.location.protocol === 'https:' } - private async addFollowing () { + private addFollowing () { const hostsOrHandles = splitAndGetNotEmpty(this.form.value['hostsOrHandles']) - this.followService.follow(hostsOrHandles).subscribe( - () => { - this.notifier.success($localize`Follow request(s) sent!`) - this.newFollow.emit() - }, + this.followService.follow(hostsOrHandles) + .subscribe({ + next: () => { + this.notifier.success( + prepareIcu($localize`{count, plural, =1 {Follow request} other {Follow requests}} sent!`)( + { count: hostsOrHandles.length }, + $localize`Follow request(s) sent!` + ) + ) - err => this.notifier.error(err.message) - ) + this.newFollow.emit() + }, + + error: err => this.notifier.error(err.message) + }) } }