Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix meeting history using wrong user repo #2889

Merged
merged 5 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -87,13 +87,13 @@ export class HistoryListComponent extends BaseMeetingComponent implements OnInit
historyRepos.push(this.userRepo);
}
return historyRepos.mapToObject(repo => {
return { [repo.collection]: repo };
return { [repo.collection || repo.repo?.collection]: repo };
bastianjoel marked this conversation as resolved.
Show resolved Hide resolved
});
}

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