Skip to content

Commit a203316

Browse files
authored
Add reference for deleted user (#5494)
1 parent 626c460 commit a203316

File tree

20 files changed

+133
-46
lines changed

20 files changed

+133
-46
lines changed

client/src/app/gateways/repositories/motions/motion-repository.service/motion-repository.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
291291
const agendaTitle: AgendaListTitle = { title };
292292

293293
if (viewMotion.submitterNames && viewMotion.submitterNames.length) {
294-
agendaTitle.subtitle = `${this.translate.instant(`by`)} ${viewMotion.submitterNames.join(`, `)}`;
294+
agendaTitle.subtitle = `${this.translate.instant(`by`)} ${viewMotion.submitterNames.map(sub => (sub === undefined ? this.translate.instant(`Deleted user`) : sub)).join(`, `)}`;
295295
}
296296
return agendaTitle;
297297
};

client/src/app/gateways/repositories/motions/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export abstract class BaseMotionMeetingUserRepositoryService<
2626
super(repositoryServiceCollector, constructor);
2727
}
2828

29-
public getTitle = (model: V): string => model?.user?.getTitle() || this.translate.instant(`Unknown participant`);
29+
public getTitle = (model: V): string => model?.user?.getTitle() || this.translate.instant(`Deleted user`);
3030

3131
public create(motion: Identifiable, ...meetingUsers: Identifiable[]): Action<Identifiable[]> {
3232
const payload = meetingUsers.map(user => ({

client/src/app/site/base/base-filter.service/base-filter-list.service.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,20 +292,30 @@ export abstract class BaseFilterListService<V extends BaseViewModel> implements
292292
if (viewModels && viewModels.length) {
293293
let models: FilterModel[] = viewModels.filter(filterFn ?? ((): boolean => true));
294294
if (mapFn) {
295-
models = Object.values(models.map(mapFn).mapToObject(model => ({ [model.id]: model })));
295+
models = Object.values(
296+
models.map(mapFn).mapToObject(model => {
297+
if (!model) {
298+
// This is [undefined]: undefined
299+
// That is only relevant for models which were deleted but should still be displayed
300+
// That is (so far) only the case for a meeting user who was assigned as editor/speaker and is now deleted)
301+
return { [model?.id]: undefined };
302+
}
303+
return { [model.id]: model };
304+
})
305+
);
296306
}
297307
filterProperties = models
298308
.map((model: FilterModel) => ({
299-
condition: model.id,
300-
label: model.getTitle(),
301-
isChild: !!model.parent,
309+
condition: model?.id,
310+
label: model?.getTitle() ?? `Deleted user`,
311+
isChild: !!model?.parent,
302312
isActive: (
303313
filter.options.find(
304-
f => (f as OsFilterOption)?.condition === model.id
314+
f => (f as OsFilterOption)?.condition === model?.id
305315
) as OsFilterOption
306316
)?.isActive,
307-
skipTranslate: true,
308-
children: model.children?.length
317+
skipTranslate: model?.getTitle() ? true : false,
318+
children: model?.children?.length
309319
? model.children.map((child: any) => ({
310320
label: child.getTitle(),
311321
condition: child.id

client/src/app/site/pages/meetings/modules/participant-search-selector/components/participant-search-selector/participant-search-selector.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ export class ParticipantSearchSelectorComponent extends BaseUiComponent implemen
163163

164164
public async createNewSelectedUser(name: string): Promise<void> {
165165
const newUserObj = await this.userRepo.createFromString(name);
166-
this.emitSelectedUser({ userId: newUserObj.id, user: newUserObj });
167166
const user = await firstValueFrom(
168167
this.userRepo.getViewModelObservable(newUserObj.id).pipe(filter(user => !!user))
169168
);
169+
this.emitSelectedUser({ userId: newUserObj.id, user });
170170
this.snackBar.open(
171171
this.translate
172172
.instant(`A user with the username '%username%' and the first name '%first_name%' was created.`)

client/src/app/site/pages/meetings/pages/motions/components/motion-forward-dialog/components/motion-forward-dialog/motion-forward-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
<span class="data-preview">
122122
<os-comma-separated-listing [list]="data.motion[0].submitterNames">
123123
<ng-template let-submitter>
124-
{{ submitter }}
124+
{{ getSubmitterOrDeletedUser(submitter) }}
125125
</ng-template>
126126
</os-comma-separated-listing>
127127
</span>

client/src/app/site/pages/meetings/pages/motions/components/motion-forward-dialog/components/motion-forward-dialog/motion-forward-dialog.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component, Inject, OnInit } from '@angular/core';
22
import { MatCheckboxChange } from '@angular/material/checkbox';
33
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
4+
import { TranslateService } from '@ngx-translate/core';
45
import { BehaviorSubject, Observable } from 'rxjs';
56
import { Id, Ids } from 'src/app/domain/definitions/key-types';
67
import { GetForwardingMeetingsPresenter, GetForwardingMeetingsPresenterMeeting } from 'src/app/gateways/presenter';
@@ -59,7 +60,8 @@ export class MotionForwardDialogComponent implements OnInit {
5960
@Inject(MAT_DIALOG_DATA)
6061
public data: { motion: ViewMotion[]; forwardingMeetings: GetForwardingMeetingsPresenter[] },
6162
private dialogRef: MatDialogRef<MotionForwardDialogComponent, MotionForwardDialogReturnData>,
62-
private activeMeeting: ActiveMeetingService
63+
private activeMeeting: ActiveMeetingService,
64+
private translate: TranslateService
6365
) {}
6466

6567
public async ngOnInit(): Promise<void> {
@@ -134,4 +136,8 @@ export class MotionForwardDialogComponent implements OnInit {
134136
const hasAmend: (element: ViewMotion) => boolean = element => element.amendments.length > 0;
135137
return this.data.motion.some(hasAmend);
136138
}
139+
140+
public getSubmitterOrDeletedUser(submitter: string): string {
141+
return submitter ?? this.translate.instant(`Deleted user`);
142+
}
137143
}

client/src/app/site/pages/meetings/pages/motions/pages/amendments/components/amendment-list/amendment-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ <h2>
7474
@if (motion.submitterNames.length) {
7575
<span>
7676
<span>{{ 'by' | translate }}</span>
77-
{{ motion.submitterNames }}
77+
{{ getSubmitterListWithDeletedUsers(motion.submitterNames) }}
7878
</span>
7979
}
8080
@if (showSequentialNumber) {

client/src/app/site/pages/meetings/pages/motions/pages/amendments/components/amendment-list/amendment-list.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,8 @@ export class AmendmentListComponent extends BaseMeetingListViewComponent<ViewMot
159159
public getChangedLinesFromAmendment(amendment: ViewMotion): string | null {
160160
return amendment.getChangedLines();
161161
}
162+
163+
public getSubmitterListWithDeletedUsers(submitters: string[]): string[] {
164+
return submitters.map(sub => sub ?? this.translate.instant(`Deleted user`));
165+
}
162166
}

client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/motion-detail-diff/motion-detail-diff.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@
123123
</mat-icon>
124124
}
125125
<i class="grey">&nbsp;- {{ change.amendment.state!.name }}</i>
126-
<i class="grey">&nbsp;- {{ change.amendment.submitterNames }}</i>
126+
<i class="grey">
127+
&nbsp;- {{ getSubmitterListWithDeletedUsers(change.amendment.submitterNames) }}
128+
</i>
127129
</div>
128130
}
129131
</div>

client/src/app/site/pages/meetings/pages/motions/pages/motion-detail/pages/motion-view/components/motion-detail-diff/motion-detail-diff.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,4 +586,8 @@ export class MotionDetailDiffComponent extends BaseMeetingComponent implements A
586586
behavior: `smooth`
587587
});
588588
}
589+
590+
public getSubmitterListWithDeletedUsers(submitters: string[]): string[] {
591+
return submitters.map(sub => sub ?? this.translate.instant(`Deleted user`));
592+
}
589593
}

0 commit comments

Comments
 (0)