MM-38445: Set isFollowing to false only when explicitly unfollowed (#18740)

Summary
Set post.IsFollowing to false only if the post is explicitly unfollowed. Otherwise leave it as nil.

Ticket Link
https://mattermost.atlassian.net/browse/MM-38445
Этот коммит содержится в:
Ashish Bhate
2021-10-26 18:50:02 +05:30
коммит произвёл GitHub
родитель c91ab6267a
Коммит 097d32f409
2 изменённых файлов: 61 добавлений и 23 удалений

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

@@ -528,7 +528,7 @@ func (s *SqlPostStore) getPostWithCollapsedThreads(id, userID string, extended b
"COALESCE(Threads.ReplyCount, 0) as ThreadReplyCount",
"COALESCE(Threads.LastReplyAt, 0) as LastReplyAt",
"COALESCE(Threads.Participants, '[]') as ThreadParticipants",
"COALESCE(ThreadMemberships.Following, false) as IsFollowing",
"ThreadMemberships.Following as IsFollowing",
)
var post postWithExtra
@@ -879,7 +879,7 @@ func (s *SqlPostStore) getPostsCollapsedThreads(options model.GetPostsOptions) (
"COALESCE(Threads.ReplyCount, 0) as ThreadReplyCount",
"COALESCE(Threads.LastReplyAt, 0) as LastReplyAt",
"COALESCE(Threads.Participants, '[]') as ThreadParticipants",
"COALESCE(ThreadMemberships.Following, false) as IsFollowing",
"ThreadMemberships.Following as IsFollowing",
)
var posts []*postWithExtra
offset := options.PerPage * options.Page
@@ -965,7 +965,7 @@ func (s *SqlPostStore) getPostsSinceCollapsedThreads(options model.GetPostsSince
"COALESCE(Threads.ReplyCount, 0) as ThreadReplyCount",
"COALESCE(Threads.LastReplyAt, 0) as LastReplyAt",
"COALESCE(Threads.Participants, '[]') as ThreadParticipants",
"COALESCE(ThreadMemberships.Following, false) as IsFollowing",
"ThreadMemberships.Following as IsFollowing",
)
var posts []*postWithExtra
@@ -1181,7 +1181,7 @@ func (s *SqlPostStore) getPostsAround(before bool, options model.GetPostsOptions
"COALESCE(Threads.ReplyCount, 0) as ThreadReplyCount",
"COALESCE(Threads.LastReplyAt, 0) as LastReplyAt",
"COALESCE(Threads.Participants, '[]') as ThreadParticipants",
"COALESCE(ThreadMemberships.Following, false) as IsFollowing",
"ThreadMemberships.Following as IsFollowing",
)
}
query := s.getQueryBuilder().Select(columns...)