Merge pull request #1624 from ArthurHoaro/fix/delete-redirect
Fix: redirect to referrer after bookmark deletion
This commit is contained in:
commit
47d1581850
2 changed files with 7 additions and 3 deletions
|
@ -66,8 +66,8 @@ public function deleteBookmark(Request $request, Response $response): Response
|
||||||
return $response->write('<script>self.close();</script>');
|
return $response->write('<script>self.close();</script>');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't redirect to where we were previously because the datastore has changed.
|
// Don't redirect to permalink after deletion.
|
||||||
return $this->redirect($response, '/');
|
return $this->redirectFromReferer($request, $response, ['shaare/']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -38,6 +38,8 @@ public function testDeleteSingleBookmark(): void
|
||||||
{
|
{
|
||||||
$parameters = ['id' => '123'];
|
$parameters = ['id' => '123'];
|
||||||
|
|
||||||
|
$this->container->environment['HTTP_REFERER'] = 'http://shaarli/subfolder/shaare/abcdef';
|
||||||
|
|
||||||
$request = $this->createMock(Request::class);
|
$request = $this->createMock(Request::class);
|
||||||
$request
|
$request
|
||||||
->method('getParam')
|
->method('getParam')
|
||||||
|
@ -90,6 +92,8 @@ public function testDeleteMultipleBookmarks(): void
|
||||||
{
|
{
|
||||||
$parameters = ['id' => '123 456 789'];
|
$parameters = ['id' => '123 456 789'];
|
||||||
|
|
||||||
|
$this->container->environment['HTTP_REFERER'] = 'http://shaarli/subfolder/?searchtags=abcdef';
|
||||||
|
|
||||||
$request = $this->createMock(Request::class);
|
$request = $this->createMock(Request::class);
|
||||||
$request
|
$request
|
||||||
->method('getParam')
|
->method('getParam')
|
||||||
|
@ -152,7 +156,7 @@ public function testDeleteMultipleBookmarks(): void
|
||||||
$result = $this->controller->deleteBookmark($request, $response);
|
$result = $this->controller->deleteBookmark($request, $response);
|
||||||
|
|
||||||
static::assertSame(302, $result->getStatusCode());
|
static::assertSame(302, $result->getStatusCode());
|
||||||
static::assertSame(['/subfolder/'], $result->getHeader('location'));
|
static::assertSame(['/subfolder/?searchtags=abcdef'], $result->getHeader('location'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue