Merge branch 'matthias-brun-develop' into develop

pull/1738/merge
Marcelo Schmidt 10 years ago
commit f4464a1392
  1. 9
      i18n/en.i18n.json
  2. 35
      packages/rocketchat-channel-settings/client/views/channelSettings.coffee
  3. 10
      packages/rocketchat-channel-settings/client/views/channelSettings.html
  4. 1
      packages/rocketchat-channel-settings/i18n/en.i18n.json
  5. 11
      packages/rocketchat-lib/server/models/Rooms.coffee
  6. 2
      packages/rocketchat-lib/server/models/Subscriptions.coffee
  7. 3
      packages/rocketchat-ui-sidenav/side-nav/createChannelFlex.coffee
  8. 6
      packages/rocketchat-ui-sidenav/side-nav/createChannelFlex.html
  9. 2
      packages/rocketchat-ui-sidenav/side-nav/listPrivateGroupsFlex.coffee
  10. 3
      packages/rocketchat-ui-sidenav/side-nav/privateGroupsFlex.coffee
  11. 6
      packages/rocketchat-ui-sidenav/side-nav/privateGroupsFlex.html
  12. 9
      packages/rocketchat-ui/views/app/privateHistory.coffee
  13. 23
      packages/rocketchat-ui/views/app/privateHistory.html
  14. 2
      server/methods/channelsList.coffee
  15. 3
      server/methods/createChannel.coffee
  16. 3
      server/methods/createPrivateGroup.coffee
  17. 4
      server/methods/unarchiveRoom.coffee
  18. 1
      server/publications/subscription.coffee
  19. 2
      server/startup/roomPublishes.coffee

@ -76,6 +76,7 @@
"API_Embed" : "Embed",
"API_EmbedDisabledFor" : "Disable Embed for Users",
"API_EmbedDisabledFor_Description" : "Comma-separated list of usernames",
"Archive" : "Archive",
"are_also_typing" : "are also typing",
"are_typing" : "are typing",
"Are_you_sure" : "Are you sure?",
@ -139,6 +140,8 @@
"Disable_New_Room_Notification" : "Disable New Room Notification",
"Do_you_want_to_change_to_s_question" : "Do you want to change to <strong>%s</strong>?",
"Drop_to_upload_file" : "Drop to upload file",
"Duplicate_archived_channel_name" : "An archived Channel with name '%s' exists",
"Duplicate_archived_private_group_name" : "An archived Private Group with name '%s' exists",
"Duplicate_channel_name" : "A Channel with name '%s' exists",
"Duplicate_private_group_name" : "A Private Group with name '%s' exists",
"E-mail" : "E-mail",
@ -217,8 +220,8 @@
"italics" : "italics",
"join" : "Join",
"Join_the_Community" : "Join the Community",
"Jump_to_recent_messages" : "Jump to recent messages",
"Jump_to_message" : "Jump to message",
"Jump_to_recent_messages" : "Jump to recent messages",
"Language" : "Language",
"Language_Version" : "English Version",
"Last_login" : "Last login",
@ -383,10 +386,12 @@
"Restart" : "Restart",
"Restart_the_server" : "Restart the server",
"Room" : "Room",
"Room_archived" : "Room archived",
"Room_has_been_deleted" : "Room has been deleted",
"Room_name_changed" : "Room name changed to: <em>__room_name__</em> by <em>__user_by__</em>",
"Room_name_changed_successfully" : "Room name changed successfully",
"Room_not_found" : "Room not found",
"Room_unarchived" : "Room unarchived",
"Room_uploaded_file_list" : "Files List",
"Room_uploaded_file_list_empty" : "No files available.",
"room_user_count" : "%s users",
@ -426,6 +431,7 @@
"Settings_updated" : "Settings updated",
"Should_be_a_URL_of_an_image" : "Should be a URL of an image.",
"Should_exists_a_user_with_this_username" : "The user must already exist.",
"Showing_archived_results" : "<p>Showing <b>%s</b> archived results</p>",
"Showing_online_users" : "Showing <b>__total_online__</b> of __total__ users",
"Showing_results" : "<p>Showing <b>%s</b> results</p>",
"Silence" : "Silence",
@ -477,6 +483,7 @@
"There_is_no_integrations" : "There is no integrations",
"This_is_a_push_test_messsage" : "This is a push test messsage",
"True" : "True",
"Unarchive" : "Unarchive",
"Unmute_user" : "Unmute user",
"Unnamed" : "Unnamed",
"Unread_Rooms" : "Unread Rooms",

@ -19,27 +19,10 @@ Template.channelSettings.helpers
return ChatRoom.findOne(@rid)?.name
roomTopic: ->
return ChatRoom.findOne(@rid)?.topic
archived: ->
return ChatRoom.findOne(@rid)?.archived
Template.channelSettings.events
# 'click .save': (e, t) ->
# e.preventDefault()
# settings =
# roomType: t.$('input[name=roomType]:checked').val()
# roomName: t.$('input[name=roomName]').val()
# roomTopic: t.$('input[name=roomTopic]').val()
# if t.validate()
# Meteor.call 'saveRoomSettings', t.data.rid, settings, (err, results) ->
# if err
# if err.error in [ 'duplicate-name', 'name-invalid' ]
# return toastr.error TAPi18n.__(err.reason, err.details.channelName)
# if err.error is 'invalid-room-type'
# return toastr.error TAPi18n.__(err.reason, err.details.roomType)
# return toastr.error TAPi18n.__(err.reason)
# toastr.success TAPi18n.__ 'Settings_updated'
'keydown input[type=text]': (e, t) ->
if e.keyCode is 13
e.preventDefault()
@ -58,6 +41,20 @@ Template.channelSettings.events
e.preventDefault()
t.saveSetting()
'click .archive': (e, t) ->
e.preventDefault()
Meteor.call 'archiveRoom', t.data.rid, true, (err, results) ->
return toastr.error err.reason if err
toastr.success TAPi18n.__ 'Room_archived'
'click .unarchive': (e, t) ->
e.preventDefault()
Meteor.call 'unarchiveRoom', t.data.rid, true, (err, results) ->
return toastr.error err.reason if err
toastr.success TAPi18n.__ 'Room_unarchived'
Template.channelSettings.onCreated ->
@editing = new ReactiveVar

@ -43,6 +43,16 @@
</div>
</li>
{{/if}}
{{#if notDirect}}
<li>
<label>{{_ "Archive_Unarchive"}}</label>
{{#if archived}}
<button class="button unarchive"><span>{{_ "Unarchive"}}</span></button>
{{else}}
<button class="button archive"><span>{{_ "Archive"}}</span></button>
{{/if}}
</li>
{{/if}}
{{#each channelSettings}}
{{> Template.dynamic template=template data=data}}
{{/each}}

@ -1,4 +1,5 @@
{
"Archive_Unarchive": "Archive / Unarchive",
"Cancel": "Cancel",
"Channel": "Channel",
"Private_Group": "Private Group",

@ -147,6 +147,17 @@ RocketChat.models.Rooms = new class extends RocketChat.models._Base
return @find query, options
findByTypeAndArchivationState: (type, archivationstate, options) ->
query =
t: type
if archivationstate
query.archived = true
else
query.archived = { $ne: true }
return @find query, options
findByVisitorToken: (visitorToken, options) ->
query =
"v.token": visitorToken

@ -54,7 +54,7 @@ RocketChat.models.Subscriptions = new class extends RocketChat.models._Base
update =
$set:
alert: false
open: false
open: true
archived: false
return @update query, update

@ -90,6 +90,9 @@ Template.createChannelFlex.events
if err.error is 'duplicate-name'
instance.error.set({ duplicate: true })
return
if err.error is 'archived-duplicate-name'
instance.error.set({ archivedduplicate: true })
return
else
return toastr.error err.reason

@ -40,6 +40,12 @@
{{{_ "Duplicate_channel_name" roomName}}}
</div>
{{/if}}
{{#if error.archivedduplicate}}
<div class="input-error">
<strong>{{_ "Oops!"}}</strong>
{{{_ "Duplicate_archived_channel_name" roomName}}}
</div>
{{/if}}
<div class="input-submit">
<button class="button clean primary save-channel">{{_ "Save" }}</button>
<button class="button clean cancel-channel">{{_ "Cancel" }}</button>

@ -1,6 +1,6 @@
Template.listPrivateGroupsFlex.helpers
groups: ->
return ChatSubscription.find { t: { $in: ['p']}, f: { $ne: true } }, { sort: 't': 1, 'name': 1 }
return ChatSubscription.find { t: { $in: ['p']}, f: { $ne: true }, archived: { $ne: true } }, { sort: 't': 1, 'name': 1 }
Template.listPrivateGroupsFlex.events
'click header': ->

@ -85,6 +85,9 @@ Template.privateGroupsFlex.events
if err.error is 'duplicate-name'
instance.error.set({ duplicate: true })
return
if err.error is 'archived-duplicate-name'
instance.error.set({ archivedduplicate: true })
return
return toastr.error err.reason
SideNav.closeFlex()
instance.clearForm()

@ -40,6 +40,12 @@
{{{_ "Duplicate_private_group_name" groupName}}}
</div>
{{/if}}
{{#if error.archivedduplicate}}
<div class="input-error">
<strong>{{_ "Oops!"}}</strong>
{{{_ "Duplicate_archived_private_group_name" groupName}}}
</div>
{{/if}}
<div class="input-submit">
<button class="button clean primary save-pvt-group">{{_ "Save" }}</button>
<button class="button clean cancel-pvt-group">{{_ "Cancel" }}</button>

@ -1,6 +1,13 @@
Template.privateHistory.helpers
history: ->
items = ChatSubscription.find { name: { $regex: Session.get('historyFilter'), $options: 'i' }, t: { $in: ['d', 'c', 'p'] } }, {'sort': { 'ts': -1 } }
items = ChatSubscription.find { name: { $regex: Session.get('historyFilter'), $options: 'i' }, t: { $in: ['d', 'c', 'p'] }, archived: { $ne: true } }, {'sort': { 'ts': -1 } }
return {
items: items
length: items.count()
}
archivedHistory: ->
items = ChatSubscription.find { name: { $regex: Session.get('historyFilter'), $options: 'i' }, t: { $in: ['d', 'c', 'p'] }, archived: true }, {'sort': { 'ts': -1 } }
return {
items: items
length: items.count()

@ -35,6 +35,29 @@
</a>
{{/each}}
</div>
<div class="results">
{{{_ "Showing_archived_results" archivedHistory.length}}}
</div>
<div class="list">
{{#each archivedHistory.items}}
<a href="{{path}}">
<div class="info">
<h3><i class="{{type}}"></i><span class="enter-room">{{name}}</span></h3>
<ul>
{{#with roomOf rid}}
<li>{{_ "n_messages" msgs}}</li>
<li>{{_ "since_creation" creation}}</li>
{{/with}}
</ul>
</div>
<div class="status">
{{#with roomOf rid}}
<strong>{{lastMessage}}</strong>
{{/with}}
</div>
</a>
{{/each}}
</div>
</div>
</section>
</template>

@ -1,3 +1,3 @@
Meteor.methods
channelsList: ->
return { channels: RocketChat.models.Rooms.findByType('c', { sort: { msgs:-1 } }).fetch() }
return { channels: RocketChat.models.Rooms.findByTypeAndArchivationState('c', false, { sort: { msgs:-1 } }).fetch() }

@ -21,6 +21,9 @@ Meteor.methods
# avoid duplicate names
if RocketChat.models.Rooms.findOneByName name
if RocketChat.models.Rooms.findOneByName(name).archived
throw new Meteor.Error 'archived-duplicate-name'
else
throw new Meteor.Error 'duplicate-name'
# name = s.slugify name

@ -24,6 +24,9 @@ Meteor.methods
# avoid duplicate names
if RocketChat.models.Rooms.findOneByName name
if RocketChat.models.Rooms.findOneByName(name).archived
throw new Meteor.Error 'archived-duplicate-name'
else
throw new Meteor.Error 'duplicate-name'
# create new room

@ -1,7 +1,7 @@
Meteor.methods
unArchiveRoom: (rid) ->
unarchiveRoom: (rid) ->
if not Meteor.userId()
throw new Meteor.Error 'invalid-user', '[methods] unArchiveRoom -> Invalid user'
throw new Meteor.Error 'invalid-user', '[methods] unarchiveRoom -> Invalid user'
room = RocketChat.models.Rooms.findOneById rid

@ -13,3 +13,4 @@ Meteor.publish 'subscription', ->
open: 1
alert: 1
unread: 1
archived: 1

@ -9,6 +9,7 @@ Meteor.startup ->
usernames: 1
topic: 1
muted: 1
archived: 1
return RocketChat.models.Rooms.findByTypeAndName 'c', identifier, options
@ -22,6 +23,7 @@ Meteor.startup ->
usernames: 1
topic: 1
muted: 1
archived: 1
user = RocketChat.models.Users.findOneById this.userId, fields: username: 1
return RocketChat.models.Rooms.findByTypeAndNameContainigUsername 'p', identifier, user.username, options

Loading…
Cancel
Save