From 4293f380355207f76c631df12f197ef28b0ae4e3 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 24 Mar 2020 12:47:06 -0300 Subject: [PATCH] room info --- app/lib/client/defaultTabBars.js | 2 +- app/ui/client/views/app/room.js | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/lib/client/defaultTabBars.js b/app/lib/client/defaultTabBars.js index e506e18efc728..25938ee9db4cd 100644 --- a/app/lib/client/defaultTabBars.js +++ b/app/lib/client/defaultTabBars.js @@ -33,7 +33,7 @@ TabBar.addButton({ TabBar.addButton({ groups: ['direct'], - id: 'user-info', + id: 'user-info-group', i18nTitle: 'Members_List', icon: 'team', template: 'membersList', diff --git a/app/ui/client/views/app/room.js b/app/ui/client/views/app/room.js index 1015a10977d68..08fd6adea93b3 100644 --- a/app/ui/client/views/app/room.js +++ b/app/ui/client/views/app/room.js @@ -1019,7 +1019,22 @@ Template.room.onCreated(function() { this.subscription = new ReactiveVar(); this.state = new ReactiveDict(); - this.userDetail = new ReactiveVar(FlowRouter.getParam('username')); + this.userDetail = new ReactiveVar(''); + const user = Meteor.user(); + this.autorun((c) => { + const room = Rooms.findOne({ _id: rid }, { + fields: { + t: 1, + usernames: 1, + }, + }); + + if (room.t !== 'd') { + return c.stop(); + } + + this.userDetail.set(room.usernames.filter((username) => username !== user.username)); + }); this.autorun(() => { const rid = Template.currentData()._id; @@ -1352,7 +1367,7 @@ Template.room.onRendered(function() { const room = Rooms.findOne({ _id: template.data._id }); if (!room) { - FlowRouter.go('home'); + return FlowRouter.go('home'); } callbacks.run('onRenderRoom', template, room);