Skip to content

Commit

Permalink
Merge main into stable/4.0.x. Update 20231018
Browse files Browse the repository at this point in the history
* commit 'aa450618f8647a5c7595771cb101eb01f94b6e71': (46 commits)
  Fix route state undefined (#2905)
  Revert "Fix search selection option focus (#2842)" (#2902)
  Fix meeting admin update as committee admin (#2901)
  Fix move in call list functionality (#2861)
  Add ability to go back to lead motion after amendment create (#2859)
  Block motions/tags page, if missing permission (#2857)
  Add info message to list of speakers content, if present is needed (#2854)
  Fix monospace font wrong weight on include (#2848)
  Fix participant history error (#2888)
  Add tests for list-search.service (#2874)
  Fix remove and add submitters (#2858)
  Add clear selection option in search-selector (#2860)
  Pause autoupdate connection on inactivitiy (#2851)
  Fix linting (#2867)
  Improve shared worker restart after reload process (#2847)
  Fix search service issues (#2844)
  Fix bulk change Submitters (#2846)
  Add test for CsvExportForBackendService (#2863)
  Fix double click needed to remove filter (#2856)
  Add lines between class members eslint rule (#2849)
  ...
  • Loading branch information
peb-adr committed Oct 18, 2023
2 parents 2fd3e70 + aa45061 commit 062db2c
Show file tree
Hide file tree
Showing 195 changed files with 2,818 additions and 1,156 deletions.
3 changes: 2 additions & 1 deletion client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ module.exports = {
}
],
'@typescript-eslint/quotes': ['error', 'backtick', { 'avoidEscape': false }],
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }],
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_', 'varsIgnorePattern': '^_' }],
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'unused-imports/no-unused-imports': 'error',
'no-restricted-properties': ['error', {
'property': 'asObservable',
'message': 'Please use a typecast or explicitly instantiate a new Observable.'
}],
'lines-between-class-members': ['error', 'always', { 'exceptAfterSingleLine': true }],

'jsdoc/require-example': ['off'],
'jsdoc/newline-after-description': ['off'],
Expand Down
5 changes: 5 additions & 0 deletions client/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
"glob": "**/*",
"input": "node_modules/tinymce",
"output": "/tinymce/"
},
{
"glob": "**/*",
"input": "node_modules/cm-chessboard/assets/",
"output": "/chess/"
}
],
"styles": ["src/styles.scss"],
Expand Down
2 changes: 1 addition & 1 deletion client/cli/generate-settings-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const FILE_TEMPLATE = dedent`
const provider = new MeetingSettingsDefinitionService();

let content = FILE_TEMPLATE + '\n';
for (const [key, value] of Object.entries(provider.getSettingsMap())) {
for (const [key, value] of Object.entries(provider.settingsMap)) {
const defaultValue = meeting[key].default;
if (defaultValue !== undefined) {
provider.validateDefault(key, defaultValue);
Expand Down
56 changes: 56 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
"ascii-art-api": "^1.0.0",
"broadcast-channel": "^4.18.0",
"chart.js": "^3.9.1",
"cm-chess": "^3.3.3",
"cm-chessboard": "^8.1.5",
"core-js": "^3.25.5",
"date-fns": "^2.30.0",
"exceljs": "^4.3.0",
Expand Down
6 changes: 6 additions & 0 deletions client/src/app/domain/fieldsets/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ export class UserFieldsets {
]
};
}

export class MeetingUserFieldsets {
public static readonly FullNameSubscription: BaseSimplifiedModelRequest = {
fieldset: [`group_ids`, `meeting_id`, `user_id`, `structure_level`, `number`]
};
}
2 changes: 2 additions & 0 deletions client/src/app/domain/models/meetings/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export class Meeting extends BaseModel<Meeting> {
public chat_message_ids!: Id[]; // (chat_message/meeting_id)[];
public poll_candidate_list_ids!: Id[]; // (poll_candidate_list/meeting_id)[];
public poll_candidate_ids!: Id[]; // (poll_candidate/meeting_id)[];
public user_ids!: Id[];

// Other relations
public present_user_ids!: Id[]; // (user/is_present_in_meeting_ids)[];
Expand Down Expand Up @@ -371,6 +372,7 @@ export class Meeting extends BaseModel<Meeting> {
`poll_candidate_list_ids`,
`poll_candidate_ids`,
`meeting_user_ids`,
`user_ids`,
`users_enable_presence_view`,
`users_enable_vote_weight`,
`users_allow_self_set_present`,
Expand Down
1 change: 1 addition & 0 deletions client/src/app/domain/models/projector/projection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class Projection extends BaseModel<Projection> {
public options!: {
[key: string]: any;
};

public weight!: number;

// Calculated field
Expand Down
1 change: 1 addition & 0 deletions client/src/app/domain/models/users/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type UserSortProperty = 'first_name' | 'last_name' | 'number';
* Iterable pre selection of genders
*/
export const GENDERS = [_(`female`), _(`male`), _(`diverse`), _(`non-binary`)];
export const GENDER_FITLERABLE = [`female`, `male`, `diverse`, `non-binary`];

/**
* Representation of a user in contrast to the operator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ class MockWaitForActionDialogService {
delete currentDialogs[workerId];
this.currentDialogs.next(currentDialogs);
}

public async openClosingPrompt(snapshot: Partial<ActionWorker> & { closed: number }): Promise<void> {
this.closingPromptOpenFor.push(snapshot);
}

public addNewDialog(reason: WaitForActionReason, data: WaitForActionData): void {
const currentDialogs = copy(this.currentDialogs.value);
currentDialogs[data.workerId] = { reason, data };
Expand Down Expand Up @@ -154,6 +156,7 @@ class MockActionWorkerRepositoryService {
public set viewModelList(list: ViewActionWorker[]) {
this._viewModelListSubject.next(list);
}

public get viewModelList(): ViewActionWorker[] {
return this._viewModelListSubject.value;
}
Expand Down
4 changes: 4 additions & 0 deletions client/src/app/gateways/actions/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ export class Action<T = void> {
private _actions: ActionRequest[];
private _sendActionFn: (requests: ActionRequest[]) => Promise<T[]>;

public setSendActionFn(sendActionFn: (requests: ActionRequest[]) => Promise<T[]>): void {
this._sendActionFn = sendActionFn;
}

public constructor(sendActionFn: (requests: ActionRequest[]) => Promise<T[]>, actions: ActionRequest[] = []) {
this._actions = actions.filter(action => !!action?.data?.length);
this._sendActionFn = sendActionFn;
Expand Down
16 changes: 0 additions & 16 deletions client/src/app/gateways/autoupdate-adapter.service.spec.ts

This file was deleted.

8 changes: 0 additions & 8 deletions client/src/app/gateways/autoupdate-adapter.service.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,128 @@
import { TestBed } from '@angular/core/testing';
import { BaseViewModel } from 'src/app/site/base/base-view-model';

import { FileExportService } from '../file-export.service';
import { CsvExportForBackendService } from './csv-export-for-backend.service';

xdescribe(`CsvExportForBackendService`, () => {
class MockFileExportService {
public lastSavedFiles: any[] = [];
public saveFile(file: BlobPart, filename: string, mimeType?: string): void {
this.lastSavedFiles.push({ file, filename, mimeType });
}
}

class MockModel extends BaseViewModel {
public get proper(): boolean {
return this._model.proper;
}

public get tea(): string {
return this._model.tea;
}

public get strength(): number {
return this._model.strength;
}

public constructor(input?: any) {
super(input);
}

public strengthSquared(): number {
return this.strength ? this.strength * this.strength : 0;
}
}

describe(`CsvExportForBackendService`, () => {
let service: CsvExportForBackendService;
let exportService: MockFileExportService;
const toDummyExport = [
{ proper: true, tea: `Earl Grey`, strength: 5 },
{ proper: false, tea: `Herbal tea` }
];
const toExport = toDummyExport.map(item => new MockModel(item));

beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
providers: [CsvExportForBackendService, { provide: FileExportService, useClass: MockFileExportService }]
});

service = TestBed.inject(CsvExportForBackendService);
exportService = TestBed.inject(FileExportService) as unknown as MockFileExportService;
});

it(`test export method with default settings`, () => {
service.export(
toExport,
[
{ property: `tea` },
{ label: `fancy`, map: model => (model.proper ? `yes` : `no`) },
{ property: `strength` }
],
`assortmentOfTeas`
);
expect(exportService.lastSavedFiles.length).toBe(1);
expect(exportService.lastSavedFiles[0]).toEqual({
file: `tea,fancy,strength\r\n"Earl Grey","yes","5"\r\n"Herbal tea","no",`,
filename: `assortmentOfTeas`,
mimeType: `text/csv;charset=utf-8`
});
});

it(`test export method with non-default encoding`, () => {
service.export(toExport, [{ property: `proper` }, { property: `tea` }], `assortmentOfTeas2ElectricBoogaloo`, {
encoding: `iso-8859-15`
});
expect(exportService.lastSavedFiles.length).toBe(1);
expect(exportService.lastSavedFiles[0]).toEqual({
file: new Uint8Array([
112, 114, 111, 112, 101, 114, 44, 116, 101, 97, 13, 10, 34, 49, 34, 44, 34, 69, 97, 114, 108, 32, 71,
114, 101, 121, 34, 13, 10, 44, 34, 72, 101, 114, 98, 97, 108, 32, 116, 101, 97, 34
]),
filename: `assortmentOfTeas2ElectricBoogaloo`,
mimeType: `text/csv;charset=iso-8859-15`
});
});

it(`test export method with non-default settings`, () => {
service.export(
toExport,
[{ property: `proper` }, { property: `tea` }, { property: `strengthSquared` }],
`assortmentOfTeas2ElectricBoogaloo`,
{
lineSeparator: `:`,
columnSeparator: `?`
}
);
expect(exportService.lastSavedFiles.length).toBe(1);
expect(exportService.lastSavedFiles[0]).toEqual({
file: `proper?tea?strengthSquared:"1"?"Earl Grey"?"25":?"Herbal tea"?"0"`,
filename: `assortmentOfTeas2ElectricBoogaloo`,
mimeType: `text/csv;charset=utf-8`
});
});

it(`test export method error`, () => {
expect(() =>
service.export(toExport, [{ property: `tea` }], `assortmentOfTeas`, {
lineSeparator: `?`,
columnSeparator: `?`
})
).toThrowError(`lineseparator and columnseparator must differ from each other`);
expect(exportService.lastSavedFiles.length).toBe(0);
});

it(`should be created`, () => {
expect(service).toBeTruthy();
it(`test dummy export method with default settings`, () => {
service.dummyCSVExport(
{ proper: `Fancy`, tea: `Tea`, strength: `Muscle` },
toDummyExport,
`dummyAssortmentOfTeas`
);
expect(exportService.lastSavedFiles.length).toBe(1);
expect(exportService.lastSavedFiles[0]).toEqual({
file: `proper,tea,strength\r\n"1","Earl Grey","5"\r\n,"Herbal tea",`,
filename: `dummyAssortmentOfTeas`,
mimeType: `text/csv`
});
});
});
Loading

0 comments on commit 062db2c

Please sign in to comment.