Skip to content
Snippets Groups Projects
Commit a459e640 authored by Diego Sampaio's avatar Diego Sampaio
Browse files

added back 'delete room' button - closes #2351

parent c02a703a
No related branches found
No related tags found
No related merge requests found
......@@ -2048,7 +2048,7 @@ a.github-fork {
tbody {
td {
vertical-align: middle;
padding: 0 2px;
padding: 2px 2px;
}
tr {
cursor: pointer;
......
......@@ -29,8 +29,37 @@ Template.adminRoomInfo.helpers
return t('Room_archivation_state_true')
else
return t('Room_archivation_state_false')
canDeleteRoom: ->
roomType = ChatRoom.findOne(@rid, { fields: { t: 1 }})?.t
return roomType? and RocketChat.authz.hasAtLeastOnePermission("delete-#{roomType}")
Template.adminRoomInfo.events
'click .delete': ->
swal {
title: t('Are_you_sure')
text: t('Delete_Room_Warning')
type: 'warning'
showCancelButton: true
confirmButtonColor: '#DD6B55'
confirmButtonText: t('Yes_delete_it')
cancelButtonText: t('Cancel')
closeOnConfirm: false
html: false
}, =>
swal.disableButtons()
Meteor.call 'eraseRoom', @rid, (error, result) ->
if error
toastr.error error.reason
swal.enableButtons()
else
swal
title: t('Deleted')
text: t('Room_has_been_deleted')
type: 'success'
timer: 2000
showConfirmButton: false
'keydown input[type=text]': (e, t) ->
if e.keyCode is 13
e.preventDefault()
......
......@@ -64,6 +64,11 @@
{{/each}}
</ul>
</form>
{{#if canDeleteRoom}}
<nav>
<button class='button delete red'><span><i class='icon-trash'></i> {{_ "Delete"}}</span></button>
</nav>
{{/if}}
</div>
</div>
{{/with}}
......
......@@ -28,17 +28,19 @@
<thead>
<tr>
<th width="30%">{{_ "Name"}}</th>
<th width="20%">{{_ "Type"}}</th>
<th width="20%">{{_ "Users"}}</th>
<th width="25%">{{_ "Type"}}</th>
<th width="25%">{{_ "Default"}}</th>
<th width="10%">{{_ "Msgs"}}</th>
<th width="20%">{{_ "Default"}}</th>
</tr>
</thead>
<tbody>
{{#each rooms}}
<tr class="room-info">
<td>{{name}}</td>
<td>{{usernames.length}}</td>
<td>{{type}}</td>
<td>{{usernames.length}}</td>
<td>{{msgs}}</td>
<td>{{default}}</td>
</tr>
{{/each}}
......
......@@ -18,7 +18,8 @@ Meteor.publish('adminRooms', function(filter, types, limit) {
usernames: 1,
muted: 1,
default: 1,
topic: 1
topic: 1,
msgs: 1
},
limit: limit,
sort: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment