Skip to content

Commit

Permalink
Supporting Private Group reopening (Fixes #740)
Browse files Browse the repository at this point in the history
- Adding Private Groups list ("More groups")
- Bug fixed: rocketchat_subscription "open" flag is now updated when user reopens a given room
  • Loading branch information
gmsecrieru committed Sep 11, 2015
1 parent 35786b9 commit c7b87fb
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/methods/openRoom.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Meteor.methods
openRoom: (rid) ->
if not Meteor.userId()
throw new Meteor.Error 'invalid-user', '[methods] openRoom -> Invalid user'

ChatSubscription.update
rid: rid
'u._id': Meteor.userId()
,
$set:
open: true
2 changes: 2 additions & 0 deletions client/routes/roomRoute.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ openRoom = (type, name) ->
$('.message-form .input-message').focus()
, 100

# update user's room subscription
Meteor.call 'openRoom', room._id

roomExit = ->
mainNode = document.querySelector('.main-content')
Expand Down
19 changes: 19 additions & 0 deletions client/views/app/sideNav/listPrivateGroupsFlex.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Template.listPrivateGroupsFlex.helpers
groups: ->
return ChatSubscription.find { t: { $in: ['p']}, f: { $ne: true } }, { sort: 't': 1, 'name': 1 }

Template.listPrivateGroupsFlex.events
'click header': ->
SideNav.closeFlex()

'click .channel-link': ->
SideNav.closeFlex()

'click footer .create': ->
SideNav.setFlex "createChannelFlex"

'mouseenter header': ->
SideNav.overArrow()

'mouseleave header': ->
SideNav.leaveArrow()
27 changes: 27 additions & 0 deletions client/views/app/sideNav/listPrivateGroupsFlex.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template name="listPrivateGroupsFlex">
<header>
<div>
<h4>{{_ "Private_Groups"}}</h4>
</div>
</header>
<div class="content">
<div class="wrapper">
<h4>{{_ "Private_Groups_list"}}</h4>
<ul>
{{#each groups}}
<li>
<a href="{{pathFor 'group' name=name}}" class="channel-link">
<i class="icon-lock"></i>
{{name}}
</a>
</li>
{{/each}}
</ul>
</div>
</div>
<footer>
<div>
<button class="button clean create">{{_ "Create_new"}}</button>
</div>
</footer>
</template>
4 changes: 4 additions & 0 deletions client/views/app/sideNav/privateGroups.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ Template.privateGroups.events
'click .add-room': (e, instance) ->
SideNav.setFlex "privateGroupsFlex"
SideNav.openFlex()

'click .more-groups': ->
SideNav.setFlex "listPrivateGroupsFlex"
SideNav.openFlex()
1 change: 1 addition & 0 deletions client/views/app/sideNav/privateGroups.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ <h3 class="add-room {{isActive}}">
<p class="empty">{{_ "No_groups_yet" }}</p>
{{/each}}
</ul>
<a href="" class="more more-groups">{{_ "More_groups"}} ..</a>
</template>
2 changes: 2 additions & 0 deletions i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"Meta_robots" : "Robots",
"minutes" : "minutes",
"More_channels" : "More channels",
"More_groups" : "More private groups",
"Msgs" : "Msgs",
"multi" : "multi",
"My_Account" : "My Account",
Expand Down Expand Up @@ -203,6 +204,7 @@
"Preferences_saved" : "Preferences saved",
"Privacy" : "Privacy",
"Private_Groups" : "Private Groups",
"Private_Groups_list" : "List of Private Groups",
"Profile" : "Profile",
"Profile_saved_successfully" : "Profile saved successfully",
"Proudly_developed" : "Proudly developed with Meteor",
Expand Down
2 changes: 2 additions & 0 deletions i18n/pt.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
"Meta_robots" : "Robots",
"minutes" : "minutos",
"More_channels" : "Mais canais",
"More_groups" : "Mais grupos privados",
"Msgs" : "Msgs",
"multi" : "multi",
"My_Account" : "Minha Conta",
Expand Down Expand Up @@ -198,6 +199,7 @@
"Preferences_saved" : "Preferências salvas",
"Privacy" : "Privacidade",
"Private_Groups" : "Grupos Privados",
"Private_Groups_list" : "Lista de Grupos Privados",
"Profile" : "Perfil",
"Profile_saved_successfully" : "Perfil salvo com sucesso",
"Proudly_developed" : "Orgulhosamente desenvolvido com Meteor",
Expand Down
13 changes: 13 additions & 0 deletions server/methods/openRoom.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Meteor.methods
openRoom: (rid) ->
if not Meteor.userId()
throw new Meteor.Error 'invalid-user', '[methods] openRoom -> Invalid user'

console.log '[methods] openRoom -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments

ChatSubscription.update
rid: rid
'u._id': Meteor.userId()
,
$set:
open: true

0 comments on commit c7b87fb

Please sign in to comment.