From 0386a28b5a3c4212320e8a96ddd14c54b65a2090 Mon Sep 17 00:00:00 2001 From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 2 Aug 2021 19:06:44 +0200 Subject: Frodo swaggins (#126) * more swagger fun * document a whole bunch more stuff * more swagger yayyyyyyy * progress + go fmt --- internal/processing/status/util.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'internal/processing/status/util.go') diff --git a/internal/processing/status/util.go b/internal/processing/status/util.go index f85e05478..31541ce71 100644 --- a/internal/processing/status/util.go +++ b/internal/processing/status/util.go @@ -21,22 +21,18 @@ func (p *processor) processVisibility(form *apimodel.AdvancedStatusCreateForm, a Likeable: true, } - var gtsBasicVis gtsmodel.Visibility - // Advanced takes priority if it's set. - // If it's not set, take whatever masto visibility is set. - // If *that's* not set either, then just take the account default. + var vis gtsmodel.Visibility + // If visibility isn't set on the form, then just take the account default. // If that's also not set, take the default for the whole instance. - if form.VisibilityAdvanced != nil { - gtsBasicVis = gtsmodel.Visibility(*form.VisibilityAdvanced) - } else if form.Visibility != "" { - gtsBasicVis = p.tc.MastoVisToVis(form.Visibility) + if form.Visibility != "" { + vis = p.tc.MastoVisToVis(form.Visibility) } else if accountDefaultVis != "" { - gtsBasicVis = accountDefaultVis + vis = accountDefaultVis } else { - gtsBasicVis = gtsmodel.VisibilityDefault + vis = gtsmodel.VisibilityDefault } - switch gtsBasicVis { + switch vis { case gtsmodel.VisibilityPublic: // for public, there's no need to change any of the advanced flags from true regardless of what the user filled out break @@ -82,7 +78,7 @@ func (p *processor) processVisibility(form *apimodel.AdvancedStatusCreateForm, a gtsAdvancedVis.Likeable = true } - status.Visibility = gtsBasicVis + status.Visibility = vis status.VisibilityAdvanced = gtsAdvancedVis return nil } -- cgit v1.2.3