feat: post reshare enhancements
This commit is contained in:
+17
-11
@@ -5,6 +5,11 @@ import "time"
|
||||
// Post is a public quote on a user's feed. Caption is the verbatim selected
|
||||
// text from the knowledgebase; SourceURL links back to the page the user
|
||||
// was reading. Images are loaded separately via PostImage rows.
|
||||
//
|
||||
// Reshares are real Post rows owned by the resharer, with
|
||||
// ResharedFromPostID pointing to the canonical original. Likes, comments,
|
||||
// and images all hang off the post's own id, so they diverge naturally
|
||||
// across reshare boundaries — no parallel "per-resharer" tables.
|
||||
type Post struct {
|
||||
ID string `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
@@ -20,19 +25,20 @@ type Post struct {
|
||||
AuthorHandle string `json:"author_handle,omitempty"`
|
||||
AuthorAvatarURL *string `json:"author_avatar_url,omitempty"`
|
||||
|
||||
// ViewerHasReshared is true when the calling user has reshared this
|
||||
// post. Hydrated by the service layer after the repo returns posts;
|
||||
// always false for anonymous viewers (no viewer = no reshare state).
|
||||
// Reshare attribution. ResharedFromPostID is non-nil when this post
|
||||
// is a reshare; the four `Original*` fields carry the canonical
|
||||
// post's author info so the frontend can render a
|
||||
// "Reshared from @handle" link without an extra round-trip.
|
||||
ResharedFromPostID *string `json:"reshared_from_post_id,omitempty"`
|
||||
OriginalAuthorName *string `json:"original_author_name,omitempty"`
|
||||
OriginalAuthorHandle *string `json:"original_author_handle,omitempty"`
|
||||
OriginalAuthorAvatar *string `json:"original_author_avatar_url,omitempty"`
|
||||
|
||||
// ViewerHasReshared is true when the calling user has reshared the
|
||||
// canonical version of this post. Hydrated by the service layer
|
||||
// after the repo returns posts; always false for anonymous viewers.
|
||||
// Drives the post-card "Reshare ↔ Send" swap on the frontend.
|
||||
ViewerHasReshared bool `json:"viewer_has_reshared"`
|
||||
|
||||
// ResharedAt is the timestamp at which the feed owner reshared this
|
||||
// post. Non-nil only for rows that appear in a profile feed because
|
||||
// the profile owner reshared them (i.e. the row comes from the
|
||||
// post_reshares union branch of ListByUser / ListByHandle).
|
||||
// Authored-by-feed-owner rows leave this nil. Drives the
|
||||
// "↻ Reshared" badge in the post card.
|
||||
ResharedAt *time.Time `json:"reshared_at,omitempty"`
|
||||
}
|
||||
|
||||
// PostImage represents one attached image on a post.
|
||||
|
||||
Reference in New Issue
Block a user