Fix ChannelStore regression
This commit is contained in:
parent
71177254b4
commit
4ee035766b
@ -93,8 +93,9 @@ func (c *ChannelStore) SetUsers(users []string, server, channel string) {
|
|||||||
c.users[server] = make(map[string][]*ChannelStoreUser)
|
c.users[server] = make(map[string][]*ChannelStoreUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, nick := range users {
|
c.users[server][channel] = make([]*ChannelStoreUser, len(users))
|
||||||
c.users[server][channel] = append(c.users[server][channel], NewChannelStoreUser(nick))
|
for i, nick := range users {
|
||||||
|
c.users[server][channel][i] = NewChannelStoreUser(nick)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.userLock.Unlock()
|
c.userLock.Unlock()
|
||||||
|
@ -11,6 +11,8 @@ func TestGetSetUsers(t *testing.T) {
|
|||||||
users := []string{"a", "b"}
|
users := []string{"a", "b"}
|
||||||
channelStore.SetUsers(users, "srv", "#chan")
|
channelStore.SetUsers(users, "srv", "#chan")
|
||||||
assert.Equal(t, users, channelStore.GetUsers("srv", "#chan"))
|
assert.Equal(t, users, channelStore.GetUsers("srv", "#chan"))
|
||||||
|
channelStore.SetUsers(users, "srv", "#chan")
|
||||||
|
assert.Equal(t, users, channelStore.GetUsers("srv", "#chan"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAddRemoveUser(t *testing.T) {
|
func TestAddRemoveUser(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user