mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 22:02:46 +00:00
Add possibility to ignore users (#2329)
* Add ignore users * Ignore users in pushrules Add passing tests * Update sytest lists * Store ignore knowledge in the sync API * Fix copyrights Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
This commit is contained in:
parent
99ef547295
commit
60ee7eef4c
23 changed files with 307 additions and 20 deletions
|
@ -40,11 +40,18 @@ func (p *TypingStreamProvider) IncrementalSync(
|
|||
if users, updated := p.EDUCache.GetTypingUsersIfUpdatedAfter(
|
||||
roomID, int64(from),
|
||||
); updated {
|
||||
typingUsers := make([]string, 0, len(users))
|
||||
for i := range users {
|
||||
// skip ignored user events
|
||||
if _, ok := req.IgnoredUsers.List[users[i]]; !ok {
|
||||
typingUsers = append(typingUsers, users[i])
|
||||
}
|
||||
}
|
||||
ev := gomatrixserverlib.ClientEvent{
|
||||
Type: gomatrixserverlib.MTyping,
|
||||
}
|
||||
ev.Content, err = json.Marshal(map[string]interface{}{
|
||||
"user_ids": users,
|
||||
"user_ids": typingUsers,
|
||||
})
|
||||
if err != nil {
|
||||
req.Log.WithError(err).Error("json.Marshal failed")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue