MM-56083 Add PatchMultipleMembersNotifyProps plugin API (#25690)
* Add ChannelStore.UpdateMultipleMembersNotifyProps * Make UpdateMultipleMembersNotifyProps return updated values from the DB * Add UpdateChannelMembersNotifications plugin API * Extract i18n * Fix style * Make layers * Change to PatchMultipleMembersNotifyProps * Add limit to PatchChannelMembersNotifyProps * Add additional unit tests * Address feedback * Lowercase decodeJSON * Have PatchMultipleMembersNotifyProps update LastUpdateAt * Fix tests that relied on unreliable return order * Fix i18n
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
aafe7439af
Коммит
4d96c11314
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -18,8 +19,11 @@ func TestChannelMemberIsValid(t *testing.T) {
|
||||
o.ChannelId = NewId()
|
||||
require.NotNil(t, o.IsValid(), "should be invalid")
|
||||
|
||||
o.NotifyProps = GetDefaultChannelNotifyProps()
|
||||
o.UserId = NewId()
|
||||
require.NotNil(t, o.IsValid(), "should be invalid because of missing notify props")
|
||||
|
||||
o.NotifyProps = GetDefaultChannelNotifyProps()
|
||||
require.Nil(t, o.IsValid(), "should be valid")
|
||||
|
||||
o.NotifyProps["desktop"] = "junk"
|
||||
require.NotNil(t, o.IsValid(), "should be invalid")
|
||||
@@ -42,3 +46,15 @@ func TestChannelMemberIsValid(t *testing.T) {
|
||||
o.NotifyProps["property"] = strings.Repeat("Z", ChannelMemberNotifyPropsMaxRunes)
|
||||
require.NotNil(t, o.IsValid(), "should be invalid")
|
||||
}
|
||||
|
||||
func TestIsChannelMemberNotifyPropsValid(t *testing.T) {
|
||||
t.Run("should require certain fields unless allowMissingFields is true", func(t *testing.T) {
|
||||
notifyProps := map[string]string{}
|
||||
|
||||
err := IsChannelMemberNotifyPropsValid(notifyProps, false)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
err = IsChannelMemberNotifyPropsValid(notifyProps, true)
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user