Skip to content

Commit

Permalink
Fix meeting history using wrong user repo (#2889)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel authored Oct 23, 2023
1 parent f59c0bf commit c1889b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions client/src/app/site/base/base-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export abstract class BaseController<V extends BaseViewModel, M extends BaseMode
return this.controllerServiceCollector.translate;
}

public get collection(): string {
return this.repo.collection;
}

public constructor(
protected controllerServiceCollector: ControllerServiceCollectorService,
protected baseModelCtor: ModelConstructor<M>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { SearchDeletedModelsPresenterService } from 'src/app/gateways/presenter/
import { AssignmentRepositoryService } from 'src/app/gateways/repositories/assignments/assignment-repository.service';
import { BaseRepository } from 'src/app/gateways/repositories/base-repository';
import { MotionRepositoryService } from 'src/app/gateways/repositories/motions';
import { UserRepositoryService } from 'src/app/gateways/repositories/users';
import {
collectionIdFromFqid,
fqidFromCollectionAndId,
Expand All @@ -29,6 +28,7 @@ import { OperatorService } from 'src/app/site/services/operator.service';
import { ViewModelStoreService } from 'src/app/site/services/view-model-store.service';

import { ViewMotionState } from '../../../motions';
import { ParticipantControllerService } from '../../../participants/services/common/participant-controller.service';
import { Position } from '../../definitions';
import { HistoryService } from '../../services/history.service';

Expand Down Expand Up @@ -93,7 +93,7 @@ export class HistoryListComponent extends BaseMeetingComponent implements OnInit

public get modelPlaceholder(): string {
const value = this.modelSelectForm.controls[`collection`].value;
if (!value) {
if (!value || !this.modelsRepoMap[value]) {
return `-`;
} else {
return this.modelsRepoMap[value].getVerboseName();
Expand All @@ -116,7 +116,7 @@ export class HistoryListComponent extends BaseMeetingComponent implements OnInit
private historyService: HistoryService,
private motionRepo: MotionRepositoryService,
private assignmentRepo: AssignmentRepositoryService,
private userRepo: UserRepositoryService,
private userRepo: ParticipantControllerService,
private collectionMapperService: CollectionMapperService
) {
super(componentServiceCollector, translate);
Expand Down Expand Up @@ -256,15 +256,13 @@ export class HistoryListComponent extends BaseMeetingComponent implements OnInit
* Serves as an entry point for the time travel routine
*/
public async onClickRow(position: Position): Promise<void> {
console.log(`click on row`, position, this.operator.hasOrganizationPermissions(OML.superadmin));
if (!this.operator.hasOrganizationPermissions(OML.superadmin)) {
return;
}

await this.historyService.enterHistoryMode(this.currentFqid, position);
const [collection, id] = collectionIdFromFqid(this.currentFqid);
const element = this.viewModelStore.get(collection, id);
console.log(`go to element:`, element);
if (element && isDetailNavigable(element)) {
this.router.navigate([element.getDetailStateUrl()]);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { HeadBarModule } from 'src/app/ui/modules/head-bar';
import { SearchSelectorModule } from 'src/app/ui/modules/search-selector';
import { PipesModule } from 'src/app/ui/pipes';

import { ParticipantCommonServiceModule } from '../participants/services/common/participant-common-service.module';
import { HistoryBannerComponent } from './components/history-banner/history-banner.component';
import { HistoryListComponent } from './components/history-list/history-list.component';
import { HistoryMainComponent } from './components/history-main/history-main.component';
Expand All @@ -39,6 +40,7 @@ import { HistoryRoutingModule } from './history-routing.module';
OpenSlidesTranslationModule.forChild(),
HeadBarModule,
SearchSelectorModule,
ParticipantCommonServiceModule,
PipesModule
],
declarations: [HistoryListComponent, HistoryMainComponent, HistoryBannerComponent]
Expand Down
6 changes: 5 additions & 1 deletion client/src/app/site/pages/meetings/view-models/view-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ export class ViewUser extends BaseViewModel<User> /* implements Searchable */ {
// ### block end.

public override getDetailStateUrl(): string {
return `/${this.getActiveMeetingId()}/users/${this.id}`;
if (this.getEnsuredActiveMeetingId && this.getEnsuredActiveMeetingId()) {
return `/${this.getEnsuredActiveMeetingId()}/participants/${this.id}`;
}

return `/accounts/${this.id}`;
}

public canVoteFor(user: ViewUser | null): boolean {
Expand Down

0 comments on commit c1889b9

Please sign in to comment.