Classify recursive channel messages as public
This commit is contained in:
committed by
Brandon McGinty
parent
d7dcaa8b21
commit
874cbb7818
@@ -83,6 +83,20 @@ func TestServerAddressDefaultsPortWithoutBreakingIPv6(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPublicTextMessageTargetsChannelIDsAndTrees(t *testing.T) {
|
||||
root := &gumble.Channel{ID: 1, Name: "Root"}
|
||||
current := &gumble.Channel{ID: 2, Name: "Room", Parent: root}
|
||||
b := &Barnard{Client: &gumble.Client{Self: &gumble.User{Channel: current}}}
|
||||
|
||||
if !b.isPublicTextMessage(&gumble.TextMessageEvent{TextMessage: gumble.TextMessage{Trees: []*gumble.Channel{root}}}) {
|
||||
t.Fatal("recursive message to an ancestor was not public")
|
||||
}
|
||||
other := &gumble.Channel{ID: 3, Name: "Room"}
|
||||
if b.isPublicTextMessage(&gumble.TextMessageEvent{TextMessage: gumble.TextMessage{Channels: []*gumble.Channel{other}}}) {
|
||||
t.Fatal("message to a different channel with the same name was public")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPublicServerMessageDoesNotPanic(t *testing.T) {
|
||||
channel := &gumble.Channel{ID: 1, Name: "Current"}
|
||||
b := &Barnard{
|
||||
|
||||
Reference in New Issue
Block a user