Skip to content

Commit

Permalink
Merge branch 'main' into 3719-reorder-user-import-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
reiterl committed Jul 10, 2024
2 parents e9f39fd + e5e295f commit c0064a3
Show file tree
Hide file tree
Showing 85 changed files with 731 additions and 357 deletions.
2 changes: 1 addition & 1 deletion client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = {
'@typescript-eslint/adjacent-overload-signatures': ['error'],
'@typescript-eslint/ban-types': ['error'],
'@typescript-eslint/explicit-member-accessibility': ['error'],
'@typescript-eslint/explicit-function-return-type': ['warn'],
'@typescript-eslint/explicit-function-return-type': ['error'],

'jsdoc/require-example': ['off'],
'jsdoc/newline-after-description': ['off'],
Expand Down
2 changes: 1 addition & 1 deletion client/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{
"type": "initial",
"maximumWarning": "1500kb",
"maximumError": "3mb"
"maximumError": "3500kb"
},
{
"type": "anyComponentStyle",
Expand Down
2 changes: 2 additions & 0 deletions client/src/app/domain/models/poll/poll-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export interface EntitledUsersEntry {
present: boolean;
voted: boolean;
vote_delegated_to_user_id?: number;
user_merged_into_id?: number;
delegation_user_merged_into_id?: number;
}

export const VOTE_MAJORITY = -1;
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/gateways/error-mapping/error-map-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const VoteServiceErrorMap: ErrorMap = new ErrorMap([
[/is not allowed to vote/, _(`You do not have the permission to vote.`)]
]);

const MatchAllErrorMap: ErrorMap = new ErrorMap([[/(.*)/, input => new MapError(input)]]);
const MatchAllErrorMap: ErrorMap = new ErrorMap([[/(.*)/, (input): MapError => new MapError(input)]]);
const MeetingCreateErrorMap: ErrorMap = new ErrorMap([
[
/Only one of start_time and end_time is not allowed./,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ class PdfCreator {
this._document = config.document;
this._filename = config.filename;
this._loadFonts = config.loadFonts;
this._loadImages = config.loadImages || (() => ({}));
this._createVfs = config.createVfs || (() => ({}));
this._loadImages = config.loadImages || ((): any => ({}));
this._createVfs = config.createVfs || ((): any => ({}));
this._progressService = config.progressService;
this._progressSnackBarService = config.progressSnackBarService;
this._settings = config.settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function addPageNumbers(data: any): void {
// to allow page numbers in every page, after the initial "%PAGENR%" placeholder was reset
let countPageNumbers = false;

data.doc.footer = (currentPage: any, pageCount: any) => {
data.doc.footer = (currentPage: any, pageCount: any): any => {
const footer = data.doc.tmpfooter;

// if the tmpfooter starts with an image, the pagenumber will be found in column 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ export class HistoryPresenterService {
.flatMap(positions => getUniqueItems(positions))
.sort((positionA, positionB) => positionB.timestamp - positionA.timestamp)
.map(position => {
const userView = this.userRepo.getViewModel(position.user_id);
return new HistoryPosition({
...position,
information: Array.isArray(position.information)
? position.information
: position?.information[fqid],
fqid,
user: this.userRepo.getViewModel(position.user_id)?.getFullName()
user: userView?.getFullName() ? userView.getFullName() : `user/${position.user_id}`
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/gateways/repositories/base-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ export abstract class BaseRepository<V extends BaseViewModel, M extends BaseMode
private createViewModelProxy(model?: M): V {
let viewModel = new this.baseViewModelCtor(model);
viewModel = new Proxy(viewModel, {
get: (target: V, property) => {
get: (target: V, property): any => {
// target is our viewModel and property the requested value: viewModel[property]
let result: any; // This is what we have to resolve: viewModel[property] -> result
const _model: M = target.getModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export class ChatGroupRepositoryService extends BaseMeetingRelatedRepository<Vie
super(repositoryServiceCollector, ChatGroup);
}

public getVerboseName = (plural?: boolean) => (plural ? `Chat groups` : `Chat group`);
public getTitle = (viewModel: ViewChatGroup) => viewModel.name;
public getVerboseName = (plural?: boolean): string => (plural ? `Chat groups` : `Chat group`);
public getTitle = (viewModel: ViewChatGroup): string => viewModel.name;

public create(...data: Partial<ChatGroup>[]): Promise<Identifiable[]> {
const payload: any[] = data.map(partialChatGroup => partialChatGroup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export class ChatMessageRepositoryService extends BaseMeetingRelatedRepository<V
super(repositoryServiceCollector, ChatMessage);
}

public getVerboseName = (plural?: boolean) => (plural ? `Chat messages` : `Chat message`);
public getTitle = () => `No name`;
public getVerboseName = (plural?: boolean): string => (plural ? `Chat messages` : `Chat message`);
public getTitle = (): string => `No name`;

public create(...data: any[]): Promise<Identifiable[]> {
const payload = data.map(partialChatMessage => partialChatMessage);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Injectable } from '@angular/core';
import { ViewUser } from 'src/app/site/pages/meetings/view-models/view-user';
import { ORGANIZATION_ID } from 'src/app/site/pages/organization/services/organization.service';
import { BackendImportRawPreview } from 'src/app/ui/modules/import-list/definitions/backend-import-preview';

Expand Down Expand Up @@ -27,9 +28,9 @@ export class CommitteeRepositoryService extends BaseRepository<ViewCommittee, Co
super(repositoryServiceCollector, Committee);
}

public getTitle = (viewCommittee: ViewCommittee) => viewCommittee.name;
public getTitle = (viewCommittee: ViewCommittee): string => viewCommittee.name;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Committees` : `Committee`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Committees` : `Committee`);

public override getFieldsets(): Fieldsets<Committee> {
const nameFields: TypedFieldset<Committee> = [`name`];
Expand Down Expand Up @@ -61,7 +62,7 @@ export class CommitteeRepositoryService extends BaseRepository<ViewCommittee, Co
}

public update(update?: any, ...committees: ViewCommittee[]): Action<void> {
const createPayload = (id: Id, model: Partial<Committee>) => ({
const createPayload = (id: Id, model: Partial<Committee>): any => ({
id,
name: model.name,
default_meeting_id: model.default_meeting_id,
Expand Down Expand Up @@ -107,8 +108,8 @@ export class CommitteeRepositoryService extends BaseRepository<ViewCommittee, Co

protected override createViewModel(model: Committee): ViewCommittee {
const viewModel = super.createViewModel(model);
viewModel.getViewUser = (id: Id) => this.userRepo.getViewModel(id);
viewModel.canAccess = () =>
viewModel.getViewUser = (id: Id): ViewUser => this.userRepo.getViewModel(id);
viewModel.canAccess = (): boolean =>
this.operator.hasCommitteePermissions(model.id, CML.can_manage) ||
this.operator.hasOrganizationPermissions(OML.can_manage_users) ||
this.operator.isInCommitteesNonAdminCheck(model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export class GroupRepositoryService extends BaseMeetingRelatedRepository<ViewGro
};
}

public getTitle = (viewGroup: ViewGroup) => viewGroup.name;
public getTitle = (viewGroup: ViewGroup): string => viewGroup.name;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Groups` : `Group`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Groups` : `Group`);

public getNameForIds(...ids: number[]): string {
return this.getSortedViewModelList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export class ListOfSpeakersRepositoryService extends BaseMeetingRelatedRepositor
super(repositoryServiceCollector, ListOfSpeakers);
}

public getVerboseName = (plural = false) =>
public getVerboseName = (plural = false): string =>
this.translate.instant(plural ? `Lists of speakers` : `List of speakers`);

public override getTitle = (viewListOfSpeakers: ViewListOfSpeakers) => {
public override getTitle = (viewListOfSpeakers: ViewListOfSpeakers): string => {
if (viewListOfSpeakers?.content_object) {
return viewListOfSpeakers.content_object.getListOfSpeakersTitle();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ export class MediafileRepositoryService extends BaseRepository<ViewMediafile, Me
) {
super(repositoryServiceCollector, Mediafile);

this.viewModelSortFn = (a: ViewMediafile, b: ViewMediafile) => this.languageCollator.compare(a.title, b.title);
this.viewModelSortFn = (a: ViewMediafile, b: ViewMediafile): number =>
this.languageCollator.compare(a.title, b.title);
}

public getTitle = (viewMediafile: ViewMediafile) => viewMediafile.title;
public getTitle = (viewMediafile: ViewMediafile): string => viewMediafile.title;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Files` : `File`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Files` : `File`);

public override getFieldsets(): Fieldsets<Mediafile> {
const fileSelectionFields: TypedFieldset<Mediafile> = [`title`, `is_directory`];
Expand Down Expand Up @@ -117,8 +118,8 @@ export class MediafileRepositoryService extends BaseRepository<ViewMediafile, Me
*/
protected override createViewModel(model: Mediafile): ViewMediafile {
const viewModel = super.createViewModel(model);
viewModel.getEnsuredActiveMeetingId = () => this.activeMeetingIdService.meetingId;
viewModel.getProjectedContentObjects = () =>
viewModel.getEnsuredActiveMeetingId = (): number => this.activeMeetingIdService.meetingId;
viewModel.getProjectedContentObjects = (): string[] =>
this.projectionRepo.getViewModelList().map(p => p.content_object_id);
return viewModel;
}
Expand Down
19 changes: 14 additions & 5 deletions client/src/app/gateways/repositories/meeting-repository.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,16 @@ export class MeetingRepositoryService extends BaseRepository<ViewMeeting, Meetin
};
}

public getTitle = (viewMeeting: ViewMeeting) => viewMeeting.name;
public getTitle = (viewMeeting: ViewMeeting): string => viewMeeting.name;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Meetings` : `Meeting`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Meetings` : `Meeting`);

public getProjectorTitle = (_: ViewMeeting, projection: Projection) => {
public getProjectorTitle = (
_: ViewMeeting,
projection: Projection
): {
title: string;
} => {
let title: string;

switch (projection.type as MeetingProjectionType) {
Expand Down Expand Up @@ -245,7 +250,11 @@ export class MeetingRepositoryService extends BaseRepository<ViewMeeting, Meetin

protected override createViewModel(model: Meeting): ViewMeeting {
const viewModel = super.createViewModel(model);
viewModel.getProjectorTitle = (projection: Projection) => this.getProjectorTitle(viewModel, projection);
viewModel.getProjectorTitle = (
projection: Projection
): {
title: string;
} => this.getProjectorTitle(viewModel, projection);
return viewModel;
}

Expand Down Expand Up @@ -312,7 +321,7 @@ export class MeetingRepositoryService extends BaseRepository<ViewMeeting, Meetin
meetingId: Id,
groupId: Id
): void {
const getNextGroupIds = (groupIds: Id[]) => {
const getNextGroupIds = (groupIds: Id[]): number[] => {
const index = groupIds.findIndex(id => groupId === id);
if (index > -1) {
groupIds.splice(index, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class MeetingUserRepositoryService extends BaseMeetingRelatedRepository<V
return {};
}

public getTitle = (viewUser: ViewMeetingUser) => viewUser.user?.getTitle() ?? `Unknown`;
public getTitle = (viewUser: ViewMeetingUser): string => viewUser.user?.getTitle() ?? `Unknown`;

public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Participants` : `Participant`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ export class MotionBlockRepositoryService extends BaseAgendaItemAndListOfSpeaker
return this.sendBulkActionToBackend(MotionBlockAction.DELETE, payload);
}

public getTitle = (viewMotionBlock: ViewMotionBlock) => viewMotionBlock.title;
public getTitle = (viewMotionBlock: ViewMotionBlock): string => viewMotionBlock.title;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Motion blocks` : `Motion block`);
public getVerboseName = (plural = false): string =>
this.translate.instant(plural ? `Motion blocks` : `Motion block`);

/**
* Sets the default sorting (e.g. in dropdowns and for new users) to 'title'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ export class MotionCategoryRepositoryService extends BaseMeetingRelatedRepositor
};
}

public getTitle = (viewMotionCategory: ViewMotionCategory) =>
public getTitle = (viewMotionCategory: ViewMotionCategory): string =>
viewMotionCategory.prefix
? viewMotionCategory.prefix + ` - ` + viewMotionCategory.name
: viewMotionCategory.name;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Categories` : `Category`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Categories` : `Category`);

/**
* Updates a categories numbering.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export class MotionChangeRecommendationRepositoryService extends BaseMeetingRela
super(repositoryServiceCollector, MotionChangeRecommendation);
}

public getTitle = () => this.getVerboseName();
public getTitle = (): string => this.getVerboseName();

public getVerboseName = (plural = false) =>
public getVerboseName = (plural = false): string =>
this.translate.instant(plural ? `Change recommendations` : `Change recommendation`);

public create(model: Partial<MotionChangeRecommendation>, firstLine = 1): Promise<Identifiable> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export class MotionCommentRepositoryService extends BaseMeetingRelatedRepository
super(repositoryServiceCollector, MotionComment);
}

public getTitle = () => `Comment`;
public getTitle = (): string => `Comment`;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Comments` : `Comment`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Comments` : `Comment`);

public async create(partialModel: Partial<MotionComment>): Promise<Identifiable> {
const payload = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class MotionCommentSectionRepositoryService extends BaseMeetingRelatedRep
public constructor(repositoryServiceCollector: RepositoryMeetingServiceCollectorService) {
super(repositoryServiceCollector, MotionCommentSection);

this.viewModelSortFn = (a: ViewMotionCommentSection, b: ViewMotionCommentSection) => {
this.viewModelSortFn = (a: ViewMotionCommentSection, b: ViewMotionCommentSection): number => {
if (a.weight === b.weight) {
return a.id - b.id;
} else {
Expand All @@ -26,9 +26,10 @@ export class MotionCommentSectionRepositoryService extends BaseMeetingRelatedRep
};
}

public getTitle = (viewMotionCommentSection: ViewMotionCommentSection) => viewMotionCommentSection.name;
public getTitle = (viewMotionCommentSection: ViewMotionCommentSection): string => viewMotionCommentSection.name;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Comment sections` : `Comment section`);
public getVerboseName = (plural = false): string =>
this.translate.instant(plural ? `Comment sections` : `Comment section`);

public async create(partialModel: Partial<MotionCommentSection>): Promise<Identifiable> {
const payload = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export class MotionEditorRepositoryService extends BaseMotionMeetingUserReposito
super(repositoryServiceCollector, MotionEditor, MotionEditorAction);
}

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Motion editors` : `Motion editor`);
public getVerboseName = (plural = false): string =>
this.translate.instant(plural ? `Motion editors` : `Motion editor`);
}
Original file line number Diff line number Diff line change
Expand Up @@ -233,23 +233,23 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
return this.createAction(AmendmentAction.CREATE_PARAGRAPHBASED_AMENDMENT, payload);
}

public getTitle = (viewMotion: ViewMotion) => {
public getTitle = (viewMotion: ViewMotion): string => {
if (viewMotion.number) {
return `${viewMotion.number}: ${viewMotion.title}`;
} else {
return viewMotion.title;
}
};

public getNumberOrTitle = (viewMotion: ViewMotion) => {
public getNumberOrTitle = (viewMotion: ViewMotion): string => {
if (viewMotion.number) {
return viewMotion.number;
} else {
return viewMotion.title;
}
};

public override getAgendaSlideTitle = (viewMotion: ViewMotion) => {
public override getAgendaSlideTitle = (viewMotion: ViewMotion): string => {
const numberPrefix = this.agendaItemRepo.getItemNumberPrefix(viewMotion);
// if the number is set, the title will be 'Motion <number>'.
if (viewMotion.number) {
Expand All @@ -259,7 +259,7 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
}
};

public override getAgendaListTitle = (viewMotion: ViewMotion) => {
public override getAgendaListTitle = (viewMotion: ViewMotion): AgendaListTitle => {
const numberPrefix = this.agendaItemRepo.getItemNumberPrefix(viewMotion);
// Append the verbose name only, if not the special format 'Motion <number>' is used.
let title: string;
Expand All @@ -276,9 +276,14 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
return agendaTitle;
};

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Motions` : `Motion`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Motions` : `Motion`);

public getProjectorTitle = (viewMotion: ViewMotion) => {
public getProjectorTitle = (
viewMotion: ViewMotion
): {
title: string;
subtitle: string;
} => {
const subtitle =
viewMotion.agenda_item && viewMotion.agenda_item.comment ? viewMotion.agenda_item.comment : undefined;
return { title: this.getTitle(viewMotion), subtitle };
Expand All @@ -287,8 +292,11 @@ export class MotionRepositoryService extends BaseAgendaItemAndListOfSpeakersCont
protected override createViewModel(model: Motion): ViewMotion {
const viewModel = super.createViewModel(model);

viewModel.getNumberOrTitle = () => this.getNumberOrTitle(viewModel);
viewModel.getProjectorTitle = () => this.getProjectorTitle(viewModel);
viewModel.getNumberOrTitle = (): string => this.getNumberOrTitle(viewModel);
viewModel.getProjectorTitle = (): {
title: string;
subtitle: string;
} => this.getProjectorTitle(viewModel);

return viewModel;
}
Expand Down
Loading

0 comments on commit c0064a3

Please sign in to comment.