Supporting Private Group reopening (Fixes #740)

- Adding Private Groups list ("More groups")
- Bug fixed: rocketchat_subscription "open" flag is now updated when user reopens a given room
pull/765/head
George Secrieru 10 years ago
parent 35786b99ef
commit c7b87fb63b
  1. 11
      client/methods/openRoom.coffee
  2. 2
      client/routes/roomRoute.coffee
  3. 19
      client/views/app/sideNav/listPrivateGroupsFlex.coffee
  4. 27
      client/views/app/sideNav/listPrivateGroupsFlex.html
  5. 4
      client/views/app/sideNav/privateGroups.coffee
  6. 1
      client/views/app/sideNav/privateGroups.html
  7. 2
      i18n/en.i18n.json
  8. 2
      i18n/pt.i18n.json
  9. 13
      server/methods/openRoom.coffee

@ -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

@ -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')

@ -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()

@ -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>

@ -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()

@ -10,4 +10,5 @@
<p class="empty">{{_ "No_groups_yet" }}</p>
{{/each}}
</ul>
<a href="" class="more more-groups">{{_ "More_groups"}} ..</a>
</template>

@ -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",
@ -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",

@ -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",
@ -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",

@ -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
Loading…
Cancel
Save