Update channel member notify props to use native JSON (#18114)
* Update channel member notify props to use native JSON Created a new store method that patches the notify props field. https://community-daily.mattermost.com/plugins/focalboard/workspace/zyoahc9uapdn3xdptac6jb69ic?id=285b80a3-257d-41f6-8cf4-ed80ca9d92e5&v=495cdb4d-c13a-4992-8eb9-80cfee2819a4&c=91d08676-4a0e-4f02-8dce-d24d4fc56449 ```release-note NONE ``` * cleanup ```release-note NONE ``` * forgot to commit ```release-note NONE ``` * Fix edge case ```release-note NONE ``` * address review comments ```release-note NONE ``` * fix incorrect order ```release-note NONE ``` * Address review comments ```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c4c1fda128
Коммит
7bbcf86531
@@ -6,6 +6,7 @@ package sqlstore
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -103,3 +104,32 @@ func TestRemoveNonAlphaNumericUnquotedTerms(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMySQLJSONArgs(t *testing.T) {
|
||||
tests := []struct {
|
||||
props map[string]string
|
||||
args []interface{}
|
||||
argString string
|
||||
}{
|
||||
{
|
||||
props: map[string]string{
|
||||
"desktop": "linux",
|
||||
"mobile": "android",
|
||||
"notify": "always",
|
||||
},
|
||||
args: []interface{}{"$.desktop", "linux", "$.mobile", "android", "$.notify", "always"},
|
||||
argString: "?, ?, ?, ?, ?, ?",
|
||||
},
|
||||
{
|
||||
props: map[string]string{},
|
||||
args: nil,
|
||||
argString: "",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
args, argString := constructMySQLJSONArgs(test.props)
|
||||
assert.ElementsMatch(t, test.args, args)
|
||||
assert.Equal(t, test.argString, argString)
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user