state: Fix decrementing reaction count (#302)

* state: fix updating reaction count in reaction remove event

* move r.Me branch to if
This commit is contained in:
Juby210 2022-01-18 01:35:49 +01:00 committed by GitHub
parent 11432e426c
commit 2d3bf2974a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -276,12 +276,14 @@ func (s *State) onEvent(iface interface{}) {
copy(m.Reactions[0:], old[:i])
copy(m.Reactions[i:], old[i+1:])
case r.Me: // If reaction removal is the user's
u, err := s.Cabinet.Me()
if err == nil && ev.UserID == u.ID {
r.Me = false
}
default:
r.Count--
if r.Me { // If reaction removal is the user's
u, err := s.Cabinet.Me()
if err == nil && ev.UserID == u.ID {
r.Me = false
}
}
}
return true