mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-23 10:16:14 -06:00
Add ContentType to internal models
This commit is contained in:
parent
ab7ec43988
commit
2791a9951f
2 changed files with 28 additions and 1 deletions
|
|
@ -74,6 +74,7 @@ type Status struct {
|
||||||
PendingApproval *bool `bun:",nullzero,notnull,default:false"` // If true then status is a reply or boost wrapper that must be Approved by the reply-ee or boost-ee before being fully distributed.
|
PendingApproval *bool `bun:",nullzero,notnull,default:false"` // If true then status is a reply or boost wrapper that must be Approved by the reply-ee or boost-ee before being fully distributed.
|
||||||
PreApproved bool `bun:"-"` // If true, then status is a reply to or boost wrapper of a status on our instance, has permission to do the interaction, and an Accept should be sent out for it immediately. Field not stored in the DB.
|
PreApproved bool `bun:"-"` // If true, then status is a reply to or boost wrapper of a status on our instance, has permission to do the interaction, and an Accept should be sent out for it immediately. Field not stored in the DB.
|
||||||
ApprovedByURI string `bun:",nullzero"` // URI of an Accept Activity that approves the Announce or Create Activity that this status was/will be attached to.
|
ApprovedByURI string `bun:",nullzero"` // URI of an Accept Activity that approves the Announce or Create Activity that this status was/will be attached to.
|
||||||
|
ContentType StatusContentType `bun:",nullzero"` // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetID implements timeline.Timelineable{}.
|
// GetID implements timeline.Timelineable{}.
|
||||||
|
|
@ -376,6 +377,32 @@ func (v Visibility) String() string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StatusContentType is the content type with which a status's text is
|
||||||
|
// parsed. Can be either plain or markdown. Empty will default to plain.
|
||||||
|
type StatusContentType enumType
|
||||||
|
|
||||||
|
const (
|
||||||
|
// The "unset"
|
||||||
|
StatusContentTypePlain StatusContentType = 1
|
||||||
|
StatusContentTypeMarkdown StatusContentType = 2
|
||||||
|
StatusContentTypeDefault = StatusContentTypePlain
|
||||||
|
)
|
||||||
|
|
||||||
|
// String returns the actual MIME string corresponding to a content type.
|
||||||
|
// NOMERGE: is this actually necessary? i copied this because Visibility has it
|
||||||
|
// but it kinda seems like it's only used as part of the preferences stuff. do i
|
||||||
|
// need to touch that for this
|
||||||
|
func (v StatusContentType) String() string {
|
||||||
|
switch v {
|
||||||
|
case StatusContentTypePlain:
|
||||||
|
return "text/plain"
|
||||||
|
case StatusContentTypeMarkdown:
|
||||||
|
return "text/markdown"
|
||||||
|
default:
|
||||||
|
panic("invalid status content type")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Content models the simple string content
|
// Content models the simple string content
|
||||||
// of a status along with its ContentMap,
|
// of a status along with its ContentMap,
|
||||||
// which contains content entries keyed by
|
// which contains content entries keyed by
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ type StatusEdit struct {
|
||||||
PollVotes []int `bun:",array"` // Poll vote count at time of status edit, only set if poll votes were reset.
|
PollVotes []int `bun:",array"` // Poll vote count at time of status edit, only set if poll votes were reset.
|
||||||
StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // The originating status ID this is a historical edit of.
|
StatusID string `bun:"type:CHAR(26),nullzero,notnull"` // The originating status ID this is a historical edit of.
|
||||||
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // The creation time of this version of the status content (according to receiving server).
|
CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // The creation time of this version of the status content (according to receiving server).
|
||||||
|
ContentType StatusContentType `bun:",nullzero"` // TODO
|
||||||
// We don't bother having a *gtsmodel.Status model here
|
// We don't bother having a *gtsmodel.Status model here
|
||||||
// as the StatusEdit is always just attached to a Status,
|
// as the StatusEdit is always just attached to a Status,
|
||||||
// so it doesn't need a self-reference back to it.
|
// so it doesn't need a self-reference back to it.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue