mirror of
https://github.com/bitwarden/browser
synced 2026-02-11 14:04:03 +00:00
[PM-29771] Make invitation non-plural if only 1 member selected (#18684)
* Make invitation non-plural if only 1 member selected * Add isSingleInvite as per Jimmy's suggestion
This commit is contained in:
@@ -136,7 +136,7 @@
|
||||
*ngIf="showBulkReinviteUsers"
|
||||
>
|
||||
<i class="bwi bwi-fw bwi-envelope" aria-hidden="true"></i>
|
||||
{{ "reinviteSelected" | i18n }}
|
||||
{{ (isSingleInvite ? "resendInvitation" : "reinviteSelected") | i18n }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -597,6 +597,16 @@ export class MembersComponent extends BaseMembersComponent<OrganizationUserView>
|
||||
.every((member) => member.managedByOrganization && validStatuses.includes(member.status));
|
||||
}
|
||||
|
||||
get selectedInvitedCount(): number {
|
||||
return this.dataSource
|
||||
.getCheckedUsers()
|
||||
.filter((member) => member.status === this.userStatusType.Invited).length;
|
||||
}
|
||||
|
||||
get isSingleInvite(): boolean {
|
||||
return this.selectedInvitedCount === 1;
|
||||
}
|
||||
|
||||
exportMembers = () => {
|
||||
const result = this.memberExportService.getMemberExport(this.dataSource.data);
|
||||
if (result.success) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
@let bulkActions = bulkMenuOptions$ | async;
|
||||
@let showConfirmBanner = showConfirmBanner$ | async;
|
||||
@let isProcessing = this.isProcessing();
|
||||
@let isSingleInvite = isSingleInvite$ | async;
|
||||
|
||||
@if (organization && dataSource) {
|
||||
<app-organization-free-trial-warning
|
||||
@@ -151,7 +152,7 @@
|
||||
(click)="isProcessing ? null : bulkReinvite(organization)"
|
||||
>
|
||||
<i class="bwi bwi-fw bwi-envelope" aria-hidden="true"></i>
|
||||
{{ "reinviteSelected" | i18n }}
|
||||
{{ (isSingleInvite ? "resendInvitation" : "reinviteSelected") | i18n }}
|
||||
</button>
|
||||
}
|
||||
@if (bulkActions.showBulkConfirmUsers) {
|
||||
|
||||
@@ -125,6 +125,16 @@ export class vNextMembersComponent {
|
||||
.usersUpdated()
|
||||
.pipe(map(() => showConfirmBanner(this.dataSource())));
|
||||
|
||||
protected selectedInvitedCount$ = this.dataSource()
|
||||
.usersUpdated()
|
||||
.pipe(
|
||||
map(
|
||||
(members) => members.filter((m) => m.status === OrganizationUserStatusType.Invited).length,
|
||||
),
|
||||
);
|
||||
|
||||
protected isSingleInvite$ = this.selectedInvitedCount$.pipe(map((count) => count === 1));
|
||||
|
||||
protected isProcessing = this.memberActionsService.isProcessing;
|
||||
|
||||
protected readonly canUseSecretsManager: Signal<boolean> = computed(
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
*ngIf="showBulkReinviteUsers"
|
||||
>
|
||||
<i class="bwi bwi-fw bwi-envelope" aria-hidden="true"></i>
|
||||
{{ "reinviteSelected" | i18n }}
|
||||
{{ (isSingleInvite ? "resendInvitation" : "reinviteSelected") | i18n }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -333,4 +333,14 @@ export class MembersComponent extends BaseMembersComponent<ProviderUser> {
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
};
|
||||
|
||||
get selectedInvitedCount(): number {
|
||||
return this.dataSource
|
||||
.getCheckedUsers()
|
||||
.filter((member) => member.status === this.userStatusType.Invited).length;
|
||||
}
|
||||
|
||||
get isSingleInvite(): boolean {
|
||||
return this.selectedInvitedCount === 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
@let showConfirmBanner = showConfirmBanner$ | async;
|
||||
@let dataSource = this.dataSource();
|
||||
@let isProcessing = this.isProcessing();
|
||||
@let isSingleInvite = isSingleInvite$ | async;
|
||||
|
||||
<app-header>
|
||||
<bit-search class="tw-grow" [formControl]="searchControl" [placeholder]="'searchMembers' | i18n">
|
||||
@@ -92,7 +93,7 @@
|
||||
(click)="isProcessing ? null : bulkReinvite(providerId)"
|
||||
>
|
||||
<i class="bwi bwi-fw bwi-envelope" aria-hidden="true"></i>
|
||||
{{ "reinviteSelected" | i18n }}
|
||||
{{ (isSingleInvite ? "resendInvitation" : "reinviteSelected") | i18n }}
|
||||
</button>
|
||||
}
|
||||
@if (bulkMenuOptions.showBulkConfirmUsers) {
|
||||
|
||||
@@ -104,6 +104,14 @@ export class vNextMembersComponent {
|
||||
.usersUpdated()
|
||||
.pipe(map(() => showConfirmBanner(this.dataSource())));
|
||||
|
||||
protected selectedInvitedCount$ = this.dataSource()
|
||||
.usersUpdated()
|
||||
.pipe(
|
||||
map((members) => members.filter((m) => m.status === ProviderUserStatusType.Invited).length),
|
||||
);
|
||||
|
||||
protected isSingleInvite$ = this.selectedInvitedCount$.pipe(map((count) => count === 1));
|
||||
|
||||
protected isProcessing = this.providerActionsService.isProcessing;
|
||||
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user