File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ PostActionsDirective.$inject = [
4
4
'PostEndpoint' ,
5
5
'Notify' ,
6
6
'$location' ,
7
+ '$route' ,
7
8
'PostActionsService'
8
9
] ;
9
10
function PostActionsDirective (
10
11
PostEndpoint ,
11
12
Notify ,
12
13
$location ,
14
+ $route ,
13
15
PostActionsService
14
16
) {
15
17
return {
@@ -34,7 +36,15 @@ function PostActionsDirective(
34
36
35
37
function deletePost ( ) {
36
38
PostActionsService . delete ( $scope . post ) . then ( function ( ) {
37
- $location . path ( '/views/list' ) ;
39
+ // If we're not already on some top level view
40
+ if ( $location . path ( ) . indexOf ( 'views' ) === - 1 &&
41
+ $location . path ( ) . indexOf ( 'collections' ) === - 1 &&
42
+ $location . path ( ) . indexOf ( 'savedsearches' ) === - 1 ) {
43
+ // Redirect to list
44
+ $location . path ( '/views/list' ) ;
45
+ } else {
46
+ $route . reload ( ) ;
47
+ }
38
48
} ) ;
39
49
}
40
50
You can’t perform that action at this time.
0 commit comments