Render ban events

This commit is contained in:
Cadence Ember 2020-11-28 17:07:54 +13:00
parent e6fc1de276
commit b4dfefbac9
Signed by: cadence
GPG key ID: BC1C2C61CF521B17

View file

@ -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 { class UnknownMembership extends MembershipEvent {
render() { render() {
this.renderInner("", [ this.renderInner("", [
@ -106,4 +124,4 @@ class UnknownMembership extends MembershipEvent {
} }
} }
module.exports = [JoinedEvent, InvitedEvent, LeaveEvent, UnknownMembership] module.exports = [JoinedEvent, InvitedEvent, LeaveEvent, BanEvent, UnknownMembership]