aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-03-25 12:35:50 +0300
committerTulir Asokan <tulir@maunium.net>2018-03-25 12:35:50 +0300
commitc1286661090731729e76e48d5e47988ad0175a20 (patch)
treee43ce30f3d3020ec1e2bec13ea7fc954b89e78d4 /matrix
parente414e20215db3a80bb1cf511390406324e742ebf (diff)
Refactor things and add proper wheel scroll support
Diffstat (limited to 'matrix')
-rw-r--r--matrix/matrix.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index 8199449..7ba6ebb 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -260,7 +260,8 @@ func (c *Container) processOwnMembershipChange(evt *gomatrix.Event) {
if evt.Unsigned.PrevContent != nil {
prevMembership, _ = evt.Unsigned.PrevContent["membership"].(string)
}
- if membership == prevMembership {
+ const Hour = 1 * 60 * 60 * 1000
+ if membership == prevMembership || evt.Unsigned.Age > Hour {
return
}
switch membership {
@@ -273,11 +274,6 @@ func (c *Container) processOwnMembershipChange(evt *gomatrix.Event) {
// HandleMembership is the event handler for the m.room.membership state event.
func (c *Container) HandleMembership(evt *gomatrix.Event) {
- const Hour = 1 * 60 * 60 * 1000
- if evt.Unsigned.Age > Hour {
- return
- }
-
if evt.StateKey != nil && *evt.StateKey == c.config.Session.UserID {
c.processOwnMembershipChange(evt)
}