MM-29703 Mark threads as read when channels are marked (#15994)
Co-authored-by: Jesús Espino <jespinog@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1729239385
Коммит
fe352ab57f
@@ -2322,7 +2322,7 @@ func (a *App) SetActiveChannel(userId string, channelId string) *model.AppError
|
||||
}
|
||||
|
||||
func (a *App) UpdateChannelLastViewedAt(channelIds []string, userId string) *model.AppError {
|
||||
if _, err := a.Srv().Store.Channel().UpdateLastViewedAt(channelIds, userId); err != nil {
|
||||
if _, err := a.Srv().Store.Channel().UpdateLastViewedAt(channelIds, userId, *a.Config().ServiceSettings.ThreadAutoFollow); err != nil {
|
||||
var invErr *store.ErrInvalidInput
|
||||
switch {
|
||||
case errors.As(err, &invErr):
|
||||
@@ -2360,7 +2360,7 @@ func (a *App) MarkChannelAsUnreadFromPost(postID string, userID string) (*model.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
channelUnread, nErr := a.Srv().Store.Channel().UpdateLastViewedAtPost(post, userID, unreadMentions)
|
||||
channelUnread, nErr := a.Srv().Store.Channel().UpdateLastViewedAtPost(post, userID, unreadMentions, *a.Config().ServiceSettings.ThreadAutoFollow)
|
||||
if nErr != nil {
|
||||
return channelUnread, model.NewAppError("MarkChannelAsUnreadFromPost", "app.channel.update_last_viewed_at_post.app_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
@@ -2531,7 +2531,7 @@ func (a *App) MarkChannelsAsViewed(channelIds []string, userId string, currentSe
|
||||
}
|
||||
}
|
||||
}
|
||||
times, err := a.Srv().Store.Channel().UpdateLastViewedAt(channelIds, userId)
|
||||
times, err := a.Srv().Store.Channel().UpdateLastViewedAt(channelIds, userId, *a.Config().ServiceSettings.ThreadAutoFollow)
|
||||
if err != nil {
|
||||
var invErr *store.ErrInvalidInput
|
||||
switch {
|
||||
|
||||
@@ -1869,7 +1869,7 @@ func TestMarkChannelsAsViewedPanic(t *testing.T) {
|
||||
times := map[string]int64{
|
||||
"userID": 1,
|
||||
}
|
||||
mockChannelStore.On("UpdateLastViewedAt", []string{"channelID"}, "userID").Return(times, nil)
|
||||
mockChannelStore.On("UpdateLastViewedAt", []string{"channelID"}, "userID", true).Return(times, nil)
|
||||
mockStore.On("User").Return(&mockUserStore)
|
||||
mockStore.On("Channel").Return(&mockChannelStore)
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
||||
umc := make(chan *model.AppError, 1)
|
||||
go func(userId string) {
|
||||
defer close(umc)
|
||||
nErr := a.Srv().Store.Channel().IncrementMentionCount(post.ChannelId, userId)
|
||||
nErr := a.Srv().Store.Channel().IncrementMentionCount(post.ChannelId, userId, *a.Config().ServiceSettings.ThreadAutoFollow)
|
||||
if nErr != nil {
|
||||
umc <- model.NewAppError("SendNotifications", "app.channel.increment_mention_count.app_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
Ссылка в новой задаче
Block a user