Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close all opened rooms on logout #2498

Merged
merged 1 commit into from
Mar 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/rocketchat-ui-sidenav/side-nav/accountBox.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ Template.accountBox.events
event.preventDefault()
user = Meteor.user()
Meteor.logout ->
FlowRouter.go 'home'
RocketChat.callbacks.run 'afterLogoutCleanUp', user
Meteor.call('logoutCleanUp', user)
FlowRouter.go 'home'

'click #avatar': (event) ->
FlowRouter.go 'changeAvatar'
Expand Down
10 changes: 10 additions & 0 deletions packages/rocketchat-ui/lib/RoomManager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ RocketChat.Notifications.onUser 'message', (msg) ->
close roomToClose.typeName


closeAllRooms = ->
for key, openedRoom of openedRooms
close openedRoom.typeName


open = (typeName) ->
if not openedRooms[typeName]?
openedRooms[typeName] =
Expand Down Expand Up @@ -230,6 +235,7 @@ RocketChat.Notifications.onUser 'message', (msg) ->

open: open
close: close
closeAllRooms: closeAllRooms
init: init
getDomOfRoom: getDomOfRoom
existsDomOfRoom: existsDomOfRoom
Expand All @@ -239,3 +245,7 @@ RocketChat.Notifications.onUser 'message', (msg) ->
onlineUsers: onlineUsers
updateMentionsMarksOfRoom: updateMentionsMarksOfRoom
getOpenedRoomByRid: getOpenedRoomByRid


RocketChat.callbacks.add 'afterLogoutCleanUp', ->
RoomManager.closeAllRooms()