1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-11-09 15:20:08 +00:00
Tims-Chat/templates/infoCommandSuspensionsDecorator.tpl

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
805 B
Smarty
Raw Normal View History

2018-08-16 22:30:59 +00:00
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)