summaryrefslogtreecommitdiff
path: root/internal/processing/status/util.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-08-02 19:06:44 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-02 19:06:44 +0200
commit0386a28b5a3c4212320e8a96ddd14c54b65a2090 (patch)
tree3bfdf198934215ac64acac9d66d952baf65c2752 /internal/processing/status/util.go
parentfix breaky linky (diff)
downloadgotosocial-0386a28b5a3c4212320e8a96ddd14c54b65a2090.tar.xz
Frodo swaggins (#126)
* more swagger fun * document a whole bunch more stuff * more swagger yayyyyyyy * progress + go fmt
Diffstat (limited to 'internal/processing/status/util.go')
-rw-r--r--internal/processing/status/util.go20
1 files changed, 8 insertions, 12 deletions
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
}