mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge pull request #4369 from atmire/w2p-130679_fix-back-button-on-group-roles-page-contribute_7.6
This commit is contained in:
@@ -38,6 +38,8 @@ import { NoContent } from '../../../core/shared/NoContent.model';
|
||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock';
|
||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||
import { routeServiceStub } from '../../../shared/testing/route-service.stub';
|
||||
import { RouteService } from '../../../core/services/route.service';
|
||||
|
||||
describe('GroupFormComponent', () => {
|
||||
let component: GroupFormComponent;
|
||||
@@ -230,6 +232,7 @@ describe('GroupFormComponent', () => {
|
||||
{ provide: ActivatedRoute, useValue: route },
|
||||
{ provide: Router, useValue: router },
|
||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||
{ provide: RouteService, useValue: routeServiceStub },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
}).compileComponents();
|
||||
|
@@ -46,6 +46,7 @@ import { ValidateGroupExists } from './validators/group-exists.validator';
|
||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import { getGroupEditRoute, getGroupsRoute } from '../../access-control-routing-paths';
|
||||
import { RouteService } from '../../../core/services/route.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-group-form',
|
||||
@@ -155,6 +156,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
public requestService: RequestService,
|
||||
protected changeDetectorRef: ChangeDetectorRef,
|
||||
public dsoNameService: DSONameService,
|
||||
protected routeService: RouteService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -267,7 +269,11 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
onCancel() {
|
||||
this.groupDataService.cancelEditGroup();
|
||||
this.cancelForm.emit();
|
||||
void this.router.navigate([getGroupsRoute()]);
|
||||
this.routeService.getPreviousUrl().pipe(
|
||||
take(1),
|
||||
).subscribe((previousURL) => {
|
||||
void this.router.navigate([previousURL && previousURL.trim().length > 0 ? previousURL : getGroupsRoute()]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user