Skip to content
Snippets Groups Projects
Commit fd810496 authored by Matthias Brun's avatar Matthias Brun
Browse files

Add archive/unarchive button in the channel settings

parent 3c631eb2
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,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?",
......@@ -452,6 +453,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",
"Unnamed" : "Unnamed",
"Unread_Rooms" : "Unread Rooms",
"Unread_Rooms_Mode" : "Unread Rooms Mode",
......
......@@ -3,6 +3,8 @@ Template.channelSettings.helpers
return ChatRoom.findOne(@rid)?.t isnt 'd'
roomType: ->
return ChatRoom.findOne(@rid)?.t
archived: ->
return ChatRoom.findOne(@rid)?.archived
Template.channelSettings.events
'click .save': (e, t) ->
......@@ -15,6 +17,19 @@ Template.channelSettings.events
return toastr.error err.reason if err
toastr.success TAPi18n.__ 'Settings_updated'
'click .archive': (e, t) ->
e.preventDefault()
Meteor.call 'archiveRoom', t.data.rid, true, (err, results) ->
return toastr.error err.reason if err
toastr.success 'Channel 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 'Channel unarchived'
# switch room.t
# when 'c'
......
......@@ -21,5 +21,16 @@
<button class="button save"><i class="icon-send"></i><span>{{_ "Save_changes"}}</span></button>
</div>
</form>
<form>
{{#if notDirect}}
<div class="submit">
{{#if archived}}
<button class="button unarchive"><span>{{_ "Unarchive"}}</span></button>
{{else}}
<button class="button archive"><span>{{_ "Archive"}}</span></button>
{{/if}}
</div>
{{/if}}
</form>
</div>
</template>
......@@ -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
......
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'
console.log '[methods] unArchiveRoom -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
console.log '[methods] unarchiveRoom -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
room = RocketChat.models.Rooms.findOneById rid
......
......@@ -7,6 +7,7 @@ Meteor.startup ->
cl: 1
u: 1
usernames: 1
archived: 1
return RocketChat.models.Rooms.findByTypeAndName 'c', identifier, options
RocketChat.roomTypes.setPublish 'p', (identifier) ->
......@@ -17,6 +18,7 @@ Meteor.startup ->
cl: 1
u: 1
usernames: 1
archived: 1
user = RocketChat.models.Users.findOneById this.userId, fields: username: 1
return RocketChat.models.Rooms.findByTypeAndNameContainigUsername 'p', identifier, user.username, options
......
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