Commit 389113ad authored by Sean Hammond's avatar Sean Hammond

Focus the public group on logout

parent 4aa56fdd
......@@ -4,11 +4,13 @@ angular = require('angular')
module.exports = class AppController
this.$inject = [
'$controller', '$document', '$location', '$route', '$scope', '$window',
'annotationUI', 'auth', 'drafts', 'features', 'identity', 'session'
'annotationUI', 'auth', 'drafts', 'features', 'groups', 'identity',
'session'
]
constructor: (
$controller, $document, $location, $route, $scope, $window,
annotationUI, auth, drafts, features, identity, session
annotationUI, auth, drafts, features, groups, identity,
session
) ->
$controller('AnnotationUIController', {$scope})
......@@ -42,7 +44,14 @@ module.exports = class AppController
identity.watch({
onlogin: (identity) -> $scope.auth.user = auth.userid(identity)
onlogout: -> $scope.auth.user = null
onlogout: ->
$scope.auth.user = null
# Currently all groups are private so when the user logs out they can
# no longer see the annotations from any group they may have had
# focused. Focus the public group instead, so that they see any public
# annotations in the sidebar.
groups.focus('__world__')
onready: -> $scope.auth.user ?= null
})
......
......@@ -11,6 +11,7 @@ describe 'AppController', ->
fakeLocation = null
fakeParams = null
fakeSession = null
fakeGroups = null
sandbox = null
......@@ -62,12 +63,15 @@ describe 'AppController', ->
fakeSession = {}
fakeGroups = {focus: ->}
$provide.value 'annotationUI', fakeAnnotationUI
$provide.value 'auth', fakeAuth
$provide.value 'drafts', fakeDrafts
$provide.value 'features', fakeFeatures
$provide.value 'identity', fakeIdentity
$provide.value 'session', fakeSession
$provide.value 'groups', fakeGroups
$provide.value '$location', fakeLocation
$provide.value '$routeParams', fakeParams
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment