New status for livechat agents (#2821)
* New field to track livechat agent availability * Fix survey UI issues * Fix for Codacypull/2817/head^2
parent
3fa06449fc
commit
3bd2d95f42
@ -0,0 +1,13 @@ |
||||
Meteor.methods({ |
||||
'livechat:changeLivechatStatus'() { |
||||
if (!Meteor.userId()) { |
||||
throw new Meteor.Error('error-not-authorized', 'Not authorized'); |
||||
} |
||||
|
||||
const user = Meteor.user(); |
||||
|
||||
let newStatus = user.statusLivechat === 'available' ? 'not-available' : 'available'; |
||||
|
||||
Meteor.users.update(user._id, { $set: { statusLivechat: newStatus }}); |
||||
} |
||||
}); |
||||
@ -1,12 +1,18 @@ |
||||
<template name="livechat"> |
||||
<h3 class="{{isActive}}"> |
||||
{{_ "Livechat"}} |
||||
</h3> |
||||
<ul> |
||||
{{#each rooms}} |
||||
{{> chatRoomItem }} |
||||
{{else}} |
||||
<p class="empty">{{_ "No_livechats" }}</p> |
||||
{{/each}} |
||||
</ul> |
||||
<div class="livechat-section {{livechatAvailable}}"> |
||||
<h3 class="{{isActive}}"> |
||||
{{_ "Livechat"}} |
||||
|
||||
{{#with available}} |
||||
<i class="livechat-status {{status}} {{icon}}" title="{{hint}}"></i> |
||||
{{/with}} |
||||
</h3> |
||||
<ul> |
||||
{{#each rooms}} |
||||
{{> chatRoomItem }} |
||||
{{else}} |
||||
<p class="empty">{{_ "No_livechats" }}</p> |
||||
{{/each}} |
||||
</ul> |
||||
</div> |
||||
</template> |
||||
|
||||
@ -0,0 +1,13 @@ |
||||
Meteor.methods({ |
||||
'livechat:changeLivechatStatus'() { |
||||
if (!Meteor.userId()) { |
||||
throw new Meteor.Error('error-not-authorized', 'Not authorized'); |
||||
} |
||||
|
||||
const user = Meteor.user(); |
||||
|
||||
let newStatus = user.statusLivechat === 'available' ? 'not-available' : 'available'; |
||||
|
||||
return RocketChat.models.Users.setLivechatStatus(user._id, newStatus); |
||||
} |
||||
}); |
||||
Loading…
Reference in new issue