diff --git a/client/src/app/core/repositories/users/group-repository.service.ts b/client/src/app/core/repositories/users/group-repository.service.ts index a0c40a638..b7cc1cfde 100644 --- a/client/src/app/core/repositories/users/group-repository.service.ts +++ b/client/src/app/core/repositories/users/group-repository.service.ts @@ -1,6 +1,8 @@ import { Injectable } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; import { HttpService } from 'app/core/core-services/http.service'; import { RelationManagerService } from 'app/core/core-services/relation-manager.service'; @@ -194,4 +196,12 @@ export class GroupRepositoryService extends BaseRepository { + // since groups are sorted by id, default is always the first entry + return this.getViewModelListObservable().pipe(map(groups => groups.slice(1))); + } } diff --git a/client/src/app/site/config/components/config-field/config-field.component.ts b/client/src/app/site/config/components/config-field/config-field.component.ts index aa734cde1..d6df54966 100644 --- a/client/src/app/site/config/components/config-field/config-field.component.ts +++ b/client/src/app/site/config/components/config-field/config-field.component.ts @@ -147,7 +147,9 @@ export class ConfigFieldComponent extends BaseComponent implements OnInit, OnDes */ public ngOnInit(): void { // filter out empty results in group observable. We never have no groups and it messes up the settings change detection - this.groupObservable = this.groupRepo.getViewModelListObservable().pipe(filter(groups => !!groups.length)); + this.groupObservable = this.groupRepo + .getViewModelListObservableWithoutDefaultGroup() + .pipe(filter(groups => !!groups.length)); this.form = this.formBuilder.group({ value: [''], diff --git a/client/src/app/site/polls/components/poll-form/poll-form.component.ts b/client/src/app/site/polls/components/poll-form/poll-form.component.ts index 421baa499..7a6196357 100644 --- a/client/src/app/site/polls/components/poll-form/poll-form.component.ts +++ b/client/src/app/site/polls/components/poll-form/poll-form.component.ts @@ -102,7 +102,8 @@ export class PollFormComponent extends BaseViewComponent * Sets the observable for groups. */ public ngOnInit(): void { - this.groupObservable = this.groupRepo.getViewModelListObservable(); + // without default group since default cant ever vote + this.groupObservable = this.groupRepo.getViewModelListObservableWithoutDefaultGroup(); if (this.data) { if (this.data instanceof ViewAssignmentPoll) {