From b87fae646a624507f5b2c1270cae1d3585f589ac Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 28 Nov 2017 15:02:56 -0600 Subject: PLT-5458: If someone posts a channel link to channel_A that you don't belong to, it doesn't render properly (#7833) * add channel link hints to post props * optimization * update regex, add unit test * fix rebase issue --- model/post_test.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'model/post_test.go') diff --git a/model/post_test.go b/model/post_test.go index 846c8c775..6a908887d 100644 --- a/model/post_test.go +++ b/model/post_test.go @@ -6,6 +6,8 @@ package model import ( "strings" "testing" + + "github.com/stretchr/testify/assert" ) func TestPostJson(t *testing.T) { @@ -124,6 +126,11 @@ func TestPostIsSystemMessage(t *testing.T) { } } +func TestPostChannelMentions(t *testing.T) { + post := Post{Message: "~a ~b ~b ~c/~d."} + assert.Equal(t, []string{"a", "b", "c", "d"}, post.ChannelMentions()) +} + func TestPostSanitizeProps(t *testing.T) { post1 := &Post{ Message: "test", -- cgit v1.2.3-1-g7c22