MM-29584: Make apps plugin hook invocation/registration conditional (#16769)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3a3ec001bf
Коммит
e37e902ddf
@@ -560,4 +560,20 @@ func TestShouldProcessMessage(t *testing.T) {
|
||||
assert.True(t, shouldProcessMessage)
|
||||
})
|
||||
|
||||
t.Run("should process the message when we pass the botId as input", func(t *testing.T) {
|
||||
userID := "user-id"
|
||||
channelID := "1"
|
||||
api := setupAPI()
|
||||
api.On("GetChannel", channelID).Return(&model.Channel{Id: channelID, Type: model.CHANNEL_GROUP}, nil)
|
||||
p.API = api
|
||||
api.On("GetUser", userID).Return(&model.User{IsBot: false}, nil)
|
||||
|
||||
// we should skip the store Get
|
||||
api.On("KVGet", plugin.BotUserKey).Return(nil, nil)
|
||||
|
||||
shouldProcessMessage, err := p.ShouldProcessMessage(&model.Post{ChannelId: channelID, UserId: userID}, plugin.BotID(expectedBotID))
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.True(t, shouldProcessMessage)
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user