Fix nick changes with op/voice
This commit is contained in:
parent
a5071fbd62
commit
8dfcf47281
@ -108,7 +108,7 @@ func (c *ChannelStore) FindUserChannels(user, server string) []string {
|
|||||||
c.userLock.Lock()
|
c.userLock.Lock()
|
||||||
for channel, users := range c.users[server] {
|
for channel, users := range c.users[server] {
|
||||||
for _, nick := range users {
|
for _, nick := range users {
|
||||||
if user == nick {
|
if user == strings.TrimLeft(nick, "@+") {
|
||||||
channels = append(channels, channel)
|
channels = append(channels, channel)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -66,9 +66,13 @@ func TestFindUserChannels(t *testing.T) {
|
|||||||
channelStore.AddUser("user", "srv", "#chan2")
|
channelStore.AddUser("user", "srv", "#chan2")
|
||||||
channelStore.AddUser("user2", "srv", "#chan3")
|
channelStore.AddUser("user2", "srv", "#chan3")
|
||||||
channelStore.AddUser("user", "srv2", "#chan4")
|
channelStore.AddUser("user", "srv2", "#chan4")
|
||||||
|
channelStore.AddUser("@gotop", "srv", "#chan1")
|
||||||
|
|
||||||
channels := channelStore.FindUserChannels("user", "srv")
|
channels := channelStore.FindUserChannels("user", "srv")
|
||||||
assert.Len(t, channels, 2)
|
assert.Len(t, channels, 2)
|
||||||
assert.Contains(t, channels, "#chan1")
|
assert.Contains(t, channels, "#chan1")
|
||||||
assert.Contains(t, channels, "#chan2")
|
assert.Contains(t, channels, "#chan2")
|
||||||
|
channels = channelStore.FindUserChannels("gotop", "srv")
|
||||||
|
assert.Len(t, channels, 1)
|
||||||
|
assert.Contains(t, channels, "#chan1")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user