Change "change your own delegation" option to account button - #6141
Change "change your own delegation" option to account button#6141Borreg0 wants to merge 18 commits into
Conversation
bspekker
left a comment
There was a problem hiding this comment.
- Changing the own delegation doesn't work anymore for users with only "can change own delegation" permission:
- The dialogue I can open from the user menu looks good, but the dialogue you can open in the participant list as admins by clicking on the column with groups, numbers, structure levels etc, should still be the old previous dialogue:
The column I mean:
The dialogue that should still be available as is for everyone with more admin permissions than just "can change own delegation":
| this.router.navigate([userId, `edit`], { relativeTo: this.route }); | ||
| } | ||
| } | ||
| export { areGroupsDiminished }; |
There was a problem hiding this comment.
remove bc it's unused
and such export should also be below the imports but above the main component/director/service
Elblinator
left a comment
There was a problem hiding this comment.
Additionally the wrong Id is used to select the delegations
Reproduction:
- in the default (dev) setup
- create a second meeting
- in the new meeting add 'a' as participant
- in the settings activate the delegations
- try to delegate from admin to a (or vidse versa)
- Error is thrown:
Error: User(s) [2] delegation ids don't belong to meeting 2.
| } @else if (hasActiveMeeting) { | ||
| @if (isPresent) { | ||
| @if (hasActiveMeeting) { | ||
| @if (isAllowedSelfSetPresent && hasActiveMeeting) { |
There was a problem hiding this comment.
| @if (isAllowedSelfSetPresent && hasActiveMeeting) { | |
| @if (isAllowedSelfSetPresent) { |
| </div> | ||
| } | ||
| } | ||
| @if (isVoteDelegationEnabled && canEditOwnDelegation()) { |
There was a problem hiding this comment.
Also needs to be in "hasActiveMeeting"
| @Inject(MAT_DIALOG_DATA) public readonly infoDialog: InfoDialog, | ||
| private participantRepo: ParticipantControllerService, | ||
| protected participantRepo: ParticipantControllerService, | ||
| private userSortService: ParticipantListSortService, | ||
| private groupRepo: GroupControllerService, | ||
| private structureLevelRepo: StructureLevelControllerService, | ||
| protected structureLevelRepo: StructureLevelRepositoryService, | ||
| private activeMeetingIdService: ActiveMeetingIdService, | ||
| private meetingSettings: MeetingSettingsService, | ||
| private operator: OperatorService |
There was a problem hiding this comment.
And sort public above, then protected, then private
| isHidden: !canSeeItemMenu() && viewport.isMobileSubject | ||
| " | ||
| class="cell-slot" | ||
| [hidden]="!hasOptions()" |
There was a problem hiding this comment.
canSeeItemMenu should be adjusted not [hidden] added
| export function afterDialogClosed( | ||
| dialogRef: MatDialogRef<ParticipantListInfoDialogComponent, InfoDialog>, | ||
| user: ViewUser, | ||
| operator: OperatorInfo, |
There was a problem hiding this comment.
rename. Operator is always the operator, do not use "operator"
| return this.user.short_name + ': ' + stringForUserPresent; | ||
| } | ||
|
|
||
| public canEditOwnDelegation(): boolean { |
There was a problem hiding this comment.
Can edit OWN delegation:
this.operator.hasPerms(Permission.userCanEditOwnDelegation) &&
this.activeMeeting.meeting.user_ids.includes(this.operator.operatorId)
is enough
| changeOwnDel: this.operator.hasPerms(Permission.userCanEditOwnDelegation), | ||
| canUpdate: this.operator.hasPerms(Permission.userCanUpdate) | ||
| }; | ||
| afterDialogClosed(dialogRef, user, operatorInfo, this.activeMeeting.meeting, this.participantRepo, this.prompt); |
There was a problem hiding this comment.
add afterDialogClosed as a function in this.infoDialog
subsequent changes for all afterDialogClosed bc they will be called diifferently
| } | ||
| } | ||
|
|
||
| export function areGroupsDiminished(oldGroupIds: number[], newGroupIds: number[], activeMeeting: ViewMeeting): boolean { |
There was a problem hiding this comment.
also move into ParticipantListInfoDialogService and subsequent change the call of this function everywhere
| if (!result.group_ids?.length) { | ||
| result.group_ids = [this.activeMeeting!.default_group_id]; | ||
| } | ||
| if (result.vote_delegated_to_id === 0) { |
There was a problem hiding this comment.
| if (result.vote_delegated_to_id === 0) { | |
| if (result.vote_delegated_to_id?.length === 0) { |
do You mean this?
The id should never even try to be set to zero
| ); | ||
| } | ||
|
|
||
| export function afterDialogClosed( |
There was a problem hiding this comment.
Either move this function into the operator and let also the participant-list use it (more work and I would not recommmendt this actually)
Or do not export this function implement the function per component.
If possible remove the OperatorInfo (including the interface)
I can reproduce it. Furthermore, I found that if a new participant is created and the user tries to delegate the vote to him, a new error appears. I have been working on this but I cannot find the cause yet. How to reproduce:
|
closes #5967