1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-11-18 16:50:08 +00:00
Tims-Chat/templates/infoCommandSuspensionsDecorator.tpl
2018-08-17 00:30:59 +02:00

30 lines
805 B
Smarty

const infoCommandSuspensionDecorator = new Promise((resolve, reject) => {
require([ 'Bastelstu.be/Chat/Helper' ], Helper => {
chat.bottle.decorator('MessageType.be-bastelstu-chat-messageType-info', messageType => {
messageType.addDecorator(payload => {
if (payload.suspensions) {
payload.suspensions = payload.suspensions.map(suspension => {
suspension = Object.assign({ }, suspension)
suspension.timeElement = Helper.getTimeElementHTML(new Date(suspension.time * 1000))
if (suspension.expires) {
suspension.expiresElement = Helper.getTimeElementHTML(new Date(suspension.expires * 1000))
}
return suspension
})
}
return payload
})
return messageType
})
resolve()
}, reject)
})
promises.add(infoCommandSuspensionDecorator)