diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 38e0c0d8c..b5576d7f8 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -54,7 +54,6 @@ export class AppComponent { * TODO: Overloading can be extended to more functions. */ private overloadArrayToString(): void { - Array.prototype.toString = function(): string { let string = ''; const iterations = Math.min(this.length, 3); diff --git a/client/src/app/core/marked-translations.ts b/client/src/app/core/marked-translations.ts index 3b0d9fc7d..2e9e15bdd 100644 --- a/client/src/app/core/marked-translations.ts +++ b/client/src/app/core/marked-translations.ts @@ -1,7 +1,7 @@ // import { _ } from '@biesbjerg/ngx-translate-extract'; function _(key: string | string[]): string | string[] { - return key; + return key; } /** @@ -19,10 +19,12 @@ function _(key: string | string[]): string | string[] { // Core config strings _('Presentation and assembly system'); _('Event name'); -_('OpenSlides is a free ' + +_( + 'OpenSlides is a free ' + 'web based presentation and assembly system for visualizing ' + 'and controlling agenda, motions and elections of an ' + - 'assembly.'); + 'assembly.' +); _('General'); _('Event'); _('Short description of event'); @@ -94,7 +96,6 @@ _('Public item'); _('Internal item'); _('Hidden item'); - // Motions config strings // subgroup general _('General'); @@ -115,13 +116,17 @@ _('Hide recommendation on projector'); _('Stop submitting new motions by non-staff users'); _('Allow to disable versioning'); _('Name of recommender'); -_('Will be displayed as label before selected recommendation. Use an empty value to disable the recommendation system.'); +_( + 'Will be displayed as label before selected recommendation. Use an empty value to disable the recommendation system.' +); _('Name of recommender for statute amendments'); -_('Will be displayed as label before selected recommendation for statute amendments. Use an empty value to disable the recommendation system.'); +_( + 'Will be displayed as label before selected recommendation for statute amendments. Use an empty value to disable the recommendation system.' +); _('Default text version for change recommendations'); // subgroup Amendments _('Amendments'); -_('Activate statute amendments') +_('Activate statute amendments'); _('Activate amendments'); _('Show amendments together with motions'); _('Prefix for the identifier for amendments'); @@ -210,7 +215,6 @@ _('Called with'); _('Recommendation'); _('Motion block'); - // Assignment config strings _('Election method'); _('Automatic assign of method'); @@ -220,10 +224,12 @@ _('Always Yes/No per candidate'); _('Elections'); _('Ballot and ballot papers'); _('The 100-%-base of an election result consists of'); -_('For Yes/No/Abstain per candidate and Yes/No per candidate the 100-%-base ' + +_( + 'For Yes/No/Abstain per candidate and Yes/No per candidate the 100-%-base ' + 'depends on the election method: If there is only one option per candidate, ' + 'the sum of all votes of all candidates is 100 %. Otherwise for each ' + - 'candidate the sum of all votes is 100 %.'); + 'candidate the sum of all votes is 100 %.' +); _('Yes/No/Abstain per candidate'); _('Yes/No per candidate'); _('All valid ballots'); @@ -316,7 +322,9 @@ _('Email subject'); _('Your login for {event_name}'); _('You can use {event_name} as a placeholder.'); _('Email body'); -_('Dear {name},\n\nthis is your OpenSlides login for the event {event_name}:\n\n {url}\n username: {username}\n password: {password}\n\nThis email was generated automatically.'); +_( + 'Dear {name},\n\nthis is your OpenSlides login for the event {event_name}:\n\n {url}\n username: {username}\n password: {password}\n\nThis email was generated automatically.' +); _('Use these placeholders: {name}, {event_name}, {url}, {username}, {password}. The url referrs to the system url.'); // default groups diff --git a/client/src/app/core/query-params.ts b/client/src/app/core/query-params.ts index 54c50c0de..f7069e83d 100644 --- a/client/src/app/core/query-params.ts +++ b/client/src/app/core/query-params.ts @@ -1,4 +1,3 @@ - type QueryParamValue = string | number | boolean; /** diff --git a/client/src/app/core/services/app-load.service.ts b/client/src/app/core/services/app-load.service.ts index 3c66a230f..af4a764a3 100644 --- a/client/src/app/core/services/app-load.service.ts +++ b/client/src/app/core/services/app-load.service.ts @@ -79,7 +79,11 @@ export class AppLoadService { // between (ModelConstructor) and (new (...args: any[]) => (BaseModel & Searchable)), we would not have // to check if the result of the contructor (the model instance) is really a searchable. if (!isSearchable(new entry.model())) { - throw Error(`Wrong configuration for ${entry.collectionString}: you gave a searchOrder, but the model is not searchable.`); + throw Error( + `Wrong configuration for ${ + entry.collectionString + }: you gave a searchOrder, but the model is not searchable.` + ); } return true; } diff --git a/client/src/app/core/services/csv-export.service.ts b/client/src/app/core/services/csv-export.service.ts index 9f046a85c..b3022d91d 100644 --- a/client/src/app/core/services/csv-export.service.ts +++ b/client/src/app/core/services/csv-export.service.ts @@ -115,40 +115,44 @@ export class CsvExportService { csvContent.push(header); // create lines - csvContent = csvContent.concat(models.map(model => { - return columns.map(column => { - let value: string; + csvContent = csvContent.concat( + models.map(model => { + return columns.map(column => { + let value: string; - if (isPropertyDefinition(column)) { - const property: any = model[column.property]; - if (typeof property === 'number') { - value = property.toString(10); - } else if (!property) { - value = ''; - } else if (property === true) { - value = '1'; - } else if (property === false) { - value = '0'; - } else { - value = property.toString(); + if (isPropertyDefinition(column)) { + const property: any = model[column.property]; + if (typeof property === 'number') { + value = property.toString(10); + } else if (!property) { + value = ''; + } else if (property === true) { + value = '1'; + } else if (property === false) { + value = '0'; + } else { + value = property.toString(); + } + } else if (isMapDefinition(column)) { + value = column.map(model); } - } else if (isMapDefinition(column)) { - value = column.map(model); - } - tsList = this.checkCsvTextSafety(value, tsList); + tsList = this.checkCsvTextSafety(value, tsList); - return value; - }); - })); + return value; + }); + }) + ); // assemble lines, putting text separator in place if (!tsList.length) { throw new Error('no usable text separator left for valid csv text'); } - const csvContentAsString: string = csvContent.map(line => { - return line.map(entry => tsList[0] + entry + tsList[0]).join(columnSeparator); - }).join(lineSeparator); + const csvContentAsString: string = csvContent + .map(line => { + return line.map(entry => tsList[0] + entry + tsList[0]).join(columnSeparator); + }) + .join(lineSeparator); this.exporter.saveFile(csvContentAsString, filename); } diff --git a/client/src/app/core/services/data-store.service.ts b/client/src/app/core/services/data-store.service.ts index c5dd73a0e..3242ad9ac 100644 --- a/client/src/app/core/services/data-store.service.ts +++ b/client/src/app/core/services/data-store.service.ts @@ -97,7 +97,9 @@ export class DataStoreService { /** * Observable subject for changed or deleted models in the datastore. */ - private readonly changedOrDeletedSubject: Subject = new Subject(); + private readonly changedOrDeletedSubject: Subject = new Subject< + BaseModel | DeletedInformation + >(); /** * Observe the datastore for changes and deletions. @@ -358,7 +360,7 @@ export class DataStoreService { collection: collectionString, id: +id // needs casting, because Objects.keys gives all keys as strings... }); - }) + }); }); if (models && models.length) { await this.add(models, newMaxChangeId); diff --git a/client/src/app/core/services/filter-list.service.ts b/client/src/app/core/services/filter-list.service.ts index 4d22abfe9..fda6e7510 100644 --- a/client/src/app/core/services/filter-list.service.ts +++ b/client/src/app/core/services/filter-list.service.ts @@ -5,7 +5,6 @@ import { BaseModel } from '../../shared/models/base/base-model'; import { BaseViewModel } from '../../site/base/base-view-model'; import { StorageService } from './storage.service'; - /** * Describes the available filters for a listView. * @param isActive: the current state of the filter @@ -18,7 +17,7 @@ import { StorageService } from './storage.service'; export interface OsFilter { property: string; label?: string; - options: (OsFilterOption | string )[]; + options: (OsFilterOption | string)[]; count?: number; } @@ -31,15 +30,12 @@ export interface OsFilterOption { isActive?: boolean; } - - /** * Filter for the list view. List views can subscribe to its' dataService (providing filter definitions) * and will receive their filtered data as observable */ export abstract class FilterListService { - /** * stores the currently used raw data to be used for the filter */ @@ -70,11 +66,14 @@ export abstract class FilterListService { - this.repo.getViewModelListObservable().pipe(auditTime(100)).subscribe( data => { - this.currentRawData = data; - this.filteredData = this.filterData(data); - this.filterDataOutput.next(this.filteredData); - }); + this.repo + .getViewModelListObservable() + .pipe(auditTime(100)) + .subscribe(data => { + this.currentRawData = data; + this.filteredData = this.filterData(data); + this.filterDataOutput.next(this.filteredData); + }); this.loadStorageDefinition(this.filterDefinitions); return this.filterDataOutput; } @@ -84,11 +83,12 @@ export abstract class FilterListService f.property === filterName ); + const filter = this.filterDefinitions.find(f => f.property === filterName); if (filter) { - const filterOption = filter.options.find(o => - (typeof o !== 'string') && o.condition === option.condition) as OsFilterOption; - if (filterOption && !filterOption.isActive){ + const filterOption = filter.options.find( + o => typeof o !== 'string' && o.condition === option.condition + ) as OsFilterOption; + if (filterOption && !filterOption.isActive) { filterOption.isActive = true; filter.count += 1; } @@ -103,11 +103,12 @@ export abstract class FilterListService f.property === filterName ); + const filter = this.filterDefinitions.find(f => f.property === filterName); if (filter) { - const filterOption = filter.options.find(o => - (typeof o !== 'string') && o.condition === option.condition) as OsFilterOption; - if (filterOption && filterOption.isActive){ + const filterOption = filter.options.find( + o => typeof o !== 'string' && o.condition === option.condition + ) as OsFilterOption; + if (filterOption && filterOption.isActive) { filterOption.isActive = false; filter.count -= 1; this.filteredData = this.filterData(this.currentRawData); @@ -126,11 +127,10 @@ export abstract class FilterListService { - const matchingStoreFilter = storedFilters.find(f => f.property === definedFilter.property); - let count = 0; - definedFilter.options.forEach(option => { - if (typeof option === 'string'){ - return; - }; - if (matchingStoreFilter && matchingStoreFilter.options){ - const storedOption = matchingStoreFilter.options.find(o => - typeof o !== 'string' && o.condition === option.condition) as OsFilterOption; - if (storedOption) { - option.isActive = storedOption.isActive; + this.store.get('filter_' + this.name).then( + function(storedData: { name: string; data: OsFilter[] }): void { + const storedFilters = storedData && storedData.data ? storedData.data : []; + definitions.forEach(definedFilter => { + const matchingStoreFilter = storedFilters.find(f => f.property === definedFilter.property); + let count = 0; + definedFilter.options.forEach(option => { + if (typeof option === 'string') { + return; } - } - if (option.isActive) { - count += 1; - } + if (matchingStoreFilter && matchingStoreFilter.options) { + const storedOption = matchingStoreFilter.options.find( + o => typeof o !== 'string' && o.condition === option.condition + ) as OsFilterOption; + if (storedOption) { + option.isActive = storedOption.isActive; + } + } + if (option.isActive) { + count += 1; + } + }); + definedFilter.count = count; }); - definedFilter.count = count; - }); - me.filterDefinitions = definitions; - me.filteredData = me.filterData(me.currentRawData); - me.filterDataOutput.next(me.filteredData); - }, function(error: any) : void { - me.filteredData = me.filterData(me.currentRawData); - me.filterDataOutput.next(me.filteredData); - }); + me.filterDefinitions = definitions; + me.filteredData = me.filterData(me.currentRawData); + me.filterDataOutput.next(me.filteredData); + }, + function(error: any): void { + me.filteredData = me.filterData(me.currentRawData); + me.filterDataOutput.next(me.filteredData); + } + ); } /** @@ -177,10 +181,11 @@ export abstract class FilterListService { @@ -200,7 +205,7 @@ export abstract class FilterListService(path: string, method: HTTPMethod, data?: any, queryParams?: QueryParams, customHeader?: HttpHeaders): Promise { + private async send( + path: string, + method: HTTPMethod, + data?: any, + queryParams?: QueryParams, + customHeader?: HttpHeaders + ): Promise { // end early, if we are in history mode if (this.OSStatus.isInHistoryMode && method !== HTTPMethod.GET) { throw this.handleError('You cannot make changes while in history mode'); diff --git a/client/src/app/core/services/openslides-status.service.ts b/client/src/app/core/services/openslides-status.service.ts index 28e1db6cb..410d676ec 100644 --- a/client/src/app/core/services/openslides-status.service.ts +++ b/client/src/app/core/services/openslides-status.service.ts @@ -8,7 +8,6 @@ import { Injectable } from '@angular/core'; providedIn: 'root' }) export class OpenSlidesStatusService { - /** * Saves, if OpenSlides is in the history mode. */ @@ -37,6 +36,6 @@ export class OpenSlidesStatusService { * Leaves the histroy mode */ public leaveHistroyMode(): void { - this.historyMode = false; + this.historyMode = false; } } diff --git a/client/src/app/core/services/time-travel.service.spec.ts b/client/src/app/core/services/time-travel.service.spec.ts index 60b32fb50..a02eee565 100644 --- a/client/src/app/core/services/time-travel.service.spec.ts +++ b/client/src/app/core/services/time-travel.service.spec.ts @@ -4,10 +4,12 @@ import { TimeTravelService } from './time-travel.service'; import { E2EImportsModule } from 'e2e-imports.module'; describe('TimeTravelService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [E2EImportsModule], - providers: [TimeTravelService] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [E2EImportsModule], + providers: [TimeTravelService] + }) + ); it('should be created', () => { const service: TimeTravelService = TestBed.get(TimeTravelService); diff --git a/client/src/app/core/services/time-travel.service.ts b/client/src/app/core/services/time-travel.service.ts index dbc37d6e9..65eb0b9a9 100644 --- a/client/src/app/core/services/time-travel.service.ts +++ b/client/src/app/core/services/time-travel.service.ts @@ -52,7 +52,7 @@ export class TimeTravelService { private DS: DataStoreService, private OSStatus: OpenSlidesStatusService, private OpenSlides: OpenSlidesService - ) { } + ) {} /** * Main entry point to set OpenSlides to another history point. @@ -65,11 +65,11 @@ export class TimeTravelService { for (const historyObject of fullDataHistory) { let collectionString: string; let id: string; - [collectionString, id] = historyObject.element_id.split(':') + [collectionString, id] = historyObject.element_id.split(':'); if (historyObject.full_data) { const targetClass = this.modelMapperService.getModelConstructor(collectionString); - await this.DS.add([new targetClass(historyObject.full_data)]) + await this.DS.add([new targetClass(historyObject.full_data)]); } else { await this.DS.remove(collectionString, [+id]); } @@ -94,7 +94,7 @@ export class TimeTravelService { * @returns the full history on the given date */ private async getHistoryData(history: History): Promise { - const historyUrl = '/core/history/' + const historyUrl = '/core/history/'; const queryParams = { timestamp: Math.ceil(+history.unixtime) }; return this.httpService.get(environment.urlPrefix + historyUrl, null, queryParams); } diff --git a/client/src/app/core/services/websocket.service.ts b/client/src/app/core/services/websocket.service.ts index dcf15f742..55a4b29f7 100644 --- a/client/src/app/core/services/websocket.service.ts +++ b/client/src/app/core/services/websocket.service.ts @@ -71,11 +71,7 @@ export class WebsocketService { * @param zone * @param translate */ - public constructor( - private matSnackBar: MatSnackBar, - private zone: NgZone, - public translate: TranslateService - ) {} + public constructor(private matSnackBar: MatSnackBar, private zone: NgZone, public translate: TranslateService) {} /** * Creates a new WebSocket connection and handles incomming events. diff --git a/client/src/app/shared/components/choice-dialog/choice-dialog.component.ts b/client/src/app/shared/components/choice-dialog/choice-dialog.component.ts index 31971506e..e509c1744 100644 --- a/client/src/app/shared/components/choice-dialog/choice-dialog.component.ts +++ b/client/src/app/shared/components/choice-dialog/choice-dialog.component.ts @@ -51,7 +51,7 @@ interface ChoiceDialogData { * it will be an array of numbers and optionally an action string for multichoice * dialogs */ -export type ChoiceAnswer = undefined | { action?: string; items: number | number[]}; +export type ChoiceAnswer = undefined | { action?: string; items: number | number[] }; /** * A dialog with choice fields. diff --git a/client/src/app/shared/components/os-sort-filter-bar/filter-menu/filter-menu.component.spec.ts b/client/src/app/shared/components/os-sort-filter-bar/filter-menu/filter-menu.component.spec.ts index c1bb9d56c..fb3dee957 100644 --- a/client/src/app/shared/components/os-sort-filter-bar/filter-menu/filter-menu.component.spec.ts +++ b/client/src/app/shared/components/os-sort-filter-bar/filter-menu/filter-menu.component.spec.ts @@ -5,19 +5,16 @@ describe('FilterMenuComponent', () => { // TODO test won't work without a BaseViewModel // let component: FilterMenuComponent; // let fixture: ComponentFixture>; - // beforeEach(async(() => { // TestBed.configureTestingModule({ // declarations: [FilterMenuComponent] // }).compileComponents(); // })); - // beforeEach(() => { // fixture = TestBed.createComponent(FilterMenuComponent); // component = fixture.componentInstance; // fixture.detectChanges(); // }); - // it('should create', () => { // expect(component).toBeTruthy(); // }); diff --git a/client/src/app/shared/components/os-sort-filter-bar/filter-menu/filter-menu.component.ts b/client/src/app/shared/components/os-sort-filter-bar/filter-menu/filter-menu.component.ts index a998ba2cf..3dce88d3e 100644 --- a/client/src/app/shared/components/os-sort-filter-bar/filter-menu/filter-menu.component.ts +++ b/client/src/app/shared/components/os-sort-filter-bar/filter-menu/filter-menu.component.ts @@ -18,7 +18,6 @@ import { FilterListService, OsFilterOption } from '../../../../core/services/fil styleUrls: ['./filter-menu.component.scss'] }) export class FilterMenuComponent implements OnInit { - /** * An event emitter to submit a desire to close this component * TODO: Might be an easier way to do this @@ -37,8 +36,7 @@ export class FilterMenuComponent implements OnInit { * Constructor. Does nothing. * @param service */ - public constructor() { - } + public constructor() {} /** * Directly closes again if no sorting is available @@ -53,12 +51,12 @@ export class FilterMenuComponent implements OnInit { * Tests for escape key (to colose the sidebar) * @param event */ - public checkKeyEvent(event: KeyboardEvent) : void { - if (event.key === 'Escape'){ - this.dismissed.next(true) + public checkKeyEvent(event: KeyboardEvent): void { + if (event.key === 'Escape') { + this.dismissed.next(true); } } - public isFilter(option: OsFilterOption) : boolean{ - return (typeof option === 'string') ? false : true; + public isFilter(option: OsFilterOption): boolean { + return typeof option === 'string' ? false : true; } } diff --git a/client/src/app/shared/components/os-sort-filter-bar/os-sort-bottom-sheet/os-sort-bottom-sheet.component.spec.ts b/client/src/app/shared/components/os-sort-filter-bar/os-sort-bottom-sheet/os-sort-bottom-sheet.component.spec.ts index 99fae42c6..c2dfc77c3 100644 --- a/client/src/app/shared/components/os-sort-filter-bar/os-sort-bottom-sheet/os-sort-bottom-sheet.component.spec.ts +++ b/client/src/app/shared/components/os-sort-filter-bar/os-sort-bottom-sheet/os-sort-bottom-sheet.component.spec.ts @@ -3,7 +3,6 @@ import { E2EImportsModule } from 'e2e-imports.module'; import { OsSortBottomSheetComponent } from './os-sort-bottom-sheet.component'; - describe('OsSortBottomSheetComponent', () => { // let component: OsSortBottomSheetComponent; let fixture: ComponentFixture>; diff --git a/client/src/app/shared/components/os-sort-filter-bar/os-sort-bottom-sheet/os-sort-bottom-sheet.component.ts b/client/src/app/shared/components/os-sort-filter-bar/os-sort-bottom-sheet/os-sort-bottom-sheet.component.ts index d8bbb669f..bbb0c55b5 100644 --- a/client/src/app/shared/components/os-sort-filter-bar/os-sort-bottom-sheet/os-sort-bottom-sheet.component.ts +++ b/client/src/app/shared/components/os-sort-filter-bar/os-sort-bottom-sheet/os-sort-bottom-sheet.component.ts @@ -19,21 +19,21 @@ import { SortListService } from '../../../../core/services/sort-list.service'; styleUrls: ['./os-sort-bottom-sheet.component.scss'] }) export class OsSortBottomSheetComponent implements OnInit { - /** * Constructor. Gets a reference to itself (for closing after interaction) * @param data * @param sheetRef */ public constructor( - @Inject(MAT_BOTTOM_SHEET_DATA) public data: SortListService, private sheetRef: MatBottomSheetRef ) { - } + @Inject(MAT_BOTTOM_SHEET_DATA) public data: SortListService, + private sheetRef: MatBottomSheetRef + ) {} /** * init fucntion. Closes inmediately if no sorting is available. */ public ngOnInit(): void { - if (!this.data || !this.data.sortOptions || !this.data.sortOptions.options.length){ + if (!this.data || !this.data.sortOptions || !this.data.sortOptions.options.length) { throw new Error('No sorting available for a sorting list'); } } diff --git a/client/src/app/shared/components/os-sort-filter-bar/os-sort-filter-bar.component.spec.ts b/client/src/app/shared/components/os-sort-filter-bar/os-sort-filter-bar.component.spec.ts index 5c6b45fbb..20fa3d959 100644 --- a/client/src/app/shared/components/os-sort-filter-bar/os-sort-filter-bar.component.spec.ts +++ b/client/src/app/shared/components/os-sort-filter-bar/os-sort-filter-bar.component.spec.ts @@ -9,7 +9,7 @@ describe('OsSortFilterBarComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [E2EImportsModule], + imports: [E2EImportsModule] }).compileComponents(); })); diff --git a/client/src/app/shared/components/os-sort-filter-bar/os-sort-filter-bar.component.ts b/client/src/app/shared/components/os-sort-filter-bar/os-sort-filter-bar.component.ts index bc6cce106..fe3e37757 100644 --- a/client/src/app/shared/components/os-sort-filter-bar/os-sort-filter-bar.component.ts +++ b/client/src/app/shared/components/os-sort-filter-bar/os-sort-filter-bar.component.ts @@ -4,8 +4,8 @@ import { TranslateService } from '@ngx-translate/core'; import { BaseViewModel } from '../../../site/base/base-view-model'; import { OsSortBottomSheetComponent } from './os-sort-bottom-sheet/os-sort-bottom-sheet.component'; -import { FilterMenuComponent} from './filter-menu/filter-menu.component'; -import { OsSortingItem } from '../../../core/services/sort-list.service' +import { FilterMenuComponent } from './filter-menu/filter-menu.component'; +import { OsSortingItem } from '../../../core/services/sort-list.service'; import { SortListService } from '../../../core/services/sort-list.service'; import { ViewportService } from '../../../core/services/viewport.service'; @@ -29,7 +29,6 @@ import { ViewportService } from '../../../core/services/viewport.service'; styleUrls: ['./os-sort-filter-bar.component.scss'] }) export class OsSortFilterBarComponent { - /** * The currently active sorting service for the list view */ @@ -68,7 +67,11 @@ export class OsSortFilterBarComponent { * @param vp * @param bottomSheet */ - public constructor(public translate: TranslateService, public vp: ViewportService, private bottomSheet: MatBottomSheet) { + public constructor( + public translate: TranslateService, + public vp: ViewportService, + private bottomSheet: MatBottomSheet + ) { this.filterMenu = new FilterMenuComponent(); } @@ -77,9 +80,7 @@ export class OsSortFilterBarComponent { */ public openSortDropDown(): void { if (this.vp.isMobile) { - const bottomSheetRef = this.bottomSheet.open(OsSortBottomSheetComponent, - { data: this.sortService } - ); + const bottomSheetRef = this.bottomSheet.open(OsSortBottomSheetComponent, { data: this.sortService }); bottomSheetRef.afterDismissed().subscribe(result => { if (result) { this.sortService.sortProperty = result; @@ -92,7 +93,7 @@ export class OsSortFilterBarComponent { * Listen to keypresses on the quick-search input */ public applySearch(event: KeyboardEvent, value?: string): void { - if (event.key === 'Escape' ) { + if (event.key === 'Escape') { this.searchFieldChange.emit(''); this.isSearchBar = false; } else { @@ -104,16 +105,16 @@ export class OsSortFilterBarComponent { * Checks if there is an active SortService present */ public get hasSorting(): boolean { - return (this.sortService && this.sortService.isActive); + return this.sortService && this.sortService.isActive; } /** * Checks if there is an active FilterService present */ public get hasFilters(): boolean { - if (this.filterService && this.filterService.hasFilterOptions()){ + if (this.filterService && this.filterService.hasFilterOptions()) { return true; - }; + } return false; } @@ -122,7 +123,7 @@ export class OsSortFilterBarComponent { * @param option */ public getSortIcon(option: OsSortingItem): string { - if (this.sortService.sortProperty !== option.property){ + if (this.sortService.sortProperty !== option.property) { return ''; } return this.sortService.ascending ? 'arrow_downward' : 'arrow_upward'; @@ -133,7 +134,7 @@ export class OsSortFilterBarComponent { * the property is used. * @param option */ - public getSortLabel(option: OsSortingItem) : string { + public getSortLabel(option: OsSortingItem): string { if (option.label) { return option.label; } @@ -146,7 +147,7 @@ export class OsSortFilterBarComponent { * that input applied */ public toggleSearchBar(): void { - if (!this.isSearchBar){ + if (!this.isSearchBar) { this.isSearchBar = true; } else { this.searchFieldChange.emit(''); diff --git a/client/src/app/shared/components/sorting-list/sorting-list.component.ts b/client/src/app/shared/components/sorting-list/sorting-list.component.ts index f90e13160..33e00577d 100644 --- a/client/src/app/shared/components/sorting-list/sorting-list.component.ts +++ b/client/src/app/shared/components/sorting-list/sorting-list.component.ts @@ -78,7 +78,7 @@ export class SortingListComponent implements OnInit, OnDestroy { if (newValues instanceof Observable) { this.inputSubscription = newValues.subscribe(values => { this.updateArray(values); - }) + }); } else { this.inputSubscription = null; this.updateArray(newValues); diff --git a/client/src/app/shared/components/sorting-tree/sorting-tree.component.spec.ts b/client/src/app/shared/components/sorting-tree/sorting-tree.component.spec.ts index 578d20938..53edf85e9 100644 --- a/client/src/app/shared/components/sorting-tree/sorting-tree.component.spec.ts +++ b/client/src/app/shared/components/sorting-tree/sorting-tree.component.spec.ts @@ -10,7 +10,12 @@ import { BehaviorSubject } from 'rxjs'; * A test model for the sorting */ class TestModel implements Identifiable, Displayable { - public constructor(public id: number, public name: string, public weight: number, public parent_id: number | null){} + public constructor( + public id: number, + public name: string, + public weight: number, + public parent_id: number | null + ) {} public getTitle(): string { return this.name; diff --git a/client/src/app/shared/models/assignments/assignment.ts b/client/src/app/shared/models/assignments/assignment.ts index 7db96deac..b8af1bb17 100644 --- a/client/src/app/shared/models/assignments/assignment.ts +++ b/client/src/app/shared/models/assignments/assignment.ts @@ -3,11 +3,10 @@ import { Poll } from './poll'; import { AgendaBaseModel } from '../base/agenda-base-model'; import { SearchRepresentation } from '../../../core/services/search.service'; - export const assignmentPhase = [ - {key: 0, name: 'Searching for candidates'}, - {key: 1, name: 'Voting'}, - {key: 2, name: 'Finished'} + { key: 0, name: 'Searching for candidates' }, + { key: 1, name: 'Voting' }, + { key: 2, name: 'Finished' } ]; /** diff --git a/client/src/app/shared/models/base/agenda-base-model.ts b/client/src/app/shared/models/base/agenda-base-model.ts index 09819069c..d3b122c91 100644 --- a/client/src/app/shared/models/base/agenda-base-model.ts +++ b/client/src/app/shared/models/base/agenda-base-model.ts @@ -46,7 +46,6 @@ export abstract class AgendaBaseModel extends ProjectableBaseModel implements Ag */ public abstract formatForSearch(): SearchRepresentation; - /** * Should return the URL to the detail view. Used for the agenda, that the * user can navigate to the content object. diff --git a/client/src/app/shared/models/base/agenda-information.ts b/client/src/app/shared/models/base/agenda-information.ts index bca537cf8..ed81b03d6 100644 --- a/client/src/app/shared/models/base/agenda-information.ts +++ b/client/src/app/shared/models/base/agenda-information.ts @@ -1,4 +1,4 @@ -import { DetailNavigable } from "./detail-navigable"; +import { DetailNavigable } from './detail-navigable'; /** * An Interface for all extra information needed for content objects of items. diff --git a/client/src/app/shared/models/base/base-model.ts b/client/src/app/shared/models/base/base-model.ts index e76283565..6458f3ef2 100644 --- a/client/src/app/shared/models/base/base-model.ts +++ b/client/src/app/shared/models/base/base-model.ts @@ -98,7 +98,7 @@ export abstract class BaseModel extends OpenSlidesComponent // topicS, motionS, (media)fileS, motion blockS, commentS, personal noteS, projectorS, messageS, countdownS, ...) // Just categorIES need to overwrite this... } else { - return this._verboseName + return this._verboseName; } } diff --git a/client/src/app/shared/models/core/history.ts b/client/src/app/shared/models/core/history.ts index fe1233b81..70b41b36f 100644 --- a/client/src/app/shared/models/core/history.ts +++ b/client/src/app/shared/models/core/history.ts @@ -1,4 +1,3 @@ - import { BaseModel } from '../base/base-model'; /** diff --git a/client/src/app/shared/models/motions/motion.ts b/client/src/app/shared/models/motions/motion.ts index e7205f80c..ea8adeeda 100644 --- a/client/src/app/shared/models/motions/motion.ts +++ b/client/src/app/shared/models/motions/motion.ts @@ -86,7 +86,7 @@ export class Motion extends AgendaBaseModel { * @override */ public formatForSearch(): SearchRepresentation { - let searchValues = [this.title, this.text, this.reason] + let searchValues = [this.title, this.text, this.reason]; if (this.amendment_paragraphs) { searchValues = searchValues.concat(this.amendment_paragraphs.filter(x => !!x)); } diff --git a/client/src/app/shared/models/motions/workflow-state.ts b/client/src/app/shared/models/motions/workflow-state.ts index 19fbff695..45b7e2772 100644 --- a/client/src/app/shared/models/motions/workflow-state.ts +++ b/client/src/app/shared/models/motions/workflow-state.ts @@ -62,7 +62,7 @@ export class WorkflowState extends Deserializer { * Checks if a workflowstate has no 'next state' left, and is final */ public get isFinalState(): boolean { - if (!this.next_states_id || !this.next_states_id.length ){ + if (!this.next_states_id || !this.next_states_id.length) { return true; } if (this.next_states_id.length === 1 && this.next_states_id[0] === 0) { diff --git a/client/src/app/site/agenda/agenda.config.ts b/client/src/app/site/agenda/agenda.config.ts index ce86afa36..097f027ba 100644 --- a/client/src/app/site/agenda/agenda.config.ts +++ b/client/src/app/site/agenda/agenda.config.ts @@ -4,7 +4,10 @@ import { Topic } from '../../shared/models/topics/topic'; export const AgendaAppConfig: AppConfig = { name: 'agenda', - models: [{ collectionString: 'agenda/item', model: Item }, { collectionString: 'topics/topic', model: Topic, searchOrder: 1 }], + models: [ + { collectionString: 'agenda/item', model: Item }, + { collectionString: 'topics/topic', model: Topic, searchOrder: 1 } + ], mainMenuEntries: [ { route: '/agenda', diff --git a/client/src/app/site/agenda/agenda.module.ts b/client/src/app/site/agenda/agenda.module.ts index bf49114ff..8b6414194 100644 --- a/client/src/app/site/agenda/agenda.module.ts +++ b/client/src/app/site/agenda/agenda.module.ts @@ -12,7 +12,7 @@ import { ItemInfoDialogComponent } from './components/item-info-dialog/item-info */ @NgModule({ imports: [CommonModule, AgendaRoutingModule, SharedModule], - entryComponents: [ ItemInfoDialogComponent ], + entryComponents: [ItemInfoDialogComponent], declarations: [AgendaListComponent, TopicDetailComponent, ItemInfoDialogComponent] }) export class AgendaModule {} diff --git a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.scss b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.scss index 160ddf7c7..b9cbe4105 100644 --- a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.scss +++ b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.scss @@ -1,5 +1,4 @@ .os-listview-table { - /** Title */ .mat-column-title { padding-left: 26px; @@ -27,7 +26,6 @@ height: $icon-size; width: $icon-size; } - } } diff --git a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts index 51ddba891..9a8ce692d 100644 --- a/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts +++ b/client/src/app/site/agenda/components/agenda-list/agenda-list.component.ts @@ -10,7 +10,6 @@ import { ListViewBaseComponent } from 'app/site/base/list-view-base'; import { PromptService } from '../../../../core/services/prompt.service'; import { ViewItem } from '../../models/view-item'; - import { AgendaCsvExportService } from '../../services/agenda-csv-export.service'; import { ItemInfoDialogComponent } from '../item-info-dialog/item-info-dialog.component'; import { ViewportService } from 'app/core/services/viewport.service'; diff --git a/client/src/app/site/agenda/components/speaker-list/speaker-list.component.ts b/client/src/app/site/agenda/components/speaker-list/speaker-list.component.ts index 6bb74be2e..481c83893 100644 --- a/client/src/app/site/agenda/components/speaker-list/speaker-list.component.ts +++ b/client/src/app/site/agenda/components/speaker-list/speaker-list.component.ts @@ -73,7 +73,7 @@ export class SpeakerListComponent extends BaseViewComponent implements OnInit { private itemRepo: AgendaRepositoryService, private op: OperatorService ) { - super(title, translate, snackBar) + super(title, translate, snackBar); this.addSpeakerForm = new FormGroup({ user_id: new FormControl([]) }); this.getAgendaItemByUrl(); } diff --git a/client/src/app/site/agenda/models/view-item.ts b/client/src/app/site/agenda/models/view-item.ts index 8b20723a8..b695151bf 100644 --- a/client/src/app/site/agenda/models/view-item.ts +++ b/client/src/app/site/agenda/models/view-item.ts @@ -44,14 +44,14 @@ export class ViewItem extends BaseViewModel { return ''; } - public get verboseType() : string { + public get verboseType(): string { if (this.item && this.item.verboseType) { return this.item.verboseType; } return ''; } - public get verboseCsvType() : string { + public get verboseCsvType(): string { if (this.item) { return this.item.verboseCsvType; } diff --git a/client/src/app/site/agenda/services/agenda-csv-export.service.spec.ts b/client/src/app/site/agenda/services/agenda-csv-export.service.spec.ts index 5720f7837..2c417b86e 100644 --- a/client/src/app/site/agenda/services/agenda-csv-export.service.spec.ts +++ b/client/src/app/site/agenda/services/agenda-csv-export.service.spec.ts @@ -11,10 +11,7 @@ describe('AgendaCsvExportService', () => { }); }); - it('should be created', inject( - [AgendaCsvExportService], - (service: AgendaCsvExportService) => { - expect(service).toBeTruthy(); - } - )); + it('should be created', inject([AgendaCsvExportService], (service: AgendaCsvExportService) => { + expect(service).toBeTruthy(); + })); }); diff --git a/client/src/app/site/agenda/services/agenda-csv-export.service.ts b/client/src/app/site/agenda/services/agenda-csv-export.service.ts index 8b4695fb8..f9eb6eaff 100644 --- a/client/src/app/site/agenda/services/agenda-csv-export.service.ts +++ b/client/src/app/site/agenda/services/agenda-csv-export.service.ts @@ -12,7 +12,6 @@ import { ViewItem } from '../models/view-item'; providedIn: 'root' }) export class AgendaCsvExportService { - /** * Does nothing. * @@ -27,10 +26,14 @@ export class AgendaCsvExportService { * @param Agendas Agendas to export */ public exportItemList(items: ViewItem[]): void { - this.csvExport.export(items, + this.csvExport.export( + items, [ { label: 'Title', map: viewItem => viewItem.getTitle() }, - { label: 'Text', map: viewItem => viewItem.contentObject ? viewItem.contentObject.getCSVExportText() : '' }, + { + label: 'Text', + map: viewItem => (viewItem.contentObject ? viewItem.contentObject.getCSVExportText() : '') + }, { label: 'Duration', property: 'duration' }, { label: 'Comment', property: 'comment' }, { label: 'Item type', property: 'verboseCsvType' } diff --git a/client/src/app/site/agenda/services/agenda-filter-list.service.ts b/client/src/app/site/agenda/services/agenda-filter-list.service.ts index 01c8a1aea..557d6a14f 100644 --- a/client/src/app/site/agenda/services/agenda-filter-list.service.ts +++ b/client/src/app/site/agenda/services/agenda-filter-list.service.ts @@ -1,16 +1,15 @@ -import { Injectable } from "@angular/core"; +import { Injectable } from '@angular/core'; -import { FilterListService, OsFilter, OsFilterOption } from "../../../core/services/filter-list.service"; -import { Item, itemVisibilityChoices } from "../../../shared/models/agenda/item"; -import { ViewItem } from "../models/view-item"; -import { StorageService } from "app/core/services/storage.service"; -import { AgendaRepositoryService } from "./agenda-repository.service"; +import { FilterListService, OsFilter, OsFilterOption } from '../../../core/services/filter-list.service'; +import { Item, itemVisibilityChoices } from '../../../shared/models/agenda/item'; +import { ViewItem } from '../models/view-item'; +import { StorageService } from 'app/core/services/storage.service'; +import { AgendaRepositoryService } from './agenda-repository.service'; @Injectable({ providedIn: 'root' }) export class AgendaFilterListService extends FilterListService { - protected name = 'Agenda'; public filterOptions: OsFilter[] = []; @@ -22,22 +21,22 @@ export class AgendaFilterListService extends FilterListService { */ public constructor(store: StorageService, repo: AgendaRepositoryService) { super(store, repo); - this.filterOptions = [{ + this.filterOptions = [ + { label: 'Visibility', property: 'type', options: this.createVisibilityFilterOptions() - }, { + }, + { label: 'Hidden Status', property: 'done', - options: [ - {label: 'Open', condition: false}, - {label: 'Closed', condition: true} - ] - }]; + options: [{ label: 'Open', condition: false }, { label: 'Closed', condition: true }] + } + ]; } private createVisibilityFilterOptions(): OsFilterOption[] { - const options = []; + const options = []; itemVisibilityChoices.forEach(choice => { options.push({ condition: choice.key as number, @@ -46,6 +45,4 @@ export class AgendaFilterListService extends FilterListService { }); return options; } - - } diff --git a/client/src/app/site/agenda/services/agenda-repository.service.ts b/client/src/app/site/agenda/services/agenda-repository.service.ts index 3624bb3b1..d77ae76c3 100644 --- a/client/src/app/site/agenda/services/agenda-repository.service.ts +++ b/client/src/app/site/agenda/services/agenda-repository.service.ts @@ -187,7 +187,7 @@ export class AgendaRepositoryService extends BaseRepository { * deleted (right now) */ public delete(item: ViewItem): Promise { - throw new Error("Method not implemented."); + throw new Error('Method not implemented.'); } /** @@ -196,7 +196,7 @@ export class AgendaRepositoryService extends BaseRepository { * Agenda items are created implicitly and do not have on create functions */ public async create(item: Item): Promise { - throw new Error("Method not implemented."); + throw new Error('Method not implemented.'); } /** diff --git a/client/src/app/site/agenda/services/topic-repository.service.spec.ts b/client/src/app/site/agenda/services/topic-repository.service.spec.ts index 2440aaf3a..201cac88b 100644 --- a/client/src/app/site/agenda/services/topic-repository.service.spec.ts +++ b/client/src/app/site/agenda/services/topic-repository.service.spec.ts @@ -7,7 +7,8 @@ describe('TopicRepositoryService', () => { beforeEach(() => TestBed.configureTestingModule({ imports: [E2EImportsModule] - })); + }) + ); it('should be created', () => { const service: TopicRepositoryService = TestBed.get(TopicRepositoryService); diff --git a/client/src/app/site/assignments/assignment-list/assignment-list.component.ts b/client/src/app/site/assignments/assignment-list/assignment-list.component.ts index 04d2b6243..d76590bf1 100644 --- a/client/src/app/site/assignments/assignment-list/assignment-list.component.ts +++ b/client/src/app/site/assignments/assignment-list/assignment-list.component.ts @@ -10,8 +10,6 @@ import { PromptService } from '../../../core/services/prompt.service'; import { ViewAssignment } from '../models/view-assignment'; import { AssignmentSortListService } from '../services/assignment-sort-list.service'; - - /** * Listview for the assignments * @@ -22,7 +20,6 @@ import { AssignmentSortListService } from '../services/assignment-sort-list.serv styleUrls: ['./assignment-list.component.scss'] }) export class AssignmentListComponent extends ListViewBaseComponent implements OnInit { - /** * Constructor. * @param titleService diff --git a/client/src/app/site/assignments/services/assignment-filter.service.ts b/client/src/app/site/assignments/services/assignment-filter.service.ts index e1258ab27..acb5fb114 100644 --- a/client/src/app/site/assignments/services/assignment-filter.service.ts +++ b/client/src/app/site/assignments/services/assignment-filter.service.ts @@ -1,27 +1,27 @@ -import { Injectable } from "@angular/core"; - -import { AssignmentRepositoryService } from "./assignment-repository.service"; -import { Assignment, assignmentPhase } from "../../../shared/models/assignments/assignment"; -import { FilterListService, OsFilter, OsFilterOption } from "../../../core/services/filter-list.service"; -import { StorageService } from "app/core/services/storage.service"; -import { ViewAssignment } from "../models/view-assignment"; +import { Injectable } from '@angular/core'; +import { AssignmentRepositoryService } from './assignment-repository.service'; +import { Assignment, assignmentPhase } from '../../../shared/models/assignments/assignment'; +import { FilterListService, OsFilter, OsFilterOption } from '../../../core/services/filter-list.service'; +import { StorageService } from 'app/core/services/storage.service'; +import { ViewAssignment } from '../models/view-assignment'; @Injectable({ providedIn: 'root' }) export class AssignmentFilterListService extends FilterListService { - protected name = 'Assignment'; public filterOptions: OsFilter[]; public constructor(store: StorageService, assignmentRepo: AssignmentRepositoryService) { super(store, assignmentRepo); - this.filterOptions = [{ - property: 'phase', - options: this.createPhaseOptions() - }]; + this.filterOptions = [ + { + property: 'phase', + options: this.createPhaseOptions() + } + ]; } private createPhaseOptions(): OsFilterOption[] { diff --git a/client/src/app/site/assignments/services/assignment-repository.service.ts b/client/src/app/site/assignments/services/assignment-repository.service.ts index c922b410f..4a2131fd5 100644 --- a/client/src/app/site/assignments/services/assignment-repository.service.ts +++ b/client/src/app/site/assignments/services/assignment-repository.service.ts @@ -24,10 +24,7 @@ export class AssignmentRepositoryService extends BaseRepository { - public sortOptions: OsSortingDefinition = { sortProperty: 'assignment', sortAscending: true, @@ -18,5 +17,4 @@ export class AssignmentSortListService extends SortListService { ] }; protected name = 'Assignment'; - } diff --git a/client/src/app/site/base/app-config.ts b/client/src/app/site/base/app-config.ts index 0323f50b1..81a8653f9 100644 --- a/client/src/app/site/base/app-config.ts +++ b/client/src/app/site/base/app-config.ts @@ -9,7 +9,7 @@ export interface ModelEntry { export interface SearchableModelEntry { collectionString: string; - model: new (...args: any[]) => (BaseModel & Searchable); + model: new (...args: any[]) => BaseModel & Searchable; searchOrder: number; } diff --git a/client/src/app/site/base/base-repository.ts b/client/src/app/site/base/base-repository.ts index 65fb11bc3..ace9f4850 100644 --- a/client/src/app/site/base/base-repository.ts +++ b/client/src/app/site/base/base-repository.ts @@ -37,7 +37,7 @@ export abstract class BaseRepository, - protected depsModelCtors?: ModelConstructor[], + protected depsModelCtors?: ModelConstructor[] ) { super(); this.setup(); diff --git a/client/src/app/site/base/list-view-base.ts b/client/src/app/site/base/list-view-base.ts index ae2072d6a..022a11861 100644 --- a/client/src/app/site/base/list-view-base.ts +++ b/client/src/app/site/base/list-view-base.ts @@ -80,7 +80,7 @@ export abstract class ListViewBaseComponent extends Bas this.sort.sort(newSort); } - public onFilterData(filteredDataSource: MatTableDataSource) : void { + public onFilterData(filteredDataSource: MatTableDataSource): void { this.dataSource = filteredDataSource; this.dataSource.paginator = this.paginator; } diff --git a/client/src/app/site/common/components/search/search.component.ts b/client/src/app/site/common/components/search/search.component.ts index 50d4de558..320403518 100644 --- a/client/src/app/site/common/components/search/search.component.ts +++ b/client/src/app/site/common/components/search/search.component.ts @@ -12,7 +12,7 @@ import { DataStoreService } from 'app/core/services/data-store.service'; import { SearchService, SearchModel, SearchResult } from 'app/core/services/search.service'; import { BaseViewComponent } from '../../../base/base-view'; -type SearchModelEnabled = SearchModel & { enabled: boolean; }; +type SearchModelEnabled = SearchModel & { enabled: boolean }; /** * Component for the full search text. @@ -78,16 +78,16 @@ export class SearchComponent extends BaseViewComponent implements OnInit { super(title, translate, matSnackBar); this.quickSearchform = new FormGroup({ query: new FormControl([]) }); - this.registeredModels = this.searchService.getRegisteredModels().map(rm => ({...rm, enabled: true})); + this.registeredModels = this.searchService.getRegisteredModels().map(rm => ({ ...rm, enabled: true })); this.DS.changedOrDeletedObservable.pipe(auditTime(1)).subscribe(() => this.search()); this.quickSearchSubject.pipe(debounceTime(250)).subscribe(query => this.search(query)); } - /** - * Take the search query from the URL and does the initial search. - */ - public ngOnInit(): void { + /** + * Take the search query from the URL and does the initial search. + */ + public ngOnInit(): void { super.setTitle('Search'); this.query = this.activatedRoute.snapshot.queryParams.query; this.quickSearchform.get('query').setValue(this.query); diff --git a/client/src/app/site/core/services/duration.service.spec.ts b/client/src/app/site/core/services/duration.service.spec.ts index cc3818a50..11a4c8418 100644 --- a/client/src/app/site/core/services/duration.service.spec.ts +++ b/client/src/app/site/core/services/duration.service.spec.ts @@ -4,9 +4,11 @@ import { DurationService } from './duration.service'; import { E2EImportsModule } from 'e2e-imports.module'; describe('DurationService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [E2EImportsModule] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [E2EImportsModule] + }) + ); it('should be created', () => { const service: DurationService = TestBed.get(DurationService); diff --git a/client/src/app/site/history/models/view-history.ts b/client/src/app/site/history/models/view-history.ts index 1018497fe..b53a6b910 100644 --- a/client/src/app/site/history/models/view-history.ts +++ b/client/src/app/site/history/models/view-history.ts @@ -96,7 +96,7 @@ export class ViewHistory extends BaseViewModel { * @returns the CollectionString to the model */ public getCollectionString(): string { - return this.element_id.split(":")[0] + return this.element_id.split(':')[0]; } /** @@ -104,7 +104,7 @@ export class ViewHistory extends BaseViewModel { * @returns a model id */ public getModelID(): number { - return +this.element_id.split(":")[1] + return +this.element_id.split(':')[1]; } /** diff --git a/client/src/app/site/login/components/login-mask/login-mask.component.ts b/client/src/app/site/login/components/login-mask/login-mask.component.ts index 01d8ae6c9..a52b3e537 100644 --- a/client/src/app/site/login/components/login-mask/login-mask.component.ts +++ b/client/src/app/site/login/components/login-mask/login-mask.component.ts @@ -93,15 +93,18 @@ export class LoginMaskComponent extends BaseComponent implements OnInit, OnDestr // Get the login data. Save information to the login data service. If there is an // error, ignore it. // TODO: This has to be caught by the offline service - this.http.get(environment.urlPrefix + '/users/login/').then(response => { - if (response.info_text) { - this.installationNotice = this.matSnackBar.open(response.info_text, this.translate.instant('OK'), { - duration: 5000 - }); - } - this.loginDataService.setPrivacyPolicy(response.privacy_policy); - this.loginDataService.setLegalNotice(response.legal_notice); - }, () => {}); + this.http.get(environment.urlPrefix + '/users/login/').then( + response => { + if (response.info_text) { + this.installationNotice = this.matSnackBar.open(response.info_text, this.translate.instant('OK'), { + duration: 5000 + }); + } + this.loginDataService.setPrivacyPolicy(response.privacy_policy); + this.loginDataService.setLegalNotice(response.legal_notice); + }, + () => {} + ); } public ngOnDestroy(): void { diff --git a/client/src/app/site/login/components/reset-password-confirm/reset-password-confirm.component.spec.ts b/client/src/app/site/login/components/reset-password-confirm/reset-password-confirm.component.spec.ts index 78ef346bb..c335c3d88 100644 --- a/client/src/app/site/login/components/reset-password-confirm/reset-password-confirm.component.spec.ts +++ b/client/src/app/site/login/components/reset-password-confirm/reset-password-confirm.component.spec.ts @@ -15,11 +15,9 @@ describe('ResetPasswordConfirmComponent', () => { TestBed.configureTestingModule({ imports: [E2EImportsModule], - providers: [ - {provide: MatSnackBar, useValue: spy} - ] + providers: [{ provide: MatSnackBar, useValue: spy }] }).compileComponents(); - matSnackBarSpy = TestBed.get(MatSnackBar) + matSnackBarSpy = TestBed.get(MatSnackBar); })); beforeEach(() => { diff --git a/client/src/app/site/mediafiles/components/media-upload/media-upload.component.spec.ts b/client/src/app/site/mediafiles/components/media-upload/media-upload.component.spec.ts index 83ee843e7..f8b5235ed 100644 --- a/client/src/app/site/mediafiles/components/media-upload/media-upload.component.spec.ts +++ b/client/src/app/site/mediafiles/components/media-upload/media-upload.component.spec.ts @@ -10,7 +10,7 @@ describe('MediaUploadComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports: [E2EImportsModule], - declarations: [MediaUploadComponent], + declarations: [MediaUploadComponent] }).compileComponents(); })); diff --git a/client/src/app/site/mediafiles/components/media-upload/media-upload.component.ts b/client/src/app/site/mediafiles/components/media-upload/media-upload.component.ts index a9880798f..95fc03ba8 100644 --- a/client/src/app/site/mediafiles/components/media-upload/media-upload.component.ts +++ b/client/src/app/site/mediafiles/components/media-upload/media-upload.component.ts @@ -27,7 +27,7 @@ interface FileData { @Component({ selector: 'os-media-upload', templateUrl: './media-upload.component.html', - styleUrls: ['./media-upload.component.scss'], + styleUrls: ['./media-upload.component.scss'] }) export class MediaUploadComponent extends BaseViewComponent implements OnInit { /** @@ -168,7 +168,7 @@ export class MediaUploadComponent extends BaseViewComponent implements OnInit { filename: file.name, title: file.name, uploader_id: this.op.user.id, - hidden: false, + hidden: false }; this.uploadList.data.push(newFile); diff --git a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.scss b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.scss index 3a178a865..39234bd8f 100644 --- a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.scss +++ b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.scss @@ -26,7 +26,6 @@ white-space: pre-line !important; } - .edit-file-form { mat-form-field + mat-form-field { margin: 1em; diff --git a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.ts b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.ts index 349ea470a..455a27c84 100644 --- a/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.ts +++ b/client/src/app/site/mediafiles/components/mediafile-list/mediafile-list.component.ts @@ -16,16 +16,13 @@ import { MediafileFilterListService } from '../../services/mediafile-filter.serv import { MediafilesSortListService } from '../../services/mediafiles-sort-list.service'; import { ViewportService } from 'app/core/services/viewport.service'; - - - /** * Lists all the uploaded files. */ @Component({ selector: 'os-mediafile-list', templateUrl: './mediafile-list.component.html', - styleUrls: ['./mediafile-list.component.scss'], + styleUrls: ['./mediafile-list.component.scss'] }) export class MediafileListComponent extends ListViewBaseComponent implements OnInit { /** @@ -106,7 +103,7 @@ export class MediafileListComponent extends ListViewBaseComponent this.fileEditForm = new FormGroup({ title: new FormControl('', Validators.required), - hidden: new FormControl(), + hidden: new FormControl() }); this.filterService.filter().subscribe(filteredData => { @@ -163,7 +160,7 @@ export class MediafileListComponent extends ListViewBaseComponent } const updateData = new Mediafile({ title: this.fileEditForm.value.title, - hidden: this.fileEditForm.value.hidden, + hidden: this.fileEditForm.value.hidden }); this.repo.update(updateData, this.fileToEdit).then(() => { @@ -269,7 +266,7 @@ export class MediafileListComponent extends ListViewBaseComponent */ public getColumnDefinition(): string[] { const columns = this.vp.isMobile ? this.displayedColumnsMobile : this.displayedColumnsDesktop; - if (this.isMultiSelect){ + if (this.isMultiSelect) { return ['selector'].concat(columns); } return columns; diff --git a/client/src/app/site/mediafiles/mediafiles-routing.module.ts b/client/src/app/site/mediafiles/mediafiles-routing.module.ts index 7f8ca9cf3..f51bf2936 100644 --- a/client/src/app/site/mediafiles/mediafiles-routing.module.ts +++ b/client/src/app/site/mediafiles/mediafiles-routing.module.ts @@ -5,11 +5,11 @@ import { MediaUploadComponent } from './components/media-upload/media-upload.com const routes: Routes = [ { path: '', component: MediafileListComponent }, - { path: 'upload', component: MediaUploadComponent }, + { path: 'upload', component: MediaUploadComponent } ]; @NgModule({ imports: [RouterModule.forChild(routes)], - exports: [RouterModule], + exports: [RouterModule] }) export class MediafilesRoutingModule {} diff --git a/client/src/app/site/mediafiles/models/view-mediafile.ts b/client/src/app/site/mediafiles/models/view-mediafile.ts index 7b553bd2d..01c9a4db4 100644 --- a/client/src/app/site/mediafiles/models/view-mediafile.ts +++ b/client/src/app/site/mediafiles/models/view-mediafile.ts @@ -122,5 +122,4 @@ export class ViewMediafile extends BaseViewModel { public is_hidden(): boolean { return this._mediafile.hidden; } - } diff --git a/client/src/app/site/mediafiles/services/media-manage.service.ts b/client/src/app/site/mediafiles/services/media-manage.service.ts index 0ca6bd505..7072db41e 100644 --- a/client/src/app/site/mediafiles/services/media-manage.service.ts +++ b/client/src/app/site/mediafiles/services/media-manage.service.ts @@ -8,7 +8,7 @@ import { ViewMediafile } from '../models/view-mediafile'; * The structure of an image config object */ interface ImageConfigObject { - display_name: string + display_name: string; key: string; path: string; } @@ -17,7 +17,7 @@ interface ImageConfigObject { * The structure of a font config */ interface FontConfigObject { - display_name: string + display_name: string; default: string; path: string; } @@ -26,10 +26,10 @@ interface FontConfigObject { * Holds the required structure of the manage payload */ interface ManagementPayload { - id: number, - key?: string, - default?: string, - value: ImageConfigObject | FontConfigObject + id: number; + key?: string; + default?: string; + value: ImageConfigObject | FontConfigObject; } /** @@ -38,7 +38,7 @@ interface ManagementPayload { * Declaring images as logos (web, projector, pdf, ...) is handles here. */ @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class MediaManageService { /** @@ -61,7 +61,7 @@ export class MediaManageService { const restPath = `rest/core/config/${action}`; const config = this.getMediaConfig(action); - const path = (config.path !== file.downloadUrl) ? file.downloadUrl : ''; + const path = config.path !== file.downloadUrl ? file.downloadUrl : ''; // Create the payload that the server requires to manage a mediafile const payload: ManagementPayload = { @@ -74,7 +74,7 @@ export class MediaManageService { default: (config as FontConfigObject).default, path: path } - } + }; return this.httpService.put(restPath, payload); } diff --git a/client/src/app/site/mediafiles/services/mediafile-filter.service.ts b/client/src/app/site/mediafiles/services/mediafile-filter.service.ts index 85d6646a9..d59a8165d 100644 --- a/client/src/app/site/mediafiles/services/mediafile-filter.service.ts +++ b/client/src/app/site/mediafiles/services/mediafile-filter.service.ts @@ -1,35 +1,36 @@ -import { Injectable } from "@angular/core"; +import { Injectable } from '@angular/core'; -import { FilterListService } from "../../../core/services/filter-list.service"; -import { Mediafile } from "../../../shared/models/mediafiles/mediafile"; -import { ViewMediafile } from "../models/view-mediafile"; -import { StorageService } from "app/core/services/storage.service"; -import { MediafileRepositoryService } from "./mediafile-repository.service"; +import { FilterListService } from '../../../core/services/filter-list.service'; +import { Mediafile } from '../../../shared/models/mediafiles/mediafile'; +import { ViewMediafile } from '../models/view-mediafile'; +import { StorageService } from 'app/core/services/storage.service'; +import { MediafileRepositoryService } from './mediafile-repository.service'; @Injectable({ providedIn: 'root' }) export class MediafileFilterListService extends FilterListService { - protected name = 'Mediafile'; - public filterOptions = [{ - property: 'is_hidden', label: 'Hidden', - options: [ - { condition: true, label: 'is hidden' }, - { condition: false, label: 'is not hidden', isActive: true } - ] - } - // , { TODO: is_pdf is not yet implemented on mediafile side - // property: 'is_pdf', isActive: false, label: 'PDF', - // options: [ - // {condition: true, label: 'is a PDF'}, - // {condition: false, label: 'is not a PDF'} - // ] - // } + public filterOptions = [ + { + property: 'is_hidden', + label: 'Hidden', + options: [ + { condition: true, label: 'is hidden' }, + { condition: false, label: 'is not hidden', isActive: true } + ] + } + // , { TODO: is_pdf is not yet implemented on mediafile side + // property: 'is_pdf', isActive: false, label: 'PDF', + // options: [ + // {condition: true, label: 'is a PDF'}, + // {condition: false, label: 'is not a PDF'} + // ] + // } ]; - public constructor(store: StorageService, repo: MediafileRepositoryService){ + public constructor(store: StorageService, repo: MediafileRepositoryService) { super(store, repo); } } diff --git a/client/src/app/site/mediafiles/services/mediafile-repository.service.ts b/client/src/app/site/mediafiles/services/mediafile-repository.service.ts index 0b6e63d91..6875b51ae 100644 --- a/client/src/app/site/mediafiles/services/mediafile-repository.service.ts +++ b/client/src/app/site/mediafiles/services/mediafile-repository.service.ts @@ -15,7 +15,7 @@ import { HttpHeaders } from '@angular/common/http'; * Repository for MediaFiles */ @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class MediafileRepositoryService extends BaseRepository { /** @@ -29,7 +29,7 @@ export class MediafileRepositoryService extends BaseRepository { - public sortOptions: OsSortingDefinition = { sortProperty: 'title', sortAscending: true, diff --git a/client/src/app/site/motions/components/category-list/category-list.component.ts b/client/src/app/site/motions/components/category-list/category-list.component.ts index 50a7228b6..dc78b02b1 100644 --- a/client/src/app/site/motions/components/category-list/category-list.component.ts +++ b/client/src/app/site/motions/components/category-list/category-list.component.ts @@ -94,7 +94,7 @@ export class CategoryListComponent extends BaseViewComponent implements OnInit { * @param viewCategory */ public keyDownFunction(event: KeyboardEvent, viewCategory?: ViewCategory): void { - if (event.key === "Enter") { + if (event.key === 'Enter') { if (viewCategory) { this.onSaveButton(viewCategory); } else { diff --git a/client/src/app/site/motions/components/manage-submitters/manage-submitters.component.spec.ts b/client/src/app/site/motions/components/manage-submitters/manage-submitters.component.spec.ts index f77865183..012e6ace1 100644 --- a/client/src/app/site/motions/components/manage-submitters/manage-submitters.component.spec.ts +++ b/client/src/app/site/motions/components/manage-submitters/manage-submitters.component.spec.ts @@ -6,7 +6,6 @@ import { ViewChild, Component } from '@angular/core'; import { ViewMotion } from '../../models/view-motion'; describe('ManageSubmittersComponent', () => { - @Component({ selector: 'os-host-component', template: '' diff --git a/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.scss b/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.scss index bdd7f2572..e95d71256 100644 --- a/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.scss +++ b/client/src/app/site/motions/components/motion-change-recommendation/motion-change-recommendation.component.scss @@ -4,7 +4,7 @@ font-size: 1em; } ::ng-deep .mat-dialog-content { - overflow: visible; + overflow: visible; } .wide-form { textarea { diff --git a/client/src/app/site/motions/components/motion-detail-diff/motion-detail-diff.component.spec.ts b/client/src/app/site/motions/components/motion-detail-diff/motion-detail-diff.component.spec.ts index 58deac193..5e7d79551 100644 --- a/client/src/app/site/motions/components/motion-detail-diff/motion-detail-diff.component.spec.ts +++ b/client/src/app/site/motions/components/motion-detail-diff/motion-detail-diff.component.spec.ts @@ -9,13 +9,14 @@ import { MotionDetailOriginalChangeRecommendationsComponent } from '../motion-de @Component({ template: ` - - ` + + + ` }) class TestHostComponent { public motion: ViewMotion; diff --git a/client/src/app/site/motions/components/motion-detail-original-change-recommendations/motion-detail-original-change-recommendations.component.spec.ts b/client/src/app/site/motions/components/motion-detail-original-change-recommendations/motion-detail-original-change-recommendations.component.spec.ts index 7dba17e87..34939a96b 100644 --- a/client/src/app/site/motions/components/motion-detail-original-change-recommendations/motion-detail-original-change-recommendations.component.spec.ts +++ b/client/src/app/site/motions/components/motion-detail-original-change-recommendations/motion-detail-original-change-recommendations.component.spec.ts @@ -6,13 +6,14 @@ import { Component } from '@angular/core'; @Component({ template: ` - - ` + + + ` }) class TestHostComponent { public html = '

Test123

'; diff --git a/client/src/app/site/motions/components/motion-list/motion-list.component.ts b/client/src/app/site/motions/components/motion-list/motion-list.component.ts index 14a7a4948..d6a79eae4 100644 --- a/client/src/app/site/motions/components/motion-list/motion-list.component.ts +++ b/client/src/app/site/motions/components/motion-list/motion-list.component.ts @@ -21,7 +21,6 @@ import { ViewCategory } from '../../models/view-category'; import { ViewMotionBlock } from '../../models/view-motion-block'; import { WorkflowRepositoryService } from '../../services/workflow-repository.service'; - /** * Component that displays all the motions in a Table using DataSource. */ @@ -31,7 +30,6 @@ import { WorkflowRepositoryService } from '../../services/workflow-repository.se styleUrls: ['./motion-list.component.scss'] }) export class MotionListComponent extends ListViewBaseComponent implements OnInit { - /** * Use for minimal width. Please note the 'selector' row for multiSelect mode, * to be able to display an indicator for the state of selection @@ -52,7 +50,6 @@ export class MotionListComponent extends ListViewBaseComponent imple public statutesEnabled: boolean; public recomendationEnabled: boolean; - public tags: ViewTag[] = []; public workflows: ViewWorkflow[] = []; public categories: ViewCategory[] = []; @@ -112,11 +109,11 @@ export class MotionListComponent extends ListViewBaseComponent imple this.initTable(); this.configService.get('motions_statutes_enabled').subscribe(enabled => (this.statutesEnabled = enabled)); this.configService.get('motions_recommendations_by').subscribe(id => (this.recomendationEnabled = !!id)); - this.motionBlockRepo.getViewModelListObservable().subscribe(mBs => this.motionBlocks = mBs); - this.categoryRepo.getViewModelListObservable().subscribe(cats => this.categories = cats); - this.tagRepo.getViewModelListObservable().subscribe(tags => this.tags = tags); - this.workflowRepo.getViewModelListObservable().subscribe(wfs => this.workflows = wfs); - this.filterService.filter().subscribe(filteredData => this.sortService.data = filteredData); + this.motionBlockRepo.getViewModelListObservable().subscribe(mBs => (this.motionBlocks = mBs)); + this.categoryRepo.getViewModelListObservable().subscribe(cats => (this.categories = cats)); + this.tagRepo.getViewModelListObservable().subscribe(tags => (this.tags = tags)); + this.workflowRepo.getViewModelListObservable().subscribe(wfs => (this.workflows = wfs)); + this.filterService.filter().subscribe(filteredData => (this.sortService.data = filteredData)); this.sortService.sort().subscribe(sortedData => { this.dataSource.data = sortedData; this.checkSelection(); @@ -211,6 +208,4 @@ export class MotionListComponent extends ListViewBaseComponent imple this.raiseError(e); } } - - } diff --git a/client/src/app/site/motions/models/view-motion-block.ts b/client/src/app/site/motions/models/view-motion-block.ts index 8eb0c1aff..a47546cde 100644 --- a/client/src/app/site/motions/models/view-motion-block.ts +++ b/client/src/app/site/motions/models/view-motion-block.ts @@ -34,6 +34,6 @@ export class ViewMotionBlock extends BaseViewModel { } public getTitle(): string { - return this.title + return this.title; } } diff --git a/client/src/app/site/motions/models/view-motion.ts b/client/src/app/site/motions/models/view-motion.ts index 9ce480bac..dce532cee 100644 --- a/client/src/app/site/motions/models/view-motion.ts +++ b/client/src/app/site/motions/models/view-motion.ts @@ -226,7 +226,7 @@ export class ViewMotion extends BaseViewModel { } public get attachments_id(): number[] { - return this.motion ? this.motion.attachments_id : null + return this.motion ? this.motion.attachments_id : null; } public get attachments(): Mediafile[] { diff --git a/client/src/app/site/motions/models/view-workflow.ts b/client/src/app/site/motions/models/view-workflow.ts index 3cfd96d03..95d792256 100644 --- a/client/src/app/site/motions/models/view-workflow.ts +++ b/client/src/app/site/motions/models/view-workflow.ts @@ -10,7 +10,6 @@ import { BaseViewModel } from '../../base/base-view-model'; * @ignore */ export class ViewWorkflow extends BaseViewModel { - private _workflow: Workflow; public constructor(workflow?: Workflow) { diff --git a/client/src/app/site/motions/services/diff.service.spec.ts b/client/src/app/site/motions/services/diff.service.spec.ts index a19c638a6..4fdcc2db5 100644 --- a/client/src/app/site/motions/services/diff.service.spec.ts +++ b/client/src/app/site/motions/services/diff.service.spec.ts @@ -935,15 +935,14 @@ describe('DiffService', () => { } )); - it('works with multiple inserted paragraphs', inject( - [DiffService], - (service: DiffService) => { - const before = '

This is the text before

', - after = "

This is the text before

\n

This is one added line

\n

Another added line

"; - const diff = service.diff(before, after); - expect(diff).toBe("

This is the text before

\n

This is one added line

\n

Another added line

"); - } - )); + it('works with multiple inserted paragraphs', inject([DiffService], (service: DiffService) => { + const before = '

This is the text before

', + after = '

This is the text before

\n

This is one added line

\n

Another added line

'; + const diff = service.diff(before, after); + expect(diff).toBe( + '

This is the text before

\n

This is one added line

\n

Another added line

' + ); + })); it('does not a change in a very specific case', inject([DiffService], (service: DiffService) => { // See diff._fixWrongChangeDetection @@ -965,17 +964,21 @@ describe('DiffService', () => { })); it('does not delete a paragraph before an inserted one', inject([DiffService], (service: DiffService) => { - const inHtml = '
  • Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
  • \n' + - '
', - outHtml = '
    \n' + + const inHtml = + '
    • Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
    • \n' + + '
    ', + outHtml = + '
      \n' + '
    • Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
    • \n' + '
    • At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
    • \n' + '
    '; const diff = service.diff(inHtml, outHtml); - expect(diff).toBe('
      ' + - '
    • Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
    • ' + - '
    • At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
    • ' + - '
    '); + expect(diff).toBe( + '
      ' + + '
    • Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
    • ' + + '
    • At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
    • ' + + '
    ' + ); })); }); @@ -1053,10 +1056,16 @@ describe('DiffService', () => { )); it('works with a replaced list item', inject([DiffService], (service: DiffService) => { - const before = "
    • Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.
    ", - after = "
      \n
    • \n

      At vero eos et accusam et justo duo dolores et ea rebum.

      \n
    • \n
    \n", - expected = '
    • ' + noMarkup(1) + 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy ' + brMarkup(2) + 'eirmod tempor.
    ' + - "
      \n
    • \n

      At vero eos et accusam et justo duo dolores et ea rebum.

      \n
    • \n
    "; + const before = + '
    • Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.
    ', + after = '
      \n
    • \n

      At vero eos et accusam et justo duo dolores et ea rebum.

      \n
    • \n
    \n', + expected = + '
    • ' + + noMarkup(1) + + 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy ' + + brMarkup(2) + + 'eirmod tempor.
    ' + + '
      \n
    • \n

      At vero eos et accusam et justo duo dolores et ea rebum.

      \n
    • \n
    '; const diff = service.diff(before, after, 80, 1); const diffNormalized = service.normalizeHtmlForDiff(diff).toLowerCase(); const expectedNormalized = service.normalizeHtmlForDiff(expected).toLowerCase(); diff --git a/client/src/app/site/motions/services/linenumbering.service.spec.ts b/client/src/app/site/motions/services/linenumbering.service.spec.ts index 2ba77af7b..8ac85cf20 100644 --- a/client/src/app/site/motions/services/linenumbering.service.spec.ts +++ b/client/src/app/site/motions/services/linenumbering.service.spec.ts @@ -491,12 +491,12 @@ describe('LinenumberingService', () => { expect(service.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); })); - it('does not count within .insert nodes', inject( - [LinenumberingService], - (service: LinenumberingService) => { - const inHtml = "

    1234

    • 1234

    1234 1234

    "; + it('does not count within .insert nodes', inject([LinenumberingService], (service: LinenumberingService) => { + const inHtml = '

    1234

    • 1234

    1234 1234

    '; const outHtml = service.insertLineNumbers(inHtml, 10); - expect(outHtml).toBe('

    ' + noMarkup(1) + '1234

    • 1234

    ' + noMarkup(2) + '1234 1234

    '); + expect(outHtml).toBe( + '

    ' + noMarkup(1) + '1234

    • 1234

    ' + noMarkup(2) + '1234 1234

    ' + ); expect(service.stripLineNumbers(outHtml)).toBe(inHtml); expect(service.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); })); diff --git a/client/src/app/site/motions/services/local-permissions.service.spec.ts b/client/src/app/site/motions/services/local-permissions.service.spec.ts index 2a160f368..6376b3df1 100644 --- a/client/src/app/site/motions/services/local-permissions.service.spec.ts +++ b/client/src/app/site/motions/services/local-permissions.service.spec.ts @@ -4,10 +4,10 @@ import { LocalPermissionsService } from './local-permissions.service'; import { E2EImportsModule } from '../../../../e2e-imports.module'; describe('LocalPermissionsService', () => { - beforeEach(() => TestBed.configureTestingModule({ imports: [E2EImportsModule] })); + beforeEach(() => TestBed.configureTestingModule({ imports: [E2EImportsModule] })); - it('should be created', () => { - const service: LocalPermissionsService = TestBed.get(LocalPermissionsService); - expect(service).toBeTruthy(); - }); + it('should be created', () => { + const service: LocalPermissionsService = TestBed.get(LocalPermissionsService); + expect(service).toBeTruthy(); + }); }); diff --git a/client/src/app/site/motions/services/local-permissions.service.ts b/client/src/app/site/motions/services/local-permissions.service.ts index ec3ee9b9d..1cb655b11 100644 --- a/client/src/app/site/motions/services/local-permissions.service.ts +++ b/client/src/app/site/motions/services/local-permissions.service.ts @@ -3,20 +3,17 @@ import { OperatorService } from '../../../core/services/operator.service'; import { ViewMotion } from '../models/view-motion'; import { ConfigService } from '../../../core/services/config.service'; - @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class LocalPermissionsService { - public configMinSupporters: number; - public constructor( - private operator: OperatorService, - private configService: ConfigService, - ) { + public constructor(private operator: OperatorService, private configService: ConfigService) { // load config variables - this.configService.get('motions_min_supporters').subscribe(supporters => (this.configMinSupporters = supporters)); + this.configService + .get('motions_min_supporters') + .subscribe(supporters => (this.configMinSupporters = supporters)); } /** @@ -36,13 +33,11 @@ export class LocalPermissionsService { this.operator.hasPerms('motions.can_support') && this.configMinSupporters > 0 && motion.state.allow_support && - (motion.submitters.indexOf(this.operator.user) === -1) && - (motion.supporters.indexOf(this.operator.user) === -1)); - case 'unsupport': - return ( - motion.state.allow_support && - (motion.supporters.indexOf(this.operator.user) !== -1) + motion.submitters.indexOf(this.operator.user) === -1 && + motion.supporters.indexOf(this.operator.user) === -1 ); + case 'unsupport': + return motion.state.allow_support && motion.supporters.indexOf(this.operator.user) !== -1; default: return false; } diff --git a/client/src/app/site/motions/services/motion-block-repository.service.spec.ts b/client/src/app/site/motions/services/motion-block-repository.service.spec.ts index 880756dc5..9463afffe 100644 --- a/client/src/app/site/motions/services/motion-block-repository.service.spec.ts +++ b/client/src/app/site/motions/services/motion-block-repository.service.spec.ts @@ -4,9 +4,11 @@ import { MotionBlockRepositoryService } from './motion-block-repository.service' import { E2EImportsModule } from 'e2e-imports.module'; describe('MotionBlockRepositoryService', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [E2EImportsModule] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [E2EImportsModule] + }) + ); it('should be created', () => { const service: MotionBlockRepositoryService = TestBed.get(MotionBlockRepositoryService); diff --git a/client/src/app/site/motions/services/motion-block-repository.service.ts b/client/src/app/site/motions/services/motion-block-repository.service.ts index f507576e4..323d649ee 100644 --- a/client/src/app/site/motions/services/motion-block-repository.service.ts +++ b/client/src/app/site/motions/services/motion-block-repository.service.ts @@ -32,7 +32,7 @@ export class MotionBlockRepositoryService extends BaseRepository { }); }); - it('should be created', inject( - [MotionCsvExportService], - (service: MotionCsvExportService) => { - expect(service).toBeTruthy(); - } - )); + it('should be created', inject([MotionCsvExportService], (service: MotionCsvExportService) => { + expect(service).toBeTruthy(); + })); }); diff --git a/client/src/app/site/motions/services/motion-csv-export.service.ts b/client/src/app/site/motions/services/motion-csv-export.service.ts index c6dee2c84..2bb0fce87 100644 --- a/client/src/app/site/motions/services/motion-csv-export.service.ts +++ b/client/src/app/site/motions/services/motion-csv-export.service.ts @@ -12,7 +12,6 @@ import { ViewMotion } from '../models/view-motion'; providedIn: 'root' }) export class MotionCsvExportService { - /** * Does nothing. * @@ -51,11 +50,15 @@ export class MotionCsvExportService { this.csvExport.export( motions, [ - { label: 'Called', map: motion => motion.sort_parent_id ? '' : motion.identifierOrTitle }, - { label: 'Called with', map: motion => !motion.sort_parent_id ? '' : motion.identifierOrTitle }, + { label: 'Called', map: motion => (motion.sort_parent_id ? '' : motion.identifierOrTitle) }, + { label: 'Called with', map: motion => (!motion.sort_parent_id ? '' : motion.identifierOrTitle) }, { label: 'submitters', map: motion => motion.submitters.map(s => s.short_name).join(',') }, { property: 'title' }, - { label: 'recommendation', map: motion => motion.recommendation ? this.translate.instant(motion.recommendation.recommendation_label) : '' }, + { + label: 'recommendation', + map: motion => + motion.recommendation ? this.translate.instant(motion.recommendation.recommendation_label) : '' + }, { property: 'motion_block', label: 'Motion block' } ], this.translate.instant('Call list') + '.csv' diff --git a/client/src/app/site/motions/services/motion-filter-list.service.ts b/client/src/app/site/motions/services/motion-filter-list.service.ts index 05fe142c9..86cb24882 100644 --- a/client/src/app/site/motions/services/motion-filter-list.service.ts +++ b/client/src/app/site/motions/services/motion-filter-list.service.ts @@ -1,31 +1,27 @@ -import { Injectable } from "@angular/core"; +import { Injectable } from '@angular/core'; -import { FilterListService, OsFilter } from "../../../core/services/filter-list.service"; -import { Motion } from "../../../shared/models/motions/motion"; -import { ViewMotion } from "../models/view-motion"; -import { CategoryRepositoryService } from "./category-repository.service"; -import { WorkflowRepositoryService } from "./workflow-repository.service"; -import { StorageService } from "../../../core/services/storage.service"; -import { MotionRepositoryService } from "./motion-repository.service"; -import { MotionBlockRepositoryService } from "./motion-block-repository.service"; +import { FilterListService, OsFilter } from '../../../core/services/filter-list.service'; +import { Motion } from '../../../shared/models/motions/motion'; +import { ViewMotion } from '../models/view-motion'; +import { CategoryRepositoryService } from './category-repository.service'; +import { WorkflowRepositoryService } from './workflow-repository.service'; +import { StorageService } from '../../../core/services/storage.service'; +import { MotionRepositoryService } from './motion-repository.service'; +import { MotionBlockRepositoryService } from './motion-block-repository.service'; @Injectable({ providedIn: 'root' }) export class MotionFilterListService extends FilterListService { - protected name = 'Motion'; /** * getter for the filterOptions. Note that in this case, the options are * generated dynamically, as the options change with the datastore */ public get filterOptions(): OsFilter[] { - return [ - this.flowFilterOptions, - this.categoryFilterOptions, - this.motionBlockFilterOptions - ].concat( - this.staticFilterOptions); + return [this.flowFilterOptions, this.categoryFilterOptions, this.motionBlockFilterOptions].concat( + this.staticFilterOptions + ); } /** @@ -54,28 +50,26 @@ export class MotionFilterListService extends FilterListService { workflowOptions.push(workflow.name); workflow.states.forEach(state => { - workflowOptions.push({ - condition: state.name, - label: state.name, - isActive: false - }); + workflowOptions.push({ + condition: state.name, + label: state.name, + isActive: false + }); }); }); workflowOptions.push('-'); diff --git a/client/src/app/site/motions/services/motion-multiselect.service.ts b/client/src/app/site/motions/services/motion-multiselect.service.ts index 02401d2ca..e2a4d19d4 100644 --- a/client/src/app/site/motions/services/motion-multiselect.service.ts +++ b/client/src/app/site/motions/services/motion-multiselect.service.ts @@ -89,11 +89,10 @@ export class MotionMultiselectService { */ public async setStateOfMultiple(motions: ViewMotion[]): Promise { const title = this.translate.instant('This will set the state of all selected motions to:'); - const choices = this.workflowRepo.getWorkflowStatesForMotions(motions) - .map(workflowState => ({ - id: workflowState.id, - label: workflowState.name - })); + const choices = this.workflowRepo.getWorkflowStatesForMotions(motions).map(workflowState => ({ + id: workflowState.id, + label: workflowState.name + })); const selectedChoice = await this.choiceService.open(title, choices); if (selectedChoice) { for (const motion of motions) { @@ -117,12 +116,11 @@ export class MotionMultiselectService { label: workflowState.recommendation_label })); const clearChoice = 'Delete recommendation'; - const selectedChoice = await this.choiceService.open(title, choices, false, - null, clearChoice); + const selectedChoice = await this.choiceService.open(title, choices, false, null, clearChoice); if (selectedChoice) { const requestData = motions.map(motion => ({ id: motion.id, - recommendation: selectedChoice.action ? 0 : selectedChoice.items as number + recommendation: selectedChoice.action ? 0 : (selectedChoice.items as number) })); await this.httpService.post('/rest/motions/motion/manage_multiple_recommendation', { motions: requestData @@ -138,13 +136,19 @@ export class MotionMultiselectService { public async setCategory(motions: ViewMotion[]): Promise { const title = this.translate.instant('This will set the category of all selected motions to:'); const clearChoice = 'No category'; - const selectedChoice = await this.choiceService.open(title, this.categoryRepo.getViewModelList(), - false, null, clearChoice); + const selectedChoice = await this.choiceService.open( + title, + this.categoryRepo.getViewModelList(), + false, + null, + clearChoice + ); if (selectedChoice) { for (const motion of motions) { await this.repo.update( - {category_id: selectedChoice.action ? 0 : selectedChoice.items as number }, - motion); + { category_id: selectedChoice.action ? 0 : (selectedChoice.items as number) }, + motion + ); } } } @@ -155,10 +159,11 @@ export class MotionMultiselectService { * @param motions The motions to add/remove the sumbitters to */ public async changeSubmitters(motions: ViewMotion[]): Promise { - const title = this.translate.instant('This will add or remove the following submitters for all selected motions:'); + const title = this.translate.instant( + 'This will add or remove the following submitters for all selected motions:' + ); const choices = ['Add', 'Remove']; - const selectedChoice = await this.choiceService.open(title, - this.userRepo.getViewModelList(), true, choices); + const selectedChoice = await this.choiceService.open(title, this.userRepo.getViewModelList(), true, choices); if (selectedChoice && selectedChoice.action === choices[0]) { const requestData = motions.map(motion => { let submitterIds = [...motion.submitters_id, ...(selectedChoice.items as number[])]; @@ -190,8 +195,7 @@ export class MotionMultiselectService { public async changeTags(motions: ViewMotion[]): Promise { const title = this.translate.instant('This will add or remove the following tags for all selected motions:'); const choices = ['Add', 'Remove', 'Clear tags']; - const selectedChoice = await this.choiceService.open(title, this.tagRepo.getViewModelList(), true, - choices); + const selectedChoice = await this.choiceService.open(title, this.tagRepo.getViewModelList(), true, choices); if (selectedChoice && selectedChoice.action === choices[0]) { const requestData = motions.map(motion => { let tagIds = [...motion.tags_id, ...(selectedChoice.items as number[])]; @@ -223,7 +227,6 @@ export class MotionMultiselectService { } } - /** * Opens a dialog and changes the motionBlock for all given motions. * @@ -232,12 +235,17 @@ export class MotionMultiselectService { public async setMotionBlock(motions: ViewMotion[]): Promise { const title = this.translate.instant('This will change the motion Block for all selected motions:'); const clearChoice = 'Clear motion block'; - const selectedChoice = await this.choiceService.open(title, this.motionBlockRepo.getViewModelList(), - false, null, clearChoice); + const selectedChoice = await this.choiceService.open( + title, + this.motionBlockRepo.getViewModelList(), + false, + null, + clearChoice + ); if (selectedChoice) { for (const motion of motions) { - const blockId = selectedChoice.action ? null : selectedChoice.items as number; - await this.repo.update({motion_block_id: blockId}, motion); + const blockId = selectedChoice.action ? null : (selectedChoice.items as number); + await this.repo.update({ motion_block_id: blockId }, motion); } } } diff --git a/client/src/app/site/motions/services/motion-repository.service.ts b/client/src/app/site/motions/services/motion-repository.service.ts index 24c21b9f0..a6568c544 100644 --- a/client/src/app/site/motions/services/motion-repository.service.ts +++ b/client/src/app/site/motions/services/motion-repository.service.ts @@ -28,7 +28,7 @@ import { ViewMotionAmendedParagraph } from '../models/view-motion-amended-paragr import { CreateMotion } from '../models/create-motion'; import { MotionBlock } from 'app/shared/models/motions/motion-block'; import { Mediafile } from 'app/shared/models/mediafiles/mediafile'; -import { ConfigService } from "../../../core/services/config.service"; +import { ConfigService } from '../../../core/services/config.service'; /** * Repository Services for motions (and potentially categories) @@ -44,7 +44,6 @@ import { ConfigService } from "../../../core/services/config.service"; providedIn: 'root' }) export class MotionRepositoryService extends BaseRepository { - // The line length; comes from the config variable motions_line_length private lineLength = 90; @@ -81,9 +80,9 @@ export class MotionRepositoryService extends BaseRepository super(DS, mapperService, Motion, [Category, User, Workflow, Item, MotionBlock, Mediafile]); // load config variables - this.configService.get('motions_line_length').subscribe(lineLength => this.lineLength = lineLength); - this.configService.get('motions_default_line_numbering').subscribe(mode => this.defaultLineNumbering = mode); - this.configService.get('motions_recommendation_text_mode').subscribe(mode => this.defaultCrMode = mode); + this.configService.get('motions_line_length').subscribe(lineLength => (this.lineLength = lineLength)); + this.configService.get('motions_default_line_numbering').subscribe(mode => (this.defaultLineNumbering = mode)); + this.configService.get('motions_recommendation_text_mode').subscribe(mode => (this.defaultCrMode = mode)); } /** @@ -106,7 +105,20 @@ export class MotionRepositoryService extends BaseRepository if (workflow) { state = workflow.getStateById(motion.state_id); } - return new ViewMotion(motion, category, submitters, supporters, workflow, state, item, block, attachments, this.lineLength, this.defaultLineNumbering, this.defaultCrMode); + return new ViewMotion( + motion, + category, + submitters, + supporters, + workflow, + state, + item, + block, + attachments, + this.lineLength, + this.defaultLineNumbering, + this.defaultCrMode + ); } /** @@ -220,10 +232,12 @@ export class MotionRepositoryService extends BaseRepository */ public async setSubmitters(viewMotion: ViewMotion, submitters: User[]): Promise { const requestData = { - motions: [{ - id: viewMotion.id, - submitters: submitters.map(s => s.id), - }] + motions: [ + { + id: viewMotion.id, + submitters: submitters.map(s => s.id) + } + ] }; this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', requestData); } diff --git a/client/src/app/site/motions/services/workflow-repository.service.ts b/client/src/app/site/motions/services/workflow-repository.service.ts index efb45cd72..8a068724a 100644 --- a/client/src/app/site/motions/services/workflow-repository.service.ts +++ b/client/src/app/site/motions/services/workflow-repository.service.ts @@ -79,12 +79,13 @@ export class WorkflowRepositoryService extends BaseRepository motion.workflow_id).filter((value, index, self) => self.indexOf(value) === index); + const workflowIds = motions + .map(motion => motion.workflow_id) + .filter((value, index, self) => self.indexOf(value) === index); workflowIds.forEach(id => { const workflow = this.getViewModel(id); states = states.concat(workflow.states); }); return states; - } } diff --git a/client/src/app/site/site-routing.module.ts b/client/src/app/site/site-routing.module.ts index 94f829ac3..9575dd338 100644 --- a/client/src/app/site/site-routing.module.ts +++ b/client/src/app/site/site-routing.module.ts @@ -51,7 +51,6 @@ const routes: Routes = [ path: 'history', loadChildren: './history/history.module#HistoryModule' } - ], canActivateChild: [AuthGuard] } diff --git a/client/src/app/site/tags/components/tag-list/tag-list.component.ts b/client/src/app/site/tags/components/tag-list/tag-list.component.ts index 8e4fb91fe..78239f215 100644 --- a/client/src/app/site/tags/components/tag-list/tag-list.component.ts +++ b/client/src/app/site/tags/components/tag-list/tag-list.component.ts @@ -141,7 +141,7 @@ export class TagListComponent extends ListViewBaseComponent implements if (event.key === 'Enter' && event.shiftKey) { this.submitNewTag(); } - if (event.key === "Escape") { + if (event.key === 'Escape') { this.cancelEditing(); } } diff --git a/client/src/app/site/users/components/group-list/group-list.component.ts b/client/src/app/site/users/components/group-list/group-list.component.ts index ccfa42755..8d8217410 100644 --- a/client/src/app/site/users/components/group-list/group-list.component.ts +++ b/client/src/app/site/users/components/group-list/group-list.component.ts @@ -198,7 +198,7 @@ export class GroupListComponent extends BaseViewComponent implements OnInit { * Clicking escape while in #newGroupForm should toggle newGroup. */ public keyDownFunction(event: KeyboardEvent): void { - if (event.key === "Escape") { + if (event.key === 'Escape') { this.newGroup = false; } } diff --git a/client/src/app/site/users/components/password/password.component.ts b/client/src/app/site/users/components/password/password.component.ts index 601121bd4..2e7eb49e8 100644 --- a/client/src/app/site/users/components/password/password.component.ts +++ b/client/src/app/site/users/components/password/password.component.ts @@ -261,5 +261,4 @@ export class PasswordComponent extends BaseViewComponent implements OnInit { this.hide_user_password = !this.hide_user_password; } } - } diff --git a/client/src/app/site/users/components/user-detail/user-detail.component.ts b/client/src/app/site/users/components/user-detail/user-detail.component.ts index d95dcfbb5..79672cf31 100644 --- a/client/src/app/site/users/components/user-detail/user-detail.component.ts +++ b/client/src/app/site/users/components/user-detail/user-detail.component.ts @@ -321,7 +321,9 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit { * click on the delete user button */ public async deleteUserButton(): Promise { - const content = this.translate.instant('Do you want to delete this participant?') + `

    ${this.user.full_name}`; + const content = + this.translate.instant('Do you want to delete this participant?') + + `

    ${this.user.full_name}`; if (await this.promptService.open(this.translate.instant('Are you sure?'), content)) { this.repo.delete(this.user).then(() => this.router.navigate(['./users/']), this.raiseError); } diff --git a/client/src/app/site/users/components/user-list/user-list.component.ts b/client/src/app/site/users/components/user-list/user-list.component.ts index 4e7d9e3d3..232281f70 100644 --- a/client/src/app/site/users/components/user-list/user-list.component.ts +++ b/client/src/app/site/users/components/user-list/user-list.component.ts @@ -24,7 +24,6 @@ import { UserSortListService } from '../../services/user-sort-list.service'; styleUrls: ['./user-list.component.scss'] }) export class UserListComponent extends ListViewBaseComponent implements OnInit { - /** * /** * The usual constructor for components @@ -71,10 +70,9 @@ export class UserListComponent extends ListViewBaseComponent implement super.setTitle('Users'); this.initTable(); - this.filterService.filter().subscribe(filteredData => { - this.sortService.data = filteredData; - }); + this.sortService.data = filteredData; + }); this.sortService.sort().subscribe(sortedData => { this.dataSource.data = sortedData; this.checkSelection(); @@ -148,8 +146,7 @@ export class UserListComponent extends ListViewBaseComponent implement public async setGroupSelected(): Promise { const content = this.translate.instant('This will add or remove the following groups for all selected users:'); const choices = ['Add group(s)', 'Remove group(s)']; - const selectedChoice = await this.choiceService.open(content, - this.groupRepo.getViewModelList(), true, choices); + const selectedChoice = await this.choiceService.open(content, this.groupRepo.getViewModelList(), true, choices); if (selectedChoice) { for (const user of this.selectedRows) { const newGroups = [...user.groups_id]; @@ -187,7 +184,7 @@ export class UserListComponent extends ListViewBaseComponent implement * Uses selectedRows defined via multiSelect mode. */ public async setPresentSelected(): Promise { - const content = this.translate.instant('Set the presence status for the selected users'); + const content = this.translate.instant('Set the presence status for the selected users'); const options = ['Present', 'Not present']; const selectedChoice = await this.choiceService.open(content, null, false, options); if (selectedChoice) { @@ -203,8 +200,7 @@ export class UserListComponent extends ListViewBaseComponent implement * Uses selectedRows defined via multiSelect mode. */ public async setCommitteeSelected(): Promise { - const content = this.translate.instant( - 'Sets/unsets the committee status for the selected users'); + const content = this.translate.instant('Sets/unsets the committee status for the selected users'); const options = ['Is committee', 'Is not committee']; const selectedChoice = await this.choiceService.open(content, null, false, options); if (selectedChoice) { @@ -254,7 +250,5 @@ export class UserListComponent extends ListViewBaseComponent implement public async setPresent(viewUser: ViewUser): Promise { viewUser.user.is_present = !viewUser.user.is_present; await this.repo.update(viewUser.user, viewUser); - } - } diff --git a/client/src/app/site/users/models/view-user.ts b/client/src/app/site/users/models/view-user.ts index 432919c77..e1c854444 100644 --- a/client/src/app/site/users/models/view-user.ts +++ b/client/src/app/site/users/models/view-user.ts @@ -93,7 +93,7 @@ export class ViewUser extends BaseViewModel { } public get is_last_email_send(): boolean { - if (this.user && this.user.last_email_send){ + if (this.user && this.user.last_email_send) { return true; } return false; @@ -105,7 +105,6 @@ export class ViewUser extends BaseViewModel { this._groups = groups; } - /** * required by BaseViewModel. Don't confuse with the users title. */ diff --git a/client/src/app/site/users/services/group-repository.service.spec.ts b/client/src/app/site/users/services/group-repository.service.spec.ts index 8a7047055..7716e2e35 100644 --- a/client/src/app/site/users/services/group-repository.service.spec.ts +++ b/client/src/app/site/users/services/group-repository.service.spec.ts @@ -8,7 +8,8 @@ describe('GroupRepositoryService', () => { TestBed.configureTestingModule({ imports: [E2EImportsModule], providers: [GroupRepositoryService] - })); + }) + ); it('should be created', inject([GroupRepositoryService], (service: GroupRepositoryService) => { expect(service).toBeTruthy(); diff --git a/client/src/app/site/users/services/user-filter-list.service.ts b/client/src/app/site/users/services/user-filter-list.service.ts index 29c1de74f..7958e357a 100644 --- a/client/src/app/site/users/services/user-filter-list.service.ts +++ b/client/src/app/site/users/services/user-filter-list.service.ts @@ -1,17 +1,16 @@ -import { Injectable } from "@angular/core"; +import { Injectable } from '@angular/core'; -import { FilterListService, OsFilter } from "../../../core/services/filter-list.service"; -import { StorageService } from "../../../core/services/storage.service"; -import { User } from "../../../shared/models/users/user"; -import { ViewUser } from "../models/view-user"; -import { GroupRepositoryService } from "./group-repository.service"; -import { UserRepositoryService } from "./user-repository.service"; +import { FilterListService, OsFilter } from '../../../core/services/filter-list.service'; +import { StorageService } from '../../../core/services/storage.service'; +import { User } from '../../../shared/models/users/user'; +import { ViewUser } from '../models/view-user'; +import { GroupRepositoryService } from './group-repository.service'; +import { UserRepositoryService } from './user-repository.service'; @Injectable({ providedIn: 'root' }) export class UserFilterListService extends FilterListService { - protected name = 'User'; private userGroupFilterOptions = { @@ -26,30 +25,25 @@ export class UserFilterListService extends FilterListService { property: 'is_present', label: 'Presence', isActive: false, - options: [ - { condition: true, label: 'Is present'}, - { condition: false, label: 'Is not present'}] - }, { + options: [{ condition: true, label: 'Is present' }, { condition: false, label: 'Is not present' }] + }, + { property: 'is_active', label: 'Active', isActive: false, - options: [ - { condition: true, label: 'Is active' }, - { condition: false, label: 'Is not active' }] - }, { + options: [{ condition: true, label: 'Is active' }, { condition: false, label: 'Is not active' }] + }, + { property: 'is_committee', label: 'Committee', isActive: false, - options: [ - { condition: true, label: 'Is a committee' }, - { condition: false, label: 'Is not a committee'}] - }, { + options: [{ condition: true, label: 'Is a committee' }, { condition: false, label: 'Is not a committee' }] + }, + { property: 'is_last_email_send', label: 'Last email send', isActive: false, - options: [ - { condition: true, label: 'Got an email' }, - { condition: false, label: 'Didn\'t get an email' }] + options: [{ condition: true, label: 'Got an email' }, { condition: false, label: "Didn't get an email" }] } ]; @@ -61,8 +55,7 @@ export class UserFilterListService extends FilterListService { return [this.userGroupFilterOptions].concat(this.staticFilterOptions); } - public constructor(store: StorageService, private groupRepo: GroupRepositoryService, - repo: UserRepositoryService){ + public constructor(store: StorageService, private groupRepo: GroupRepositoryService, repo: UserRepositoryService) { super(store, repo); this.subscribeGroups(); } @@ -79,6 +72,6 @@ export class UserFilterListService extends FilterListService { }); this.userGroupFilterOptions.options = groupOptions; this.updateFilterDefinitions(this.filterOptions); - }) + }); } } diff --git a/client/src/app/site/users/services/user-repository.service.ts b/client/src/app/site/users/services/user-repository.service.ts index 86d20548f..10de5a2ee 100644 --- a/client/src/app/site/users/services/user-repository.service.ts +++ b/client/src/app/site/users/services/user-repository.service.ts @@ -120,7 +120,7 @@ export class UserRepositoryService extends BaseRepository { public async resetPassword(user: ViewUser, password: string): Promise { const path = `/rest/users/user/${user.id}/reset_password/`; await this.httpService.post(path, { password: password }); - await this.update({default_password: password}, user); + await this.update({ default_password: password }, user); } /** @@ -131,8 +131,8 @@ export class UserRepositoryService extends BaseRepository { */ public async setNewPassword(oldPassword: string, newPassword: string): Promise { await this.httpService.post(`${environment.urlPrefix}/users/setpassword/`, { - old_password: oldPassword, - new_password: newPassword + old_password: oldPassword, + new_password: newPassword }); } diff --git a/client/src/app/site/users/services/user-sort-list.service.ts b/client/src/app/site/users/services/user-sort-list.service.ts index 06fc1d469..e0152eed0 100644 --- a/client/src/app/site/users/services/user-sort-list.service.ts +++ b/client/src/app/site/users/services/user-sort-list.service.ts @@ -6,7 +6,6 @@ import { ViewUser } from '../models/view-user'; providedIn: 'root' }) export class UserSortListService extends SortListService { - public sortOptions: OsSortingDefinition = { sortProperty: 'first_name', sortAscending: true,