[PLT-7362] Option to add user to channel if mentioned user is not currently in the channel (#7619)
* Option to add user to channel if mentioned user is not currently in the channel * instead of link from server, just add component on client side to add channel member * change implementation using post.props * do clean up and add test * sanitize post.props['add_channel_member'] on post creation * move sanitize to app.CreatePost and also apply to app.UpdatePost
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cbb18479e9
Коммит
18ee375860
@@ -123,3 +123,46 @@ func TestPostIsSystemMessage(t *testing.T) {
|
||||
t.Fatalf("TestPostIsSystemMessage failed, expected post2.IsSystemMessage() to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPostSanitizeProps(t *testing.T) {
|
||||
post1 := &Post{
|
||||
Message: "test",
|
||||
}
|
||||
|
||||
post1.SanitizeProps()
|
||||
|
||||
if post1.Props[PROPS_ADD_CHANNEL_MEMBER] != nil {
|
||||
t.Fatal("should be nil")
|
||||
}
|
||||
|
||||
post2 := &Post{
|
||||
Message: "test",
|
||||
Props: StringInterface{
|
||||
PROPS_ADD_CHANNEL_MEMBER: "test",
|
||||
},
|
||||
}
|
||||
|
||||
post2.SanitizeProps()
|
||||
|
||||
if post2.Props[PROPS_ADD_CHANNEL_MEMBER] != nil {
|
||||
t.Fatal("should be nil")
|
||||
}
|
||||
|
||||
post3 := &Post{
|
||||
Message: "test",
|
||||
Props: StringInterface{
|
||||
PROPS_ADD_CHANNEL_MEMBER: "no good",
|
||||
"attachments": "good",
|
||||
},
|
||||
}
|
||||
|
||||
post3.SanitizeProps()
|
||||
|
||||
if post3.Props[PROPS_ADD_CHANNEL_MEMBER] != nil {
|
||||
t.Fatal("should be nil")
|
||||
}
|
||||
|
||||
if post3.Props["attachments"] == nil {
|
||||
t.Fatal("should not be nil")
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user