Skip to content

Commit 1b0e903

Browse files
committed
fix(review): address PR #997 Copilot feedback on lens-aware deny redirect
Inject LensService and derive the overview path from the active lens so the access-denied redirect lands on /foundation/overview when the component is rendered under the foundation lens (/foundation/groups/...) rather than always redirecting to /project/overview — consistent with writerGuard's lens-aware denial behavior (per @copilot-pull-request-reviewer). Signed-off-by: Rashad <mrashad@contractor.linuxfoundation.org>
1 parent 4f240f6 commit 1b0e903

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/lfx-one/src/app/modules/committees/components/committee-votes/committee-votes.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { buildCommitteeCreateQueryParams } from '@lfx-one/shared/utils';
1111
import { VotesTableComponent } from '@app/modules/votes/components/votes-table/votes-table.component';
1212
import { VoteResultsDrawerComponent } from '@app/modules/votes/components/vote-results-drawer/vote-results-drawer.component';
1313
import { CommitteeService } from '@services/committee.service';
14+
import { LensService } from '@services/lens.service';
1415
import { VoteService } from '@services/vote.service';
1516
import { MessageService } from 'primeng/api';
1617
import { catchError, filter, finalize, of, switchMap, take } from 'rxjs';
@@ -24,6 +25,7 @@ import { catchError, filter, finalize, of, switchMap, take } from 'rxjs';
2425
})
2526
export class CommitteeVotesComponent {
2627
private readonly committeeService = inject(CommitteeService);
28+
private readonly lensService = inject(LensService);
2729
private readonly voteService = inject(VoteService);
2830
private readonly messageService = inject(MessageService);
2931
private readonly router = inject(Router);
@@ -47,9 +49,10 @@ export class CommitteeVotesComponent {
4749
* since the page loaded — consistent with the writerGuard denial flow. */
4850
public onCreateVote(): void {
4951
const committee = this.committee();
52+
const overviewPath = this.lensService.activeLens() === 'foundation' ? '/foundation/overview' : '/project/overview';
5053
const denyParams: Record<string, string> = { _notice: 'votes' };
5154
if (committee.project_slug) denyParams['project'] = committee.project_slug;
52-
const deny = () => void this.router.navigate(['/project/overview'], { queryParams: denyParams });
55+
const deny = () => void this.router.navigate([overviewPath], { queryParams: denyParams });
5356

5457
this.committeeService
5558
.getCommittee(committee.uid)

0 commit comments

Comments
 (0)