Fix necessary field not set properly in TypingEvent; clean up OutputTypingEvent

Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
Cnly 2019-06-26 23:03:50 +08:00
parent 2a9dab21f8
commit e7cf44946f
2 changed files with 2 additions and 5 deletions

View file

@ -23,8 +23,6 @@ type OutputTypingEvent struct {
// ExpireTime is the interval after which the user should no longer be // ExpireTime is the interval after which the user should no longer be
// considered typing. Only available if Event.Typing is true. // considered typing. Only available if Event.Typing is true.
ExpireTime *time.Time ExpireTime *time.Time
// Users typing in the room when the event was generated.
TypingUsers []string `json:"typing_users"`
} }
// TypingEvent represents a matrix edu event of type 'm.typing'. // TypingEvent represents a matrix edu event of type 'm.typing'.

View file

@ -57,15 +57,14 @@ func (t *TypingServerInputAPI) InputTypingEvent(
} }
func (t *TypingServerInputAPI) sendEvent(ite *api.InputTypingEvent) error { func (t *TypingServerInputAPI) sendEvent(ite *api.InputTypingEvent) error {
userIDs := t.Cache.GetTypingUsers(ite.RoomID)
ev := &api.TypingEvent{ ev := &api.TypingEvent{
Type: gomatrixserverlib.MTyping, Type: gomatrixserverlib.MTyping,
RoomID: ite.RoomID, RoomID: ite.RoomID,
UserID: ite.UserID, UserID: ite.UserID,
Typing: ite.Typing,
} }
ote := &api.OutputTypingEvent{ ote := &api.OutputTypingEvent{
Event: *ev, Event: *ev,
TypingUsers: userIDs,
} }
if ev.Typing { if ev.Typing {