feat(blog): add subscription-only content gating
Adds SubscriptionOnly flag to blog posts to restrict full content access to active subscribers. Shows teaser/preview for non-subscribers with subscribe CTA. Integrates with repository subscription system when monetization is enabled. Updates v2 API structs and editor UI with subscription toggle. Admins and repo writers bypass the gate.
This commit is contained in:
@@ -43,21 +43,22 @@ func (s BlogPostStatus) String() string {
|
||||
|
||||
// BlogPost represents a blog article belonging to a repository.
|
||||
type BlogPost struct { //revive:disable-line:exported
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
RepoID int64 `xorm:"INDEX NOT NULL"`
|
||||
AuthorID int64 `xorm:"INDEX NOT NULL"`
|
||||
Title string `xorm:"VARCHAR(255) NOT NULL"`
|
||||
Subtitle string `xorm:"VARCHAR(500)"`
|
||||
Content string `xorm:"LONGTEXT NOT NULL"`
|
||||
RenderedContent string `xorm:"-"`
|
||||
Tags string `xorm:"TEXT"`
|
||||
Series string `xorm:"VARCHAR(255)"`
|
||||
FeaturedImageID int64 `xorm:"DEFAULT 0"`
|
||||
Status BlogPostStatus `xorm:"SMALLINT NOT NULL DEFAULT 0"`
|
||||
AllowComments bool `xorm:"NOT NULL DEFAULT true"`
|
||||
PublishedUnix timeutil.TimeStamp `xorm:"INDEX"`
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
|
||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
RepoID int64 `xorm:"INDEX NOT NULL"`
|
||||
AuthorID int64 `xorm:"INDEX NOT NULL"`
|
||||
Title string `xorm:"VARCHAR(255) NOT NULL"`
|
||||
Subtitle string `xorm:"VARCHAR(500)"`
|
||||
Content string `xorm:"LONGTEXT NOT NULL"`
|
||||
RenderedContent string `xorm:"-"`
|
||||
Tags string `xorm:"TEXT"`
|
||||
Series string `xorm:"VARCHAR(255)"`
|
||||
FeaturedImageID int64 `xorm:"DEFAULT 0"`
|
||||
Status BlogPostStatus `xorm:"SMALLINT NOT NULL DEFAULT 0"`
|
||||
AllowComments bool `xorm:"NOT NULL DEFAULT true"`
|
||||
SubscriptionOnly bool `xorm:"NOT NULL DEFAULT false"`
|
||||
PublishedUnix timeutil.TimeStamp `xorm:"INDEX"`
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
|
||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
|
||||
|
||||
Author *user_model.User `xorm:"-"`
|
||||
Repo *repo_model.Repository `xorm:"-"`
|
||||
|
||||
Reference in New Issue
Block a user