Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amount participants visibility in committee/meeting #4178

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ function getMeetingListFollowConfig(
idField: idField,
follow: [
{ idField: `committee_id`, fieldset: `name` },
{ idField: `organization_tag_ids`, fieldset: FULL_FIELDSET }
{ idField: `organization_tag_ids`, fieldset: FULL_FIELDSET },
{ idField: `group_ids`, fieldset: [`name`, `permissions`] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you need this but I don't like that this could increase subscription sizes a lot. Also I think the name is not needed.

],
fieldset: `list`
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ export const getCommitteeDetailSubscriptionConfig: SubscriptionConfigGenerator =
follow: [{ idField: `meeting_user_ids`, fieldset: `groups` }]
},
{
idField: `meeting_ids`
idField: `meeting_ids`,
follow: [
{
idField: `group_ids`,
fieldset: [`permissions`, `name`]
}
]
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,20 @@
</mat-card-actions>

<mat-card-content>
<!-- users -->
<div class="user-footer">
<ng-container
*osCmlPerms="
CML.can_manage;
committeeId: committee.id;
orOML: OML.can_manage_users;
then: canManageUsersTemplate;
else: canNotManageUsersTemplate
"
></ng-container>
</div>
@if (showParticipants) {
<!-- users -->
<div class="user-footer">
<ng-container
*osCmlPerms="
CML.can_manage;
committeeId: committee.id;
orOML: OML.can_manage_users;
then: canManageUsersTemplate;
else: canNotManageUsersTemplate
"
></ng-container>
</div>
}
</mat-card-content>
</mat-card>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class CommitteeMeetingPreviewComponent {
@Input() public meeting!: ViewMeeting;
@Input() public committee!: ViewCommittee;
@Input() public isCMAndRequireDuplicateFrom!: boolean;
@Input() public showParticipants!: boolean;

public readonly OML = OML;
public readonly CML = CML;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ <h1>
</mat-card-content>
</mat-card>
}
@for (meeting of getMeetingsSorted(committee); track meeting) {
@for (meeting of getMeetingsSorted(committee); track meeting.id) {
<os-committee-meeting-preview
class="meeting-preview-card"
[committee]="committee"
[isCMAndRequireDuplicateFrom]="isCMandRequireDuplicateFrom()"
[meeting]="meeting"
[showParticipants]="canSeeParticipantAmount(meeting)"
></os-committee-meeting-preview>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { Id } from 'src/app/domain/definitions/key-types';
import { CML, OML } from 'src/app/domain/definitions/organization-permission';
import { Permission } from 'src/app/domain/definitions/permission';
import { Committee } from 'src/app/domain/models/comittees/committee';
import { ViewMeeting } from 'src/app/site/pages/meetings/view-models/view-meeting';
import { OrganizationSettingsService } from 'src/app/site/pages/organization/services/organization-settings.service';
Expand Down Expand Up @@ -38,6 +39,14 @@ export class CommitteeDetailViewComponent extends BaseUiComponent {
return this.operator.hasCommitteePermissions(this.committeeId, CML.can_manage);
}

public canSeeParticipantAmount(meeting: ViewMeeting): boolean {
return (
this.operator.isOrgaManager ||
this.canManageCommittee ||
this.operator.hasPermsInMeeting(meeting.id, Permission.userCanSee)
);
}

public constructor(
private translate: TranslateService,
private route: ActivatedRoute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,27 +102,29 @@ <h2>{{ 'Committees' | translate }}</h2>
</os-icon-container>
</div>
}
@if (committee.memberAmount) {
<div>
<os-icon-container
icon="group"
iconTooltipPosition="right"
iconTooltip="{{ 'Accounts' | translate }}"
>
{{ committee.memberAmount }}
</os-icon-container>
</div>
}
@if (committee.managerAmount) {
<div>
<os-icon-container
icon="engineering"
iconTooltipPosition="right"
iconTooltip="{{ 'Committee management' | translate }}"
>
{{ committee.managerAmount }}
</os-icon-container>
</div>
@if (canSeeMemberAmounts(committee)) {
@if (committee.memberAmount) {
<div>
<os-icon-container
icon="group"
iconTooltipPosition="right"
iconTooltip="{{ 'Accounts' | translate }}"
>
{{ committee.memberAmount }}
</os-icon-container>
</div>
}
@if (committee.managerAmount) {
<div>
<os-icon-container
icon="engineering"
iconTooltipPosition="right"
iconTooltip="{{ 'Committee management' | translate }}"
>
{{ committee.managerAmount }}
</os-icon-container>
</div>
}
}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { marker as _ } from '@colsen1991/ngx-translate-extract-marker';
import { TranslateService } from '@ngx-translate/core';
import { CML } from 'src/app/domain/definitions/organization-permission';
import { Action } from 'src/app/gateways/actions';
import { BaseListViewComponent } from 'src/app/site/base/base-list-view.component';
import { SpinnerService } from 'src/app/site/modules/global-spinner';
Expand All @@ -28,6 +29,10 @@ const COMMITTEE_LIST_STORAGE_INDEX = `committee_list`;
styleUrls: [`./committee-list.component.scss`]
})
export class CommitteeListComponent extends BaseListViewComponent<ViewCommittee> {
public canSeeMemberAmounts(committee: ViewCommittee): boolean {
return this.operator.isAccountAdmin || this.operator.hasCommitteePermissions(committee.id, CML.can_manage);
}

private get messageForSpinner(): string {
return this.translate.instant(`Agenda items are in process. Please wait ...`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ <h2>{{ 'Meetings' | translate }}</h2>
></a>
}
<div>
@if (meeting.userAmount) {
@if (meeting.userAmount && showParticipantAmount(meeting)) {
<div>
<os-icon-container
icon="group"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { marker as _ } from '@colsen1991/ngx-translate-extract-marker';
import { TranslateService } from '@ngx-translate/core';
import { OML } from 'src/app/domain/definitions/organization-permission';
import { CML, OML } from 'src/app/domain/definitions/organization-permission';
import { Permission } from 'src/app/domain/definitions/permission';
import { BaseListViewComponent } from 'src/app/site/base/base-list-view.component';
import { MeetingControllerService } from 'src/app/site/pages/meetings/services/meeting-controller.service';
import { ViewMeeting } from 'src/app/site/pages/meetings/view-models/view-meeting';
Expand Down Expand Up @@ -83,4 +84,11 @@ export class MeetingListComponent extends BaseListViewComponent<ViewMeeting> {
}
return this.translate.instant(`Navigate to meeting `) + meeting.name;
}

public showParticipantAmount(meeting: ViewMeeting): boolean {
return (
this.operator.hasCommitteePermissions(meeting.committee_id, CML.can_manage) ||
this.operator.hasPermsInMeeting(meeting.id, Permission.userCanSee)
);
}
}