MM-34758 Collapsed Reply Threads without mobile support (#17424)
Summary added support for legacy clients accessing server added collapsed_threads_supported param to viewChannel API and setPostUnread API Ticket Link https://mattermost.atlassian.net/browse/MM-34758 Related Webapp PR mattermost/mattermost-webapp#7933
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ebed0c67f7
Коммит
46649292f8
@@ -2216,7 +2216,7 @@ func (s SqlChannelStore) CountPostsAfter(channelId string, timestamp int64, user
|
||||
// UpdateLastViewedAtPost updates a ChannelMember as if the user last read the channel at the time of the given post.
|
||||
// If the provided mentionCount is -1, the given post and all posts after it are considered to be mentions. Returns
|
||||
// an updated model.ChannelUnreadAt that can be returned to the client.
|
||||
func (s SqlChannelStore) UpdateLastViewedAtPost(unreadPost *model.Post, userID string, mentionCount, mentionCountRoot int, updateThreads bool) (*model.ChannelUnreadAt, error) {
|
||||
func (s SqlChannelStore) UpdateLastViewedAtPost(unreadPost *model.Post, userID string, mentionCount, mentionCountRoot int, updateThreads bool, setUnreadCountRoot bool) (*model.ChannelUnreadAt, error) {
|
||||
var threadsToUpdate []string
|
||||
unreadDate := unreadPost.CreateAt - 1
|
||||
if updateThreads {
|
||||
@@ -2232,6 +2232,10 @@ func (s SqlChannelStore) UpdateLastViewedAtPost(unreadPost *model.Post, userID s
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !setUnreadCountRoot {
|
||||
unreadRoot = 0
|
||||
}
|
||||
|
||||
params := map[string]interface{}{
|
||||
"mentions": mentionCount,
|
||||
"mentionsRoot": mentionCountRoot,
|
||||
|
||||
@@ -386,7 +386,37 @@ func (s *SqlThreadStore) GetThreadForUser(userId, teamId, threadId string, exten
|
||||
|
||||
return result, nil
|
||||
}
|
||||
func (s *SqlThreadStore) MarkAllAsReadInChannels(userID string, channelIDs []string) error {
|
||||
var threadIDs []string
|
||||
|
||||
query, args, _ := s.getQueryBuilder().
|
||||
Select("ThreadMemberships.PostId").
|
||||
Join("Threads ON Threads.PostId = ThreadMemberships.PostId").
|
||||
Join("Channels ON Threads.ChannelId = Channels.Id").
|
||||
From("ThreadMemberships").
|
||||
Where(sq.Eq{"Threads.ChannelId": channelIDs}).
|
||||
Where(sq.Eq{"ThreadMemberships.UserId": userID}).
|
||||
ToSql()
|
||||
|
||||
_, err := s.GetReplica().Select(&threadIDs, query, args...)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to get thread membership with userid=%s", userID)
|
||||
}
|
||||
|
||||
timestamp := model.GetMillis()
|
||||
query, args, _ = s.getQueryBuilder().
|
||||
Update("ThreadMemberships").
|
||||
Where(sq.Eq{"PostId": threadIDs}).
|
||||
Where(sq.Eq{"UserId": userID}).
|
||||
Set("LastViewed", timestamp).
|
||||
Set("UnreadMentions", 0).
|
||||
ToSql()
|
||||
if _, err := s.GetMaster().Exec(query, args...); err != nil {
|
||||
return errors.Wrapf(err, "failed to update thread read state for user id=%s", userID)
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
func (s *SqlThreadStore) MarkAllAsRead(userId, teamId string) error {
|
||||
memberships, err := s.GetMembershipsForUser(userId, teamId)
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user