A little bit of cleanup

This commit is contained in:
FinnStutzenstein 2019-01-31 08:20:15 +01:00
parent 6a60280172
commit 84974d7687
52 changed files with 181 additions and 147 deletions

View File

@ -66,7 +66,6 @@ export class ServertimeService extends OpenSlidesComponent {
private async refreshServertime(): Promise<void> {
// servertime is the time in seconds.
const servertime = await this.http.get<number>(environment.urlPrefix + '/core/servertime/');
// isNumber is deprecated: since node v4.0.0
if (typeof servertime !== 'number') {
throw new Error('The returned servertime is not a number');
}

View File

@ -77,7 +77,7 @@ export class GroupRepositoryService extends BaseRepository<ViewGroup, Group> {
* read the constants, add them to an array of apps
*/
private sortPermsPerApp(): void {
this.constants.get('permissions').subscribe(perms => {
this.constants.get<any>('permissions').subscribe(perms => {
for (const perm of perms) {
// extract the apps name
const permApp = perm.value.split('.')[0];

View File

@ -67,7 +67,7 @@ export class ConfigService extends OpenSlidesComponent {
*
* @param key The config value to get from.
*/
public get<T = any>(key: string): Observable<T> {
public get<T>(key: string): Observable<T> {
if (!this.configSubjects[key]) {
this.configSubjects[key] = new BehaviorSubject<any>(this.instant(key));
}

View File

@ -76,7 +76,7 @@ export class ConstantsService extends OpenSlidesComponent {
* Get the constant named by key.
* @param key The constant to get.
*/
public get(key: string): Observable<any> {
public get<T>(key: string): Observable<T> {
if (this.constants) {
return of(this.constants[key]);
} else {
@ -91,7 +91,7 @@ export class ConstantsService extends OpenSlidesComponent {
if (!this.pendingSubject[key]) {
this.pendingSubject[key] = new Subject<any>();
}
return this.pendingSubject[key].asObservable();
return this.pendingSubject[key].asObservable() as Observable<T>;
}
}
}

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core';
import { LinenumberingService } from './linenumbering.service';
import { ViewMotion } from '../../site/motions/models/view-motion';
import { ViewUnifiedChange } from '../../site/motions/models/view-unified-change';

View File

@ -45,10 +45,10 @@ export class LoginDataService extends OpenSlidesComponent {
public constructor(private configService: ConfigService) {
super();
this.configService.get('general_event_privacy_policy').subscribe(value => {
this.configService.get<string>('general_event_privacy_policy').subscribe(value => {
this.setPrivacyPolicy(value);
});
this.configService.get('general_event_legal_notice').subscribe(value => {
this.configService.get<string>('general_event_legal_notice').subscribe(value => {
this.setLegalNotice(value);
});
}

View File

@ -1,5 +1,7 @@
import { Injectable } from '@angular/core';
import { Observable, BehaviorSubject } from 'rxjs';
import { DataStoreService } from '../core-services/data-store.service';
import { OperatorService } from '../core-services/operator.service';
import { PersonalNote, PersonalNoteObject, PersonalNoteContent } from '../../shared/models/users/personal-note';

View File

@ -16,7 +16,7 @@ export class ThemeService {
* @param configService must be injected to get the data from server.
*/
public constructor(configService: ConfigService) {
configService.get('openslides_theme').subscribe(newTheme => {
configService.get<string>('openslides_theme').subscribe(newTheme => {
// Listen to the related event.
const classList = document.getElementsByTagName('body')[0].classList; // Get the classlist of the body.
if (newTheme) {

View File

@ -1,5 +1,5 @@
import { Output, Component, OnInit, EventEmitter, Input } from '@angular/core';
import { BaseFilterListService, OsFilterOption } from '../../../../core/ui-services/base-filter-list.service';
import { BaseFilterListService, OsFilterOption } from 'app/core/ui-services/base-filter-list.service';
/**
* Component for selecting the filters in a filter menu.

View File

@ -1,7 +1,7 @@
import { Inject, Component, OnInit } from '@angular/core';
import { MatBottomSheetRef, MAT_BOTTOM_SHEET_DATA } from '@angular/material';
import { BaseViewModel } from '../../../../site/base/base-view-model';
import { BaseSortListService } from '../../../../core/ui-services/base-sort-list.service';
import { BaseSortListService } from 'app/core/ui-services/base-sort-list.service';
/**
* A bottom sheet used for setting a list's sorting, used by {@link SortFilterBarComponent}

View File

@ -5,9 +5,9 @@ import { MatSnackBar, MatDialog } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { AgendaFilterListService } from '../../services/agenda-filter-list.service';
import { AgendaRepositoryService } from '../../../../core/repositories/agenda/agenda-repository.service';
import { AgendaRepositoryService } from 'app/core/repositories/agenda/agenda-repository.service';
import { ListViewBaseComponent } from 'app/site/base/list-view-base';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { ViewItem } from '../../models/view-item';
import { AgendaCsvExportService } from '../../services/agenda-csv-export.service';
@ -93,7 +93,7 @@ export class AgendaListComponent extends ListViewBaseComponent<ViewItem> impleme
this.checkSelection();
});
this.config
.get('agenda_enable_numbering')
.get<boolean>('agenda_enable_numbering')
.subscribe(autoNumbering => (this.isNumberingAllowed = autoNumbering));
}

View File

@ -5,7 +5,7 @@ import { MatSnackBar } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { AgendaRepositoryService } from '../../../../core/repositories/agenda/agenda-repository.service';
import { AgendaRepositoryService } from 'app/core/repositories/agenda/agenda-repository.service';
import { BaseViewComponent } from '../../../base/base-view';
import { OSTreeSortEvent } from 'app/shared/components/sorting-tree/sorting-tree.component';
import { ViewItem } from '../../models/view-item';

View File

@ -7,7 +7,7 @@ import { SpeakerState } from 'app/shared/models/agenda/speaker';
import { User } from 'app/shared/models/users/user';
import { ViewSpeaker } from '../../models/view-speaker';
import { DataStoreService } from 'app/core/core-services/data-store.service';
import { AgendaRepositoryService } from '../../../../core/repositories/agenda/agenda-repository.service';
import { AgendaRepositoryService } from 'app/core/repositories/agenda/agenda-repository.service';
import { ViewItem } from '../../models/view-item';
import { OperatorService } from 'app/core/core-services/operator.service';
import { BaseViewComponent } from 'app/site/base/base-view';

View File

@ -8,7 +8,7 @@ import { TranslateService } from '@ngx-translate/core';
import { BaseViewComponent } from 'app/site/base/base-view';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { TopicRepositoryService } from '../../../../core/repositories/agenda/topic-repository.service';
import { TopicRepositoryService } from 'app/core/repositories/agenda/topic-repository.service';
import { ViewTopic } from '../../models/view-topic';
import { OperatorService } from 'app/core/core-services/operator.service';
import { BehaviorSubject } from 'rxjs';

View File

@ -6,7 +6,7 @@ import { TranslateService } from '@ngx-translate/core'; // showcase
// for testing the DS and BaseModel
import { Config } from '../../../../shared/models/core/config';
import { DataStoreService } from '../../../../core/core-services/data-store.service';
import { DataStoreService } from 'app/core/core-services/data-store.service';
@Component({
selector: 'os-start',

View File

@ -6,7 +6,7 @@ import { Subject } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
import { ListViewBaseComponent } from 'app/site/base/list-view-base';
import { HistoryRepositoryService } from '../../../../core/repositories/history/history-repository.service';
import { HistoryRepositoryService } from 'app/core/repositories/history/history-repository.service';
import { ViewHistory } from '../../models/view-history';
/**

View File

@ -7,10 +7,10 @@ import { OperatorService } from 'app/core/core-services/operator.service';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
import { environment } from 'environments/environment';
import { OpenSlidesService } from '../../../../core/core-services/openslides.service';
import { LoginDataService } from '../../../../core/ui-services/login-data.service';
import { OpenSlidesService } from 'app/core/core-services/openslides.service';
import { LoginDataService } from 'app/core/ui-services/login-data.service';
import { ParentErrorStateMatcher } from '../../../../shared/parent-error-state-matcher';
import { HttpService } from '../../../../core/core-services/http.service';
import { HttpService } from 'app/core/core-services/http.service';
/**
* Login mask component.

View File

@ -8,7 +8,7 @@ import { TranslateService } from '@ngx-translate/core';
import { BaseViewComponent } from 'app/site/base/base-view';
import { OperatorService } from 'app/core/core-services/operator.service';
import { MediafileRepositoryService } from '../../../../core/repositories/mediafiles/mediafile-repository.service';
import { MediafileRepositoryService } from 'app/core/repositories/mediafiles/mediafile-repository.service';
/**
* To hold the structure of files to upload

View File

@ -8,8 +8,8 @@ import { TranslateService } from '@ngx-translate/core';
import { ListViewBaseComponent } from '../../../base/list-view-base';
import { ViewMediafile } from '../../models/view-mediafile';
import { MediafileRepositoryService } from '../../../../core/repositories/mediafiles/mediafile-repository.service';
import { MediaManageService } from '../../../../core/ui-services/media-manage.service';
import { MediafileRepositoryService } from 'app/core/repositories/mediafiles/mediafile-repository.service';
import { MediaManageService } from 'app/core/ui-services/media-manage.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
import { MediafileFilterListService } from '../../services/mediafile-filter.service';

View File

@ -5,11 +5,11 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatSnackBar } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { ConfigService } from '../../../../core/ui-services/config.service';
import { ConfigService } from 'app/core/ui-services/config.service';
import { MotionRepositoryService } from '../../../../core/repositories/motions/motion-repository.service';
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { ViewMotion } from '../../models/view-motion';
import { LinenumberingService } from '../../../../core/ui-services/linenumbering.service';
import { LinenumberingService } from 'app/core/ui-services/linenumbering.service';
import { BaseViewComponent } from '../../../base/base-view';
import { CreateMotion } from '../../models/create-motion';
@ -96,7 +96,7 @@ export class AmendmentCreateWizardComponent extends BaseViewComponent {
super(titleService, translate, matSnackBar);
this.createForm();
this.configService.get('motions_line_length').subscribe(lineLength => {
this.configService.get<number>('motions_line_length').subscribe(lineLength => {
this.lineLength = lineLength;
this.getMotionByUrl();
});

View File

@ -6,7 +6,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { BaseViewComponent } from '../../../base/base-view';
import { MotionRepositoryService } from '../../../../core/repositories/motions/motion-repository.service';
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { ViewMotion } from '../../models/view-motion';
import { OSTreeSortEvent } from 'app/shared/components/sorting-tree/sorting-tree.component';
import { MotionCsvExportService } from '../../services/motion-csv-export.service';

View File

@ -4,7 +4,7 @@ import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { Category } from '../../../../shared/models/motions/category';
import { CategoryRepositoryService } from '../../../../core/repositories/motions/category-repository.service';
import { CategoryRepositoryService } from 'app/core/repositories/motions/category-repository.service';
import { ViewCategory } from '../../models/view-category';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Motion } from '../../../../shared/models/motions/motion';

View File

@ -2,14 +2,14 @@ import { Component, Input } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
import { MatSnackBar } from '@angular/material';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { BaseViewComponent } from 'app/site/base/base-view';
import { DataStoreService } from 'app/core/core-services/data-store.service';
import { LocalPermissionsService } from '../../services/local-permissions.service';
import { MotionRepositoryService } from '../../../../core/repositories/motions/motion-repository.service';
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { User } from 'app/shared/models/users/user';
import { ViewMotion } from '../../models/view-motion';

View File

@ -8,8 +8,8 @@ import { TranslateService } from '@ngx-translate/core';
import { ListViewBaseComponent } from 'app/site/base/list-view-base';
import { MotionBlock } from 'app/shared/models/motions/motion-block';
import { MotionBlockRepositoryService } from '../../../../core/repositories/motions/motion-block-repository.service';
import { MotionRepositoryService } from '../../../../core/repositories/motions/motion-repository.service';
import { MotionBlockRepositoryService } from 'app/core/repositories/motions/motion-block-repository.service';
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { ViewMotionBlock } from '../../models/view-motion-block';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { ViewMotion } from '../../models/view-motion';

View File

@ -3,18 +3,18 @@ import { Router, ActivatedRoute } from '@angular/router';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Title } from '@angular/platform-browser';
import { MatSnackBar } from '@angular/material';
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
import { ListViewBaseComponent } from 'app/site/base/list-view-base';
import { MotionBlock } from 'app/shared/models/motions/motion-block';
import { Item, itemVisibilityChoices } from 'app/shared/models/agenda/item';
import { DataStoreService } from 'app/core/core-services/data-store.service';
import { MotionBlockRepositoryService } from '../../../../core/repositories/motions/motion-block-repository.service';
import { MotionBlockRepositoryService } from 'app/core/repositories/motions/motion-block-repository.service';
import { ViewMotionBlock } from '../../models/view-motion-block';
import { AgendaRepositoryService } from 'app/core/repositories/agenda/agenda-repository.service';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
/**
* Table for the motion blocks

View File

@ -6,7 +6,7 @@ import {
} from './motion-change-recommendation.component';
import { E2EImportsModule } from '../../../../../e2e-imports.module';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { ModificationType } from '../../../../core/ui-services/diff.service';
import { ModificationType } from 'app/core/ui-services/diff.service';
import { ViewChangeReco } from '../../models/view-change-reco';
describe('MotionChangeRecommendationComponent', () => {

View File

@ -1,12 +1,14 @@
import { Component, Inject } from '@angular/core';
import { LineRange, ModificationType } from '../../../../core/ui-services/diff.service';
import { MAT_DIALOG_DATA, MatDialogRef, MatSnackBar } from '@angular/material';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ChangeRecommendationRepositoryService } from '../../../../core/repositories/motions/change-recommendation-repository.service';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { LineRange, ModificationType } from 'app/core/ui-services/diff.service';
import { ChangeRecommendationRepositoryService } from 'app/core/repositories/motions/change-recommendation-repository.service';
import { ViewChangeReco } from '../../models/view-change-reco';
import { BaseViewComponent } from '../../../base/base-view';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
/**
* Data that needs to be provided to the MotionChangeRecommendationComponent dialog

View File

@ -1,18 +1,18 @@
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { MatSnackBar } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject } from 'rxjs';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { MotionCommentSection } from '../../../../shared/models/motions/motion-comment-section';
import { ViewMotionCommentSection } from '../../models/view-motion-comment-section';
import { MotionCommentSectionRepositoryService } from '../../../../core/repositories/motions/motion-comment-section-repository.service';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { BehaviorSubject } from 'rxjs';
import { MotionCommentSectionRepositoryService } from 'app/core/repositories/motions/motion-comment-section-repository.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { Group } from '../../../../shared/models/users/group';
import { DataStoreService } from '../../../../core/core-services/data-store.service';
import { DataStoreService } from 'app/core/core-services/data-store.service';
import { BaseViewComponent } from '../../../base/base-view';
import { MatSnackBar } from '@angular/material';
/**
* List view for the categories.

View File

@ -2,12 +2,13 @@ import { Component, Input } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { Title } from '@angular/platform-browser';
import { FormGroup, FormBuilder } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
import { BaseViewComponent } from '../../../../site/base/base-view';
import { MotionCommentSectionRepositoryService } from '../../../../core/repositories/motions/motion-comment-section-repository.service';
import { MotionCommentSectionRepositoryService } from 'app/core/repositories/motions/motion-comment-section-repository.service';
import { ViewMotionCommentSection } from '../../models/view-motion-comment-section';
import { OperatorService } from '../../../../core/core-services/operator.service';
import { OperatorService } from 'app/core/core-services/operator.service';
import { MotionComment } from '../../../../shared/models/motions/motion-comment';
import { ViewMotion } from '../../models/view-motion';

View File

@ -1,19 +1,21 @@
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output } from '@angular/core';
import { MatDialog, MatSnackBar } from '@angular/material';
import { DomSanitizer, SafeHtml, Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { LineNumberingMode, ViewMotion } from '../../models/view-motion';
import { ViewUnifiedChange, ViewUnifiedChangeType } from '../../models/view-unified-change';
import { DomSanitizer, SafeHtml, Title } from '@angular/platform-browser';
import { MotionRepositoryService } from '../../../../core/repositories/motions/motion-repository.service';
import { LineRange, ModificationType } from '../../../../core/ui-services/diff.service';
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { LineRange, ModificationType } from 'app/core/ui-services/diff.service';
import { ViewChangeReco } from '../../models/view-change-reco';
import { MatDialog, MatSnackBar } from '@angular/material';
import { ChangeRecommendationRepositoryService } from '../../../../core/repositories/motions/change-recommendation-repository.service';
import { ChangeRecommendationRepositoryService } from 'app/core/repositories/motions/change-recommendation-repository.service';
import {
MotionChangeRecommendationComponent,
MotionChangeRecommendationComponentData
} from '../motion-change-recommendation/motion-change-recommendation.component';
import { BaseViewComponent } from '../../../base/base-view';
import { TranslateService } from '@ngx-translate/core';
import { ConfigService } from '../../../../core/ui-services/config.service';
import { ConfigService } from 'app/core/ui-services/config.service';
/**
* This component displays the original motion text with the change blocks inside.
@ -84,8 +86,10 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
) {
super(title, translate, matSnackBar);
this.configService.get('motions_default_line_numbering').subscribe(mode => (this.lnMode = mode));
this.configService.get('motions_line_length').subscribe(lineLength => (this.lineLength = lineLength));
this.configService
.get<LineNumberingMode>('motions_default_line_numbering')
.subscribe(mode => (this.lnMode = mode));
this.configService.get<number>('motions_line_length').subscribe(lineLength => (this.lineLength = lineLength));
}
/**

View File

@ -9,9 +9,10 @@ import {
OnChanges,
SimpleChanges
} from '@angular/core';
import { LineRange, ModificationType } from '../../../../core/ui-services/diff.service';
import { LineRange, ModificationType } from 'app/core/ui-services/diff.service';
import { ViewChangeReco } from '../../models/view-change-reco';
import { OperatorService } from '../../../../core/core-services/operator.service';
import { OperatorService } from 'app/core/core-services/operator.service';
/**
* This component displays the original motion text with annotated change commendations

View File

@ -1,21 +1,22 @@
import { ActivatedRoute, Router } from '@angular/router';
import { BehaviorSubject, Subscription, ReplaySubject, concat } from 'rxjs';
import { Component, OnInit, ViewChild } from '@angular/core';
import { DomSanitizer, SafeHtml, Title } from '@angular/platform-browser';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialog, MatExpansionPanel, MatSnackBar, MatCheckboxChange } from '@angular/material';
import { take, takeWhile, multicast, skipWhile } from 'rxjs/operators';
import { BehaviorSubject, Subscription } from 'rxjs';
import { takeWhile } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
import { AgendaRepositoryService } from 'app/core/repositories/agenda/agenda-repository.service';
import { BaseViewComponent } from '../../../base/base-view';
import { Category } from '../../../../shared/models/motions/category';
import { ChangeRecommendationRepositoryService } from '../../../../core/repositories/motions/change-recommendation-repository.service';
import { ChangeRecommendationRepositoryService } from 'app/core/repositories/motions/change-recommendation-repository.service';
import { ChangeRecoMode, LineNumberingMode, ViewMotion } from '../../models/view-motion';
import { CreateMotion } from '../../models/create-motion';
import { ConfigService } from '../../../../core/ui-services/config.service';
import { DataStoreService } from '../../../../core/core-services/data-store.service';
import { DiffLinesInParagraph, LineRange } from '../../../../core/ui-services/diff.service';
import { ConfigService } from 'app/core/ui-services/config.service';
import { DataStoreService } from 'app/core/core-services/data-store.service';
import { DiffLinesInParagraph, LineRange } from 'app/core/ui-services/diff.service';
import { itemVisibilityChoices, Item } from 'app/shared/models/agenda/item';
import { LocalPermissionsService } from '../../services/local-permissions.service';
import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
@ -26,19 +27,19 @@ import {
MotionChangeRecommendationComponentData
} from '../motion-change-recommendation/motion-change-recommendation.component';
import { MotionPdfExportService } from '../../services/motion-pdf-export.service';
import { MotionRepositoryService } from '../../../../core/repositories/motions/motion-repository.service';
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { PersonalNoteContent } from 'app/shared/models/users/personal-note';
import { PersonalNoteService } from '../../../../core/ui-services/personal-note.service';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { StatuteParagraphRepositoryService } from '../../../../core/repositories/motions/statute-paragraph-repository.service';
import { PersonalNoteService } from 'app/core/ui-services/personal-note.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { StatuteParagraphRepositoryService } from 'app/core/repositories/motions/statute-paragraph-repository.service';
import { User } from '../../../../shared/models/users/user';
import { ViewChangeReco } from '../../models/view-change-reco';
import { ViewCreateMotion } from '../../models/view-create-motion';
import { ViewportService } from '../../../../core/ui-services/viewport.service';
import { ViewportService } from 'app/core/ui-services/viewport.service';
import { ViewUnifiedChange } from '../../models/view-unified-change';
import { ViewStatuteParagraph } from '../../models/view-statute-paragraph';
import { Workflow } from 'app/shared/models/motions/workflow';
import { LinenumberingService } from '../../../../core/ui-services/linenumbering.service';
import { LinenumberingService } from 'app/core/ui-services/linenumbering.service';
/**
* Component for the motion detail view
@ -375,14 +376,26 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
});
// load config variables
this.configService.get('motions_statutes_enabled').subscribe(enabled => (this.statutesEnabled = enabled));
this.configService.get('motions_reason_required').subscribe(required => (this.reasonRequired = required));
this.configService.get('motions_min_supporters').subscribe(supporters => (this.minSupporters = supporters));
this.configService.get('motions_preamble').subscribe(preamble => (this.preamble = preamble));
this.configService.get('motions_amendments_enabled').subscribe(enabled => (this.amendmentsEnabled = enabled));
this.configService.get('motions_line_length').subscribe(lineLength => (this.lineLength = lineLength));
this.configService.get('motions_default_line_numbering').subscribe(mode => (this.lnMode = mode));
this.configService.get('motions_recommendation_text_mode').subscribe(mode => (this.crMode = mode));
this.configService
.get<boolean>('motions_statutes_enabled')
.subscribe(enabled => (this.statutesEnabled = enabled));
this.configService
.get<boolean>('motions_reason_required')
.subscribe(required => (this.reasonRequired = required));
this.configService
.get<number>('motions_min_supporters')
.subscribe(supporters => (this.minSupporters = supporters));
this.configService.get<string>('motions_preamble').subscribe(preamble => (this.preamble = preamble));
this.configService
.get<boolean>('motions_amendments_enabled')
.subscribe(enabled => (this.amendmentsEnabled = enabled));
this.configService.get<number>('motions_line_length').subscribe(lineLength => (this.lineLength = lineLength));
this.configService
.get<LineNumberingMode>('motions_default_line_numbering')
.subscribe(mode => (this.lnMode = mode));
this.configService
.get<ChangeRecoMode>('motions_recommendation_text_mode')
.subscribe(mode => (this.crMode = mode));
}
/**
@ -862,21 +875,9 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
public updateWorkflowIdForCreateForm(): void {
const isStatuteAmendment = !!this.contentForm.get('statute_amendment').value;
const configKey = isStatuteAmendment ? 'motions_statute_amendments_workflow' : 'motions_workflow';
// TODO: This should just be a takeWhile(id => !id), but should include the last one where the id is OK.
// takeWhile will get a inclusive parameter, see https://github.com/ReactiveX/rxjs/pull/4115
this.configService
.get<string>(configKey)
.pipe(
multicast(
() => new ReplaySubject(1),
ids =>
ids.pipe(
takeWhile(id => !id),
o => concat(o, ids.pipe(take(1)))
)
),
skipWhile(id => !id)
)
.pipe(takeWhile(id => !id, true)) // Wait for the id to be present.
.subscribe(id => {
this.contentForm.patchValue({
workflow_id: parseInt(id as string, 10)
@ -1035,7 +1036,7 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
if (this.recommenderSubscription) {
this.recommenderSubscription.unsubscribe();
}
this.recommenderSubscription = this.configService.get(configKey).subscribe(recommender => {
this.recommenderSubscription = this.configService.get<string>(configKey).subscribe(recommender => {
this.recommender = recommender;
});
}

View File

@ -1,6 +1,7 @@
import { Component } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { BaseImportListComponent } from 'app/site/base/base-import-list';

View File

@ -5,15 +5,15 @@ import { MatSnackBar, MatDialog } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { CategoryRepositoryService } from '../../../../core/repositories/motions/category-repository.service';
import { ConfigService } from '../../../../core/ui-services/config.service';
import { CategoryRepositoryService } from 'app/core/repositories/motions/category-repository.service';
import { ConfigService } from 'app/core/ui-services/config.service';
import { ListViewBaseComponent } from '../../../base/list-view-base';
import { LocalPermissionsService } from '../../services/local-permissions.service';
import { MotionBlockRepositoryService } from '../../../../core/repositories/motions/motion-block-repository.service';
import { MotionBlockRepositoryService } from 'app/core/repositories/motions/motion-block-repository.service';
import { MotionCsvExportService } from '../../services/motion-csv-export.service';
import { MotionFilterListService } from '../../services/motion-filter-list.service';
import { MotionMultiselectService } from '../../services/motion-multiselect.service';
import { MotionRepositoryService } from '../../../../core/repositories/motions/motion-repository.service';
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { MotionSortListService } from '../../services/motion-sort-list.service';
import { TagRepositoryService } from 'app/core/repositories/tags/tag-repository.service';
import { ViewCategory } from '../../models/view-category';
@ -22,11 +22,11 @@ import { ViewMotionBlock } from '../../models/view-motion-block';
import { ViewTag } from 'app/site/tags/models/view-tag';
import { ViewWorkflow } from '../../models/view-workflow';
import { WorkflowState } from '../../../../shared/models/motions/workflow-state';
import { WorkflowRepositoryService } from '../../../../core/repositories/motions/workflow-repository.service';
import { WorkflowRepositoryService } from 'app/core/repositories/motions/workflow-repository.service';
import { MotionPdfExportService } from '../../services/motion-pdf-export.service';
import { MotionExportDialogComponent } from '../motion-export-dialog/motion-export-dialog.component';
import { OperatorService } from '../../../../core/core-services/operator.service';
import { ViewportService } from '../../../../core/ui-services/viewport.service';
import { OperatorService } from 'app/core/core-services/operator.service';
import { ViewportService } from 'app/core/ui-services/viewport.service';
/**
* Component that displays all the motions in a Table using DataSource.
@ -120,8 +120,12 @@ export class MotionListComponent extends ListViewBaseComponent<ViewMotion> imple
public ngOnInit(): void {
super.setTitle('Motions');
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.configService
.get<boolean>('motions_statutes_enabled')
.subscribe(enabled => (this.statutesEnabled = enabled));
this.configService
.get<string>('motions_recommendations_by')
.subscribe(recommender => (this.recomendationEnabled = !!recommender));
this.motionBlockRepo.getViewModelListObservable().subscribe(mBs => (this.motionBlocks = mBs));
this.categoryRepo.getViewModelListObservable().subscribe(cats => (this.categories = cats));
this.tagRepo.getViewModelListObservable().subscribe(tags => (this.tags = tags));

View File

@ -1,5 +1,6 @@
import { Component, OnInit, Input } from '@angular/core';
import { MatDialog } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { CalculablePollKey } from 'app/core/ui-services/poll.service';
@ -8,7 +9,7 @@ import { LocalPermissionsService } from '../../services/local-permissions.servic
import { MotionPoll } from 'app/shared/models/motions/motion-poll';
import { MotionPollService } from '../../services/motion-poll.service';
import { MotionPollDialogComponent } from './motion-poll-dialog.component';
import { MotionRepositoryService } from '../../../../core/repositories/motions/motion-repository.service';
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { MotionPollPdfService } from '../../services/motion-poll-pdf.service';
@ -225,7 +226,7 @@ export class MotionPollComponent implements OnInit {
* Subscribe to the available majority choices as given in the server-side constants
*/
private subscribeMajorityChoices(): void {
this.constants.get('OpenSlidesConfigVariables').subscribe(constants => {
this.constants.get<any>('OpenSlidesConfigVariables').subscribe(constants => {
const motionconst = constants.find(c => c.name === 'Motions');
if (motionconst) {
const ballotConst = motionconst.subgroups.find(s => s.name === 'Voting and ballot papers');

View File

@ -1,10 +1,11 @@
import { Component, Input, OnDestroy } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Subscription } from 'rxjs';
import { BaseComponent } from '../../../../base.component';
import { ViewMotion } from '../../models/view-motion';
import { PersonalNoteService } from '../../../../core/ui-services/personal-note.service';
import { Subscription } from 'rxjs';
import { FormBuilder, FormGroup } from '@angular/forms';
import { PersonalNoteService } from 'app/core/ui-services/personal-note.service';
import { PersonalNoteContent } from '../../../../shared/models/users/personal-note';
/**

View File

@ -1,15 +1,15 @@
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { MatSnackBar } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { StatuteParagraph } from '../../../../shared/models/motions/statute-paragraph';
import { ViewStatuteParagraph } from '../../models/view-statute-paragraph';
import { StatuteParagraphRepositoryService } from '../../../../core/repositories/motions/statute-paragraph-repository.service';
import { StatuteParagraphRepositoryService } from 'app/core/repositories/motions/statute-paragraph-repository.service';
import { BaseViewComponent } from '../../../base/base-view';
import { MatSnackBar } from '@angular/material';
import { StatuteCsvExportService } from '../../services/statute-csv-export.service';
/**

View File

@ -1,9 +1,14 @@
import { Injectable } from '@angular/core';
import { OperatorService } from '../../../core/core-services/operator.service';
import { ViewMotion } from '../models/view-motion';
import { ConfigService } from '../../../core/ui-services/config.service';
import { ConstantsService } from 'app/core/ui-services/constants.service';
interface OpenSlidesSettings {
MOTIONS_ALLOW_AMENDMENTS_OF_AMENDMENTS: boolean;
}
@Injectable({
providedIn: 'root'
})
@ -19,11 +24,13 @@ export class LocalPermissionsService {
) {
// load config variables
this.configService
.get('motions_min_supporters')
.get<number>('motions_min_supporters')
.subscribe(supporters => (this.configMinSupporters = supporters));
this.configService.get('motions_amendments_enabled').subscribe(enabled => (this.amendmentEnabled = enabled));
this.configService
.get<boolean>('motions_amendments_enabled')
.subscribe(enabled => (this.amendmentEnabled = enabled));
this.constants
.get('OpenSlidesSettings')
.get<OpenSlidesSettings>('OpenSlidesSettings')
.subscribe(settings => (this.amendmentOfAmendment = settings.MOTIONS_ALLOW_AMENDMENTS_OF_AMENDMENTS));
}
@ -85,7 +92,8 @@ export class LocalPermissionsService {
}
return (
this.operator.hasPerms('motions.can_manage') ||
(motion.state.allow_submitter_edit &&
(motion.state &&
motion.state.allow_submitter_edit &&
motion.submitters &&
motion.submitters.some(submitter => submitter.id === this.operator.user.id))
);

View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { Papa } from 'ngx-papaparse';
import { TranslateService } from '@ngx-translate/core';

View File

@ -8,6 +8,8 @@ import { MotionRepositoryService } from '../../../core/repositories/motions/moti
import { PdfDocumentService } from 'app/core/ui-services/pdf-document.service';
import { UserRepositoryService } from 'app/core/repositories/users/user-repository.service';
type BallotCountChoices = 'NUMBER_OF_DELEGATES' | 'NUMBER_OF_ALL_PARTICIPANTS' | 'CUSTOM_NUMBER';
/**
* Creates a pdf for a motion poll. Takes as input any motionPoll
* Provides the public method `printBallots(motionPoll)` which should be convenient to use.
@ -30,7 +32,7 @@ export class MotionPollPdfService {
* - NUMBER_OF_ALL_PARTICIPANTS The amount of all registered users
* - CUSTOM_NUMBER a given number of ballots (see {@link ballotCustomCount})
*/
private ballotCountSelection: 'NUMBER_OF_DELEGATES' | 'NUMBER_OF_ALL_PARTICIPANTS' | 'CUSTOM_NUMBER';
private ballotCountSelection: BallotCountChoices;
/**
* An arbitrary number of ballots to print, if {@link ballotCountSection} is set
@ -64,12 +66,14 @@ export class MotionPollPdfService {
private userRepo: UserRepositoryService,
private pdfService: PdfDocumentService
) {
this.configService.get('motions_pdf_ballot_papers_number').subscribe(count => (this.ballotCustomCount = count));
this.configService
.get('motions_pdf_ballot_papers_selection')
.get<number>('motions_pdf_ballot_papers_number')
.subscribe(count => (this.ballotCustomCount = count));
this.configService
.get<BallotCountChoices>('motions_pdf_ballot_papers_selection')
.subscribe(selection => (this.ballotCountSelection = selection));
this.configService.get('general_event_name').subscribe(name => (this.eventName = name));
this.configService.get('logo_pdf_ballot_paper').subscribe(url => {
this.configService.get<string>('general_event_name').subscribe(name => (this.eventName = name));
this.configService.get<{ path?: string }>('logo_pdf_ballot_paper').subscribe(url => {
if (url && url.path) {
if (url.path.indexOf('/') === 0) {
url.path = url.path.substr(1); // remove prepending slash

View File

@ -24,8 +24,10 @@ export class MotionPollService extends PollService {
*/
public constructor(config: ConfigService) {
super();
config.get('motions_poll_100_percent_base').subscribe(base => (this.percentBase = base));
config.get('motions_poll_default_majority_method').subscribe(method => (this.defaultMajorityMethod = method));
config.get<string>('motions_poll_100_percent_base').subscribe(base => (this.percentBase = base));
config
.get<string>('motions_poll_default_majority_method')
.subscribe(method => (this.defaultMajorityMethod = method));
}
/**

View File

@ -1,4 +1,5 @@
import { Injectable } from '@angular/core';
import { BaseSortListService, OsSortingDefinition } from '../../../core/ui-services/base-sort-list.service';
import { ViewMotion } from '../models/view-motion';

View File

@ -4,11 +4,11 @@ import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { BaseViewComponent } from '../../../base/base-view';
import { MatSnackBar } from '@angular/material';
import { ViewCountdown } from '../../models/view-countdown';
import { CountdownRepositoryService } from '../../../../core/repositories/projector/countdown-repository.service';
import { CountdownRepositoryService } from 'app/core/repositories/projector/countdown-repository.service';
import { Countdown } from 'app/shared/models/core/countdown';
/**

View File

@ -8,7 +8,7 @@ import { TranslateService } from '@ngx-translate/core';
import {
ProjectorRepositoryService,
ScrollScaleDirection
} from '../../../../core/repositories/projector/projector-repository.service';
} from 'app/core/repositories/projector/projector-repository.service';
import { ViewProjector } from '../../models/view-projector';
import { BaseViewComponent } from 'app/site/base/base-view';
import { ProjectorService } from 'app/core/core-services/projector.service';

View File

@ -5,7 +5,7 @@ import { MatSnackBar } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { ProjectorRepositoryService } from '../../../../core/repositories/projector/projector-repository.service';
import { ProjectorRepositoryService } from 'app/core/repositories/projector/projector-repository.service';
import { ViewProjector } from '../../models/view-projector';
import { Projector } from 'app/shared/models/core/projector';
import { BaseViewComponent } from 'app/site/base/base-view';

View File

@ -35,7 +35,7 @@
mat-list-item
>
<mat-icon>person</mat-icon>
<span translate>Edit profile</span>
<span translate>Show profile</span>
</a>
<a
*osPerms="'users.can_change_password'"

View File

@ -3,10 +3,10 @@ import { TranslateService } from '@ngx-translate/core';
import { Title } from '@angular/platform-browser';
import { Tag } from '../../../../shared/models/core/tag';
import { ListViewBaseComponent } from '../../../base/list-view-base';
import { TagRepositoryService } from '../../../../core/repositories/tags/tag-repository.service';
import { TagRepositoryService } from 'app/core/repositories/tags/tag-repository.service';
import { ViewTag } from '../../models/view-tag';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { MatSnackBar } from '@angular/material';
/**

View File

@ -4,11 +4,11 @@ import { TranslateService } from '@ngx-translate/core';
import { MatTableDataSource, MatSnackBar } from '@angular/material';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { GroupRepositoryService } from '../../../../core/repositories/users/group-repository.service';
import { GroupRepositoryService } from 'app/core/repositories/users/group-repository.service';
import { ViewGroup } from '../../models/view-group';
import { Group } from '../../../../shared/models/users/group';
import { BaseViewComponent } from '../../../base/base-view';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
/**
* Component for the Group-List and permission matrix

View File

@ -6,8 +6,8 @@ import { MatSnackBar } from '@angular/material';
import { Title } from '@angular/platform-browser';
import { ViewUser } from '../../models/view-user';
import { UserRepositoryService } from '../../../../core/repositories/users/user-repository.service';
import { OperatorService } from '../../../../core/core-services/operator.service';
import { UserRepositoryService } from 'app/core/repositories/users/user-repository.service';
import { OperatorService } from 'app/core/core-services/operator.service';
import { BaseViewComponent } from '../../../../site/base/base-view';
/**

View File

@ -70,7 +70,7 @@ export class PresenceDetailComponent implements OnInit {
private translate: TranslateService,
config: ConfigService
) {
config.get('users_enable_presence_view').subscribe(conf => (this._enabledInConfig = conf));
config.get<boolean>('users_enable_presence_view').subscribe(conf => (this._enabledInConfig = conf));
}
/**

View File

@ -7,13 +7,13 @@ import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { BaseViewComponent } from '../../../base/base-view';
import { DataStoreService } from '../../../../core/core-services/data-store.service';
import { DataStoreService } from 'app/core/core-services/data-store.service';
import { genders } from 'app/shared/models/users/user';
import { Group } from '../../../../shared/models/users/group';
import { OperatorService } from '../../../../core/core-services/operator.service';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { OperatorService } from 'app/core/core-services/operator.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { UserPdfExportService } from '../../services/user-pdf-export.service';
import { UserRepositoryService } from '../../../../core/repositories/users/user-repository.service';
import { UserRepositoryService } from 'app/core/repositories/users/user-repository.service';
import { ViewUser } from '../../models/view-user';
/**

View File

@ -4,18 +4,18 @@ import { Router, ActivatedRoute } from '@angular/router';
import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { ChoiceService } from '../../../../core/ui-services/choice.service';
import { ChoiceService } from 'app/core/ui-services/choice.service';
import { ConfigService } from 'app/core/ui-services/config.service';
import { CsvExportService } from '../../../../core/ui-services/csv-export.service';
import { GroupRepositoryService } from '../../../../core/repositories/users/group-repository.service';
import { CsvExportService } from 'app/core/ui-services/csv-export.service';
import { GroupRepositoryService } from 'app/core/repositories/users/group-repository.service';
import { ListViewBaseComponent } from '../../../base/list-view-base';
import { PromptService } from '../../../../core/ui-services/prompt.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { UserFilterListService } from '../../services/user-filter-list.service';
import { UserRepositoryService } from '../../../../core/repositories/users/user-repository.service';
import { UserRepositoryService } from 'app/core/repositories/users/user-repository.service';
import { UserPdfExportService } from '../../services/user-pdf-export.service';
import { UserSortListService } from '../../services/user-sort-list.service';
import { ViewportService } from '../../../../core/ui-services/viewport.service';
import { OperatorService } from '../../../../core/core-services/operator.service';
import { ViewportService } from 'app/core/ui-services/viewport.service';
import { OperatorService } from 'app/core/core-services/operator.service';
import { ViewUser } from '../../models/view-user';
/**
@ -92,7 +92,7 @@ export class UserListComponent extends ListViewBaseComponent<ViewUser> implement
// enable multiSelect for this listView
this.canMultiSelect = true;
config.get('users_enable_presence_view').subscribe(state => (this._presenceViewConfigured = state));
config.get<boolean>('users_enable_presence_view').subscribe(state => (this._presenceViewConfigured = state));
}
/**