MM-42282: handle teamId parameter correctly (#19685)
As per https://community-daily.mattermost.com/core/pl/ugs7ue6e4j8a7cgegk1bxje8to, `ThreadStore.GetThreadsForUser` accepts a `teamId` parameter, but incorrectly handles an empty value of `""` as looking only for channels with an empty `teamId` (aka DMs and GMs) instead of finding all channels and effectively ignoring the team property. Fixes: https://mattermost.atlassian.net/browse/MM-42282
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
72c6b8fe48
Коммит
b5e78a0ce1
@@ -67,7 +67,16 @@ func (s *SqlThreadStore) GetThreadsForUser(userId, teamId string, opts model.Get
|
||||
fetchConditions := sq.And{
|
||||
sq.Eq{"ThreadMemberships.UserId": userId},
|
||||
sq.Eq{"ThreadMemberships.Following": true},
|
||||
sq.Or{sq.Eq{"Channels.TeamId": teamId}, sq.Eq{"Channels.TeamId": ""}},
|
||||
}
|
||||
|
||||
if teamId != "" {
|
||||
fetchConditions = sq.And{
|
||||
fetchConditions,
|
||||
sq.Or{
|
||||
sq.Eq{"Channels.TeamId": teamId},
|
||||
sq.Eq{"Channels.TeamId": ""},
|
||||
},
|
||||
}
|
||||
}
|
||||
if !opts.Deleted {
|
||||
fetchConditions = sq.And{
|
||||
|
||||
Ссылка в новой задаче
Block a user