[MM-36268] Fix replication lag error on post reply (#17752)

* Fix replication lag error on post reply

* Improve further by using a db transaction
Этот коммит содержится в:
Claudio Costa
2021-06-16 16:45:34 +02:00
коммит произвёл GitHub
родитель d093e102a4
Коммит 6483abd263
11 изменённых файлов: 220 добавлений и 65 удалений

Просмотреть файл

@@ -296,7 +296,7 @@ type ThreadStore interface {
GetMembershipsForUser(userId, teamID string) ([]*model.ThreadMembership, error)
GetMembershipForUser(userId, postID string) (*model.ThreadMembership, error)
DeleteMembershipForUser(userId, postID string) error
MaintainMembership(userID, postID string, following, incrementMentions, updateFollowing, updateViewedTimestamp, updateParticipants bool) (*model.ThreadMembership, error)
MaintainMembership(userID, postID string, opts ThreadMembershipOpts) (*model.ThreadMembership, error)
CollectThreadsWithNewerReplies(userId string, channelIds []string, timestamp int64) ([]string, error)
UpdateUnreadsByChannel(userId string, changedThreads []string, timestamp int64, updateViewedTimestamp bool) error
}
@@ -912,3 +912,21 @@ type UserGetByIdsOpts struct {
// Since filters the users based on their UpdateAt timestamp.
Since int64
}
// ThreadMembershipOpts defines some properties to be passed to
// ThreadStore.MaintainMembership()
type ThreadMembershipOpts struct {
// Following indicates whether or not the user is following the thread.
Following bool
// IncrementMentions indicates whether or not the mentions count for
// the thread should be incremented.
IncrementMentions bool
// UpdateFollowing indicates whether or not a membership update should be forced.
UpdateFollowing bool
// UpdateViewedTimestamp indicates whether or not the LastViewed field of the
// membership should be updated.
UpdateViewedTimestamp bool
// UpdateParticipants indicates whether or not the thread's participants list
// should be updated.
UpdateParticipants bool
}