diff options
-rw-r--r-- | application/front/controller/admin/ShaareManageController.php | 4 | ||||
-rw-r--r-- | tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/application/front/controller/admin/ShaareManageController.php b/application/front/controller/admin/ShaareManageController.php index 7ceb8d8a..2ed298f5 100644 --- a/application/front/controller/admin/ShaareManageController.php +++ b/application/front/controller/admin/ShaareManageController.php | |||
@@ -66,8 +66,8 @@ class ShaareManageController extends ShaarliAdminController | |||
66 | return $response->write('<script>self.close();</script>'); | 66 | return $response->write('<script>self.close();</script>'); |
67 | } | 67 | } |
68 | 68 | ||
69 | // Don't redirect to where we were previously because the datastore has changed. | 69 | // Don't redirect to permalink after deletion. |
70 | return $this->redirect($response, '/'); | 70 | return $this->redirectFromReferer($request, $response, ['shaare/']); |
71 | } | 71 | } |
72 | 72 | ||
73 | /** | 73 | /** |
diff --git a/tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php b/tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php index 770a16d7..a276d988 100644 --- a/tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php +++ b/tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php | |||
@@ -38,6 +38,8 @@ class DeleteBookmarkTest extends TestCase | |||
38 | { | 38 | { |
39 | $parameters = ['id' => '123']; | 39 | $parameters = ['id' => '123']; |
40 | 40 | ||
41 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli/subfolder/shaare/abcdef'; | ||
42 | |||
41 | $request = $this->createMock(Request::class); | 43 | $request = $this->createMock(Request::class); |
42 | $request | 44 | $request |
43 | ->method('getParam') | 45 | ->method('getParam') |
@@ -90,6 +92,8 @@ class DeleteBookmarkTest extends TestCase | |||
90 | { | 92 | { |
91 | $parameters = ['id' => '123 456 789']; | 93 | $parameters = ['id' => '123 456 789']; |
92 | 94 | ||
95 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli/subfolder/?searchtags=abcdef'; | ||
96 | |||
93 | $request = $this->createMock(Request::class); | 97 | $request = $this->createMock(Request::class); |
94 | $request | 98 | $request |
95 | ->method('getParam') | 99 | ->method('getParam') |
@@ -152,7 +156,7 @@ class DeleteBookmarkTest extends TestCase | |||
152 | $result = $this->controller->deleteBookmark($request, $response); | 156 | $result = $this->controller->deleteBookmark($request, $response); |
153 | 157 | ||
154 | static::assertSame(302, $result->getStatusCode()); | 158 | static::assertSame(302, $result->getStatusCode()); |
155 | static::assertSame(['/subfolder/'], $result->getHeader('location')); | 159 | static::assertSame(['/subfolder/?searchtags=abcdef'], $result->getHeader('location')); |
156 | } | 160 | } |
157 | 161 | ||
158 | /** | 162 | /** |