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

Add ability to go back to lead motion after amendment create #2859

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -181,7 +181,7 @@ export class AmendmentCreateWizardComponent extends BaseMeetingComponent impleme
};

const { sequential_number } = await this.repo.createParagraphBased(motionCreate);
this.router.navigate([this.activeMeetingId, `motions`, sequential_number]);
this.router.navigate([this.activeMeetingId, `motions`, sequential_number], { replaceUrl: true, state: { canGoBack: true } });
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { filter, pairwise, startWith } from 'rxjs';
providedIn: `root`
})
export class RoutingStateService {
private skipUnsafeRouteCheck = false;
/**
* Hold the previous URL
*/
Expand All @@ -32,7 +33,7 @@ export class RoutingStateService {
* If this fails, the open nav button should be shown
*/
public get isSafePrevUrl(): boolean {
if (this._previousUrl) {
if (this._previousUrl && !this.skipUnsafeRouteCheck) {
return !this.unsafeUrls.some(unsafeUrl => this._previousUrl?.includes(unsafeUrl));
} else {
return true;
Expand Down Expand Up @@ -62,6 +63,7 @@ export class RoutingStateService {
pairwise()
)
.subscribe((event: any[]) => {
this.skipUnsafeRouteCheck = router.getCurrentNavigation()?.extras?.state[`canGoBack`] ?? false;
this._previousUrl = event[0]?.urlAfterRedirects ?? this._currentUrl;
const currentNavigationExtras = router.getCurrentNavigation()?.extras;
if (currentNavigationExtras && currentNavigationExtras.state && currentNavigationExtras.state[`back`]) {
Expand Down
Loading