Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
only allow known state event types if they are sent as state events
Browse files Browse the repository at this point in the history
to prevent misfiring the handlers leading to fun...
Same as matrix-org/matrix-react-sdk#1453

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy committed Oct 6, 2017
1 parent c172123 commit de1cea8
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/github.com/t3chguy/matrix-static/mxclient/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,26 @@ func ShouldHideEvent(ev gomatrix.Event) bool {
// m.room.aliases
// m.room.canonical_alias

if ev.Type == "m.room.history_visibility" ||
ev.Type == "m.room.join_rules" ||
ev.Type == "m.room.member" ||
ev.Type == "m.room.power_levels" ||
ev.Type == "m.room.message" ||
ev.Type == "m.room.name" ||
ev.Type == "m.room.topic" ||
ev.Type == "m.room.avatar" {
return false
}
if ev.StateKey == nil {
// Message Event
if ev.Type == "m.room.message" {
return false
}
} else {
// State Event
if ev.Type == "m.room.history_visibility" ||
ev.Type == "m.room.join_rules" ||
ev.Type == "m.room.member" ||
ev.Type == "m.room.power_levels" ||
ev.Type == "m.room.name" ||
ev.Type == "m.room.topic" ||
ev.Type == "m.room.avatar" {
return false
}

if ev.Type == "im.vector.modular.widgets" {
return false
if ev.Type == "im.vector.modular.widgets" {
return false
}
}

return true
Expand Down

0 comments on commit de1cea8

Please sign in to comment.