mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
30 lines
805 B
Smarty
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)
|