mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 17:33:09 -06:00
Make removeUser public
This commit is contained in:
parent
14850f9c33
commit
48ca0d963f
|
|
@ -85,12 +85,12 @@ func (t *TypingCache) addUser(userID, roomID string, expiryTimer *time.Timer) {
|
|||
// This removes the user.
|
||||
func (t *TypingCache) timeoutCallback(userID, roomID string) func() {
|
||||
return func() {
|
||||
t.removeUser(userID, roomID)
|
||||
t.RemoveUser(userID, roomID)
|
||||
}
|
||||
}
|
||||
|
||||
// removeUser with mutex lock & stop the timer.
|
||||
func (t *TypingCache) removeUser(userID, roomID string) {
|
||||
// RemoveUser with mutex lock & stop the timer.
|
||||
func (t *TypingCache) RemoveUser(userID, roomID string) {
|
||||
t.Lock()
|
||||
defer t.Unlock()
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func TestTypingCache(t *testing.T) {
|
|||
testGetTypingUsers(t, tCache)
|
||||
})
|
||||
|
||||
t.Run("removeUser", func(t *testing.T) {
|
||||
t.Run("RemoveUser", func(t *testing.T) {
|
||||
testRemoveUser(t, tCache)
|
||||
})
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ func testRemoveUser(t *testing.T, tCache *TypingCache) {
|
|||
}
|
||||
|
||||
length := len(tt.userIDs)
|
||||
tCache.removeUser(tt.userIDs[length-1], tt.roomID)
|
||||
tCache.RemoveUser(tt.userIDs[length-1], tt.roomID)
|
||||
expLeftUsers := tt.userIDs[:length-1]
|
||||
if leftUsers := tCache.GetTypingUsers(tt.roomID); !test.UnsortedStringSliceEqual(leftUsers, expLeftUsers) {
|
||||
t.Errorf("Response after removal is unexpected. Want = %s, got = %s", leftUsers, expLeftUsers)
|
||||
|
|
|
|||
Loading…
Reference in a new issue