Render ban events
This commit is contained in:
parent
e6fc1de276
commit
b4dfefbac9
1 changed files with 19 additions and 1 deletions
|
@ -96,6 +96,24 @@ class LeaveEvent extends MembershipEvent {
|
|||
}
|
||||
}
|
||||
|
||||
class BanEvent extends MembershipEvent {
|
||||
static canRender(eventData) {
|
||||
return super.canRender(eventData) && eventData.content.membership === "ban"
|
||||
}
|
||||
|
||||
render() {
|
||||
let message =
|
||||
` left (banned by ${this.data.sender}`
|
||||
+ (this.data.content.reason ? `, reason: ${this.data.content.reason}` : "")
|
||||
+ ")"
|
||||
this.renderInner("static/leave-event.svg", [
|
||||
this.smallAvatar,
|
||||
this.senderName,
|
||||
message
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
class UnknownMembership extends MembershipEvent {
|
||||
render() {
|
||||
this.renderInner("", [
|
||||
|
@ -106,4 +124,4 @@ class UnknownMembership extends MembershipEvent {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = [JoinedEvent, InvitedEvent, LeaveEvent, UnknownMembership]
|
||||
module.exports = [JoinedEvent, InvitedEvent, LeaveEvent, BanEvent, UnknownMembership]
|
||||
|
|
Loading…
Reference in a new issue