Change Post.IsFollowing to a pointer and set to nil for responses to updates to Posts (#17774)

Этот коммит содержится в:
Joram Wilander
2021-06-14 08:25:44 -04:00
коммит произвёл GitHub
родитель 857c5e562f
Коммит 326eb2242a
5 изменённых файлов: 15 добавлений и 6 удалений

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

@@ -102,7 +102,7 @@ type Post struct {
ReplyCount int64 `json:"reply_count" db:"-"`
LastReplyAt int64 `json:"last_reply_at" db:"-"`
Participants []*User `json:"participants" db:"-"`
IsFollowing bool `json:"is_following" db:"-"` // for root posts in collapsed thread mode indicates if the current user is following this thread
IsFollowing *bool `json:"is_following,omitempty" db:"-"` // for root posts in collapsed thread mode indicates if the current user is following this thread
Metadata *PostMetadata `json:"metadata,omitempty" db:"-"`
}
@@ -207,7 +207,9 @@ func (o *Post) ShallowCopy(dst *Post) error {
dst.Participants = o.Participants
dst.LastReplyAt = o.LastReplyAt
dst.Metadata = o.Metadata
dst.IsFollowing = o.IsFollowing
if o.IsFollowing != nil {
dst.IsFollowing = NewBool(*o.IsFollowing)
}
dst.RemoteId = o.RemoteId
return nil
}