-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix filtering of playing events by game or type #303
Fix filtering of playing events by game or type #303
Conversation
@@ -97,14 +97,14 @@ def matches?(event) | |||
end, | |||
matches_all(@attributes[:game], event.game) do |a, e| | |||
a == if a.is_a? String | |||
e.name | |||
e | |||
else | |||
e | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This call all just be written as a == e
else | ||
e | ||
end | ||
end, | ||
matches_all(@attributes[:type], event.type) do |a, e| | ||
a == if a.is_a? Integer | ||
e.type | ||
e | ||
else | ||
e | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
64d76c8
to
516c612
Compare
Nice catch! |
Yeah, I had a strange feeling about the |
There are two small issues in the PlayingEventHandler that result in crashes if a filter for game or type is used.
During the initialisation of PlayingEvent the game object received from the server is flattened to its only attribute
name
(presence.rb:75). In line 100event.game.name
is accessed, but at this pointevent.game
is only a string.For filtering by event type the
type
attribute is accessed twice (i.e.event.type.type
) in lines 105 and 107.