Skip to content
Snippets Groups Projects
Commit 14b502de authored by Diego Sampaio's avatar Diego Sampaio
Browse files

configure room routes from roomTypes API

parent 1c023137
No related branches found
No related tags found
No related merge requests found
FlowRouter.route '/channel/:name',
name: 'channel'
action: (params, queryParams) ->
Session.set 'showUserInfo'
openRoom 'c', params.name
triggersExit: [roomExit]
FlowRouter.route '/group/:name',
name: 'group'
action: (params, queryParams) ->
Session.set 'showUserInfo'
openRoom 'p', params.name
triggersExit: [roomExit]
FlowRouter.route '/direct/:username',
name: 'direct'
action: (params, queryParams) ->
Session.set 'showUserInfo', params.username
openRoom 'd', params.username
triggersExit: [roomExit]
FlowRouter.goToRoomById = (roomId) ->
subscription = ChatSubscription.findOne({rid: roomId})
if subscription?
switch subscription.t
when 'c'
FlowRouter.go 'channel', {name: subscription.name}
when 'p'
FlowRouter.go 'group', {name: subscription.name}
when 'd'
FlowRouter.go 'direct', {username: subscription.name}
FlowRouter.go RocketChat.roomTypes.getRouteLink subscription.t, subscription
......@@ -20,6 +20,12 @@ RocketChat.roomTypes = new class
roomTypesOrder.push identifier
roomTypes[identifier] = config
if config.route?.path? and config.route?.name? and config.route?.action?
FlowRouter.route config.route.path,
name: config.route.name
action: config.route.action
triggersExit: [roomExit]
###
@param roomType: room type (e.g.: c (for channels), d (for direct channels))
@param subData: the user's subscription data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment