Merge remote-tracking branch 'origin/develop' into improvements/remove-files-on-message-deletion

pull/2116/head
Rodrigo Nascimento 10 years ago
commit 3a2d45eb3b
  1. 8
      i18n/en.i18n.json
  2. 9
      packages/rocketchat-theme/assets/stylesheets/base.less
  3. 31
      packages/rocketchat-ui-flextab/flex-tab/tabs/uploadedFilesList.coffee
  4. 3
      packages/rocketchat-ui-flextab/flex-tab/tabs/uploadedFilesList.html
  5. 1
      packages/rocketchat-ui-flextab/i18n/ar.i18n.json
  6. 1
      packages/rocketchat-ui-flextab/i18n/cs.i18n.json
  7. 1
      packages/rocketchat-ui-flextab/i18n/de.i18n.json
  8. 1
      packages/rocketchat-ui-flextab/i18n/el.i18n.json
  9. 6
      packages/rocketchat-ui-flextab/i18n/en.i18n.json
  10. 1
      packages/rocketchat-ui-flextab/i18n/es.i18n.json
  11. 1
      packages/rocketchat-ui-flextab/i18n/fa.i18n.json
  12. 1
      packages/rocketchat-ui-flextab/i18n/fi.i18n.json
  13. 1
      packages/rocketchat-ui-flextab/i18n/fr.i18n.json
  14. 1
      packages/rocketchat-ui-flextab/i18n/he.i18n.json
  15. 1
      packages/rocketchat-ui-flextab/i18n/hr.i18n.json
  16. 1
      packages/rocketchat-ui-flextab/i18n/hu.i18n.json
  17. 1
      packages/rocketchat-ui-flextab/i18n/it.i18n.json
  18. 1
      packages/rocketchat-ui-flextab/i18n/ja.i18n.json
  19. 1
      packages/rocketchat-ui-flextab/i18n/km.i18n.json
  20. 1
      packages/rocketchat-ui-flextab/i18n/ko.i18n.json
  21. 1
      packages/rocketchat-ui-flextab/i18n/ku.i18n.json
  22. 1
      packages/rocketchat-ui-flextab/i18n/lo.i18n.json
  23. 1
      packages/rocketchat-ui-flextab/i18n/ms-MY.i18n.json
  24. 1
      packages/rocketchat-ui-flextab/i18n/nl.i18n.json
  25. 1
      packages/rocketchat-ui-flextab/i18n/pl.i18n.json
  26. 1
      packages/rocketchat-ui-flextab/i18n/pt.i18n.json
  27. 1
      packages/rocketchat-ui-flextab/i18n/ro.i18n.json
  28. 1
      packages/rocketchat-ui-flextab/i18n/ru.i18n.json
  29. 1
      packages/rocketchat-ui-flextab/i18n/sq.i18n.json
  30. 1
      packages/rocketchat-ui-flextab/i18n/sr.i18n.json
  31. 1
      packages/rocketchat-ui-flextab/i18n/sv.i18n.json
  32. 1
      packages/rocketchat-ui-flextab/i18n/ta-IN.i18n.json
  33. 1
      packages/rocketchat-ui-flextab/i18n/tr.i18n.json
  34. 1
      packages/rocketchat-ui-flextab/i18n/ug.i18n.json
  35. 1
      packages/rocketchat-ui-flextab/i18n/uk.i18n.json
  36. 1
      packages/rocketchat-ui-flextab/i18n/zh.i18n.json
  37. 11
      packages/rocketchat-ui-flextab/package.js
  38. 58
      packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.coffee
  39. 14
      packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.html

@ -198,6 +198,9 @@
"Has_more" : "Has more",
"Have_your_own_chat" : "Have your own web chat. Developed with Meteor.com, the Rocket.Chat is a great solution for developers looking forward to build and evolve their own chat platform.",
"Hide_room" : "Hide room",
"Hide_Room_Warning": "Are you sure you want to hide the room \"%s\"?",
"Hide_Group_Warning": "Are you sure you want to hide the group \"%s\"?",
"Hide_Private_Warning": "Are you sure you want to hide the discussion with \"%s\"?",
"History" : "History",
"hours" : "hours",
"Incorrect_Password" : "Incorrect Password",
@ -256,6 +259,9 @@
"Layout_Sidenav_Footer" : "Side Navigation Footer",
"Layout_Sidenav_Footer_description" : "Footer size is 260 x 70px",
"Layout_Terms_of_Service" : "Terms of Service",
"Leave_Room_Warning": "Are you sure you want to leave the room \"%s\"?",
"Leave_Group_Warning": "Are you sure you want to leave the group \"%s\"?",
"Leave_Private_Warning": "Are you sure you want to leave the discussion with \"%s\"?",
"LDAP" : "LDAP",
"LDAP_Bind_Search" : "Bind Search",
"LDAP_Bind_Search_Description" : "A piece of JSON that governs bind and connection info and is of the form {\"filter\": \"(&(objectCategory=person)(objectclass=user)(memberOf=CN=ROCKET_ACCESS,CN=Users,DC=domain,DC=com)(sAMAccountName=#{username}))\", \"scope\": \"sub\", \"userDN\": \"rocket.service@domain.com\", \"password\": \"urpass\"}",
@ -611,6 +617,8 @@
"Yes" : "Yes",
"Yes_clear_all" : "Yes, clear all!",
"Yes_delete_it" : "Yes, delete it!",
"Yes_hide_it": "Yes, hide it!",
"Yes_leave_it": "Yes, leave it!",
"Yes_mute_user" : "Yes, mute user!",
"Yes_remove_user" : "Yes, remove user!",
"you_are_in_preview_mode_of" : "You are in preview mode of channel #<strong>__room_name__</strong>",

@ -3079,6 +3079,15 @@ a.github-fork {
float: left;
color: #444;
margin-right: 10px;
&.file-delete {
float: right;
padding-top: 10px;
&:hover {
color: red;
cursor: pointer;
}
}
}
}
}

@ -2,7 +2,7 @@ roomFiles = new Mongo.Collection 'room_files'
Template.uploadedFilesList.helpers
files: ->
return roomFiles.find({ rid: @rid }, { sort: {uploadedAt : -1} }).fetch()
return roomFiles.find({ rid: @rid }, { sort: { uploadedAt: -1 } }).fetch()
hasFiles: ->
return roomFiles.find({ rid: @rid }).count() > 0
@ -23,11 +23,40 @@ Template.uploadedFilesList.helpers
escapedName: ->
return s.escapeHTML @name
canDelete: ->
msg = ChatMessage.findOne { file: { _id: @_id } }
if msg
return RocketChat.authz.hasAtLeastOnePermission('delete-message', msg.rid) or RocketChat.settings.get('Message_AllowDeleting') and msg.u?._id is Meteor.userId()
Template.uploadedFilesList.events
'click .room-file-item': (e, t) ->
if $(e.currentTarget).siblings('.icon-picture').length
e.preventDefault()
'click .icon-trash': (e, t) ->
self = this
swal {
title: TAPi18n.__('Are_you_sure')
text: TAPi18n.__('You_will_not_be_able_to_recover_file')
type: 'warning'
showCancelButton: true
confirmButtonColor: '#DD6B55'
confirmButtonText: TAPi18n.__('Yes_delete_it')
cancelButtonText: TAPi18n.__('Cancel')
closeOnConfirm: false
html: false
}, ->
swal
title: TAPi18n.__('Deleted')
text: TAPi18n.__('Your_file_has_been_deleted')
type: 'success'
timer: 1000
showConfirmButton: false
msg = ChatMessage.findOne { file: { _id: self._id } }
fileCollection.remove self._id, () ->
chatMessages[Session.get('openedRoom')].deleteMsg(msg);
'scroll .content': _.throttle (e, t) ->
if e.target.scrollTop >= e.target.scrollHeight - e.target.clientHeight
t.limit.set(t.limit.get() + 50)

@ -7,6 +7,9 @@
<ul class="list clearfix lines">
{{#each files}}
<li>
{{#if canDelete}}
<i class="icon-trash file-delete"></i>
{{/if}}
<a title="{{escapedName}}" href="{{url}}" target="_blank" class="room-file-item {{customClassForFileType}}">
<i class="{{getFileIcon type}}"></i>
<p>{{name}}</p>

@ -0,0 +1,6 @@
{
"You_will_not_be_able_to_recover_file" : "You will not be able to recover this file!",
"Your_file_has_been_deleted" : "Your file has been deleted.",
"Deleted": "Deleted"
}

@ -36,4 +36,15 @@ Package.onUse(function(api) {
api.addFiles('flex-tab/tabs/uploadedFilesList.coffee', 'client');
api.addFiles('flex-tab/tabs/userInfo.coffee', 'client');
// TAPi18n
var _ = Npm.require('underscore');
var fs = Npm.require('fs');
tapi18nFiles = _.compact(_.map(fs.readdirSync('packages/rocketchat-lib/i18n'), function(filename) {
if (fs.statSync('packages/rocketchat-lib/i18n/' + filename).size > 16) {
return 'i18n/' + filename;
}
}));
api.use('tap:i18n');
api.addFiles(tapi18nFiles);
});

@ -47,18 +47,56 @@ Template.chatRoomItem.events
e.stopPropagation()
e.preventDefault()
if FlowRouter.getRouteName() in ['channel', 'group', 'direct'] and Session.get('openedRoom') is this.rid
FlowRouter.go 'home'
Meteor.call 'hideRoom', this.rid
rid = this.rid
name = this.name
warnText = switch
when this.t == 'c' then 'Hide_Room_Warning'
when this.t == 'p' then 'Hide_Group_Warning'
when this.t == 'd' then 'Hide_Private_Warning'
swal {
title: t('Are_you_sure')
text: t(warnText, name)
type: 'warning'
showCancelButton: true
confirmButtonColor: '#DD6B55'
confirmButtonText: t('Yes_hide_it')
cancelButtonText: t('Cancel')
closeOnConfirm: true
html: false
}, ->
if FlowRouter.getRouteName() in ['channel', 'group', 'direct'] and Session.get('openedRoom') is rid
FlowRouter.go 'home'
Meteor.call 'hideRoom', rid
'click .leave-room': (e) ->
e.stopPropagation()
e.preventDefault()
if FlowRouter.getRouteName() in ['channel', 'group', 'direct'] and Session.get('openedRoom') is this.rid
FlowRouter.go 'home'
RoomManager.close this.rid
Meteor.call 'leaveRoom', this.rid
rid = this.rid
name = this.name
warnText = switch
when this.t == 'c' then 'Leave_Room_Warning'
when this.t == 'p' then 'Leave_Group_Warning'
when this.t == 'd' then 'Leave_Private_Warning'
swal {
title: t('Are_you_sure')
text: t(warnText, name)
type: 'warning'
showCancelButton: true
confirmButtonColor: '#DD6B55'
confirmButtonText: t('Yes_leave_it')
cancelButtonText: t('Cancel')
closeOnConfirm: true
html: false
}, ->
if FlowRouter.getRouteName() in ['channel', 'group', 'direct'] and Session.get('openedRoom') is rid
FlowRouter.go 'home'
RoomManager.close rid
Meteor.call 'leaveRoom', rid

@ -6,12 +6,14 @@
{{/if}}
<i class="{{roomIcon}} {{userStatus}}" aria-label=""></i>
<span class='name'>{{name}}</span>
<span class='opt'>
<i class="icon-eye-off hide-room" title="{{_ "Hide_room"}}" aria-label="{{_ "Hide_room"}}"></i>
{{#if canLeave}}
<i class="octicon octicon-sign-out leave-room" title="{{_ "Leave_room"}}" aria-label="{{_ "Leave_room"}}"></i>
{{/if}}
</span>
{{#if $not unread}}
<span class='opt'>
<i class="icon-eye-off hide-room" title="{{_ "Hide_room"}}" aria-label="{{_ "Hide_room"}}"></i>
{{#if canLeave}}
<i class="octicon octicon-sign-out leave-room" title="{{_ "Leave_room"}}" aria-label="{{_ "Leave_room"}}"></i>
{{/if}}
</span>
{{/if}}
</a>
</li>
</template>

Loading…
Cancel
Save