mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-13 21:17:30 -06:00
[feature] Use local_only field, deprecate federated field (#3222)
* [feature] Use `local_only` field, deprecate `federated` field * use `deprecated` comment for form.Federated * nolint
This commit is contained in:
parent
ffcf6e73f7
commit
53fccb8af8
13 changed files with 233 additions and 171 deletions
|
|
@ -45,7 +45,7 @@ func (p *Processor) Create(
|
|||
ctx context.Context,
|
||||
requester *gtsmodel.Account,
|
||||
application *gtsmodel.Application,
|
||||
form *apimodel.AdvancedStatusCreateForm,
|
||||
form *apimodel.StatusCreateRequest,
|
||||
) (
|
||||
*apimodel.Status,
|
||||
gtserror.WithCode,
|
||||
|
|
@ -290,7 +290,7 @@ func (p *Processor) processThreadID(ctx context.Context, status *gtsmodel.Status
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *Processor) processMediaIDs(ctx context.Context, form *apimodel.AdvancedStatusCreateForm, thisAccountID string, status *gtsmodel.Status) gtserror.WithCode {
|
||||
func (p *Processor) processMediaIDs(ctx context.Context, form *apimodel.StatusCreateRequest, thisAccountID string, status *gtsmodel.Status) gtserror.WithCode {
|
||||
if form.MediaIDs == nil {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -338,7 +338,7 @@ func (p *Processor) processMediaIDs(ctx context.Context, form *apimodel.Advanced
|
|||
}
|
||||
|
||||
func processVisibility(
|
||||
form *apimodel.AdvancedStatusCreateForm,
|
||||
form *apimodel.StatusCreateRequest,
|
||||
accountDefaultVis gtsmodel.Visibility,
|
||||
status *gtsmodel.Status,
|
||||
) error {
|
||||
|
|
@ -356,16 +356,16 @@ func processVisibility(
|
|||
status.Visibility = gtsmodel.VisibilityDefault
|
||||
}
|
||||
|
||||
// Set federated flag to form value
|
||||
// if provided, or default to true.
|
||||
federated := util.PtrOrValue(form.Federated, true)
|
||||
status.Federated = &federated
|
||||
// Set federated according to "local_only" field,
|
||||
// assuming federated (ie., not local-only) by default.
|
||||
localOnly := util.PtrOrValue(form.LocalOnly, false)
|
||||
status.Federated = util.Ptr(!localOnly)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func processInteractionPolicy(
|
||||
_ *apimodel.AdvancedStatusCreateForm,
|
||||
_ *apimodel.StatusCreateRequest,
|
||||
settings *gtsmodel.AccountSettings,
|
||||
status *gtsmodel.Status,
|
||||
) error {
|
||||
|
|
@ -413,7 +413,7 @@ func processInteractionPolicy(
|
|||
return nil
|
||||
}
|
||||
|
||||
func processLanguage(form *apimodel.AdvancedStatusCreateForm, accountDefaultLanguage string, status *gtsmodel.Status) error {
|
||||
func processLanguage(form *apimodel.StatusCreateRequest, accountDefaultLanguage string, status *gtsmodel.Status) error {
|
||||
if form.Language != "" {
|
||||
status.Language = form.Language
|
||||
} else {
|
||||
|
|
@ -425,7 +425,7 @@ func processLanguage(form *apimodel.AdvancedStatusCreateForm, accountDefaultLang
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *Processor) processContent(ctx context.Context, parseMention gtsmodel.ParseMentionFunc, form *apimodel.AdvancedStatusCreateForm, status *gtsmodel.Status) error {
|
||||
func (p *Processor) processContent(ctx context.Context, parseMention gtsmodel.ParseMentionFunc, form *apimodel.StatusCreateRequest, status *gtsmodel.Status) error {
|
||||
if form.ContentType == "" {
|
||||
// If content type wasn't specified, use the author's preferred content-type.
|
||||
contentType := apimodel.StatusContentType(status.Account.Settings.StatusContentType)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue