MM-56457: Update LastUpdateAt in UpdateMemberNotifyProps (#25984)
PR https://github.com/mattermost/mattermost/pull/18114 mistakenly left out updating the lastUpdateAt of the field. We fix that here. https://mattermost.atlassian.net/browse/MM-56457 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
467ab193d3
Коммит
f246cd26b7
@@ -1861,6 +1861,7 @@ func (s SqlChannelStore) UpdateMemberNotifyProps(channelID, userID string, props
|
|||||||
sql, args, err2 := s.getQueryBuilder().
|
sql, args, err2 := s.getQueryBuilder().
|
||||||
Update("channelmembers").
|
Update("channelmembers").
|
||||||
Set("notifyprops", sq.Expr("notifyprops || ?::jsonb", jsonNotifyProps)).
|
Set("notifyprops", sq.Expr("notifyprops || ?::jsonb", jsonNotifyProps)).
|
||||||
|
Set("LastUpdateAt", model.GetMillis()).
|
||||||
Where(sq.Eq{
|
Where(sq.Eq{
|
||||||
"userid": userID,
|
"userid": userID,
|
||||||
"channelid": channelID,
|
"channelid": channelID,
|
||||||
@@ -1884,6 +1885,7 @@ func (s SqlChannelStore) UpdateMemberNotifyProps(channelID, userID string, props
|
|||||||
sql, args, err2 := s.getQueryBuilder().
|
sql, args, err2 := s.getQueryBuilder().
|
||||||
Update("ChannelMembers").
|
Update("ChannelMembers").
|
||||||
Set("NotifyProps", jsonExpr).
|
Set("NotifyProps", jsonExpr).
|
||||||
|
Set("LastUpdateAt", model.GetMillis()).
|
||||||
Where(sq.Eq{
|
Where(sq.Eq{
|
||||||
"UserId": userID,
|
"UserId": userID,
|
||||||
"ChannelId": channelID,
|
"ChannelId": channelID,
|
||||||
|
|||||||
@@ -3266,6 +3266,10 @@ func testChannelUpdateMemberNotifyProps(t *testing.T, rctx request.CTX, ss store
|
|||||||
}
|
}
|
||||||
member, nErr = ss.Channel().SaveMember(member)
|
member, nErr = ss.Channel().SaveMember(member)
|
||||||
require.NoError(t, nErr)
|
require.NoError(t, nErr)
|
||||||
|
then := member.LastUpdateAt
|
||||||
|
|
||||||
|
// Sleeping for a bit for the lastUpdateAt to be greater than before.
|
||||||
|
time.Sleep(10 * time.Millisecond)
|
||||||
|
|
||||||
props := member.NotifyProps
|
props := member.NotifyProps
|
||||||
props["hello"] = "world"
|
props["hello"] = "world"
|
||||||
@@ -3274,6 +3278,7 @@ func testChannelUpdateMemberNotifyProps(t *testing.T, rctx request.CTX, ss store
|
|||||||
require.NoError(t, nErr)
|
require.NoError(t, nErr)
|
||||||
// Verify props.
|
// Verify props.
|
||||||
assert.Equal(t, props, member.NotifyProps)
|
assert.Equal(t, props, member.NotifyProps)
|
||||||
|
require.Greater(t, member.LastUpdateAt, then)
|
||||||
|
|
||||||
t.Run("should fail with invalid input if the notify props are too big", func(t *testing.T) {
|
t.Run("should fail with invalid input if the notify props are too big", func(t *testing.T) {
|
||||||
props["property"] = strings.Repeat("Z", model.ChannelMemberNotifyPropsMaxRunes)
|
props["property"] = strings.Repeat("Z", model.ChannelMemberNotifyPropsMaxRunes)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user