summaryrefslogtreecommitdiff
path: root/internal/gtsmodel/accountsettings.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-03-26 16:59:39 +0100
committerLibravatar GitHub <noreply@github.com>2025-03-26 15:59:39 +0000
commitb6e481d63eec15191f2717957682c13ee8a68308 (patch)
tree03cb9fc8bcb5f9eefddee754ad64b9de10c44c39 /internal/gtsmodel/accountsettings.go
parent[chore] bumps our spf13/viper version (#3943) (diff)
downloadgotosocial-b6e481d63eec15191f2717957682c13ee8a68308.tar.xz
[feature] Allow user to choose "gallery" style layout for web view of profile (#3917)
* [feature] Allow user to choose "gallery" style web layout * find a bug and squish it up and all day long you'll have good luck * just a sec * [performance] reindex public timeline + tinker with query a bit * fiddling * should be good now * last bit of finagling, i'm done now i prommy * panic normally
Diffstat (limited to 'internal/gtsmodel/accountsettings.go')
-rw-r--r--internal/gtsmodel/accountsettings.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/internal/gtsmodel/accountsettings.go b/internal/gtsmodel/accountsettings.go
index 4624aa0b1..30fb7e5df 100644
--- a/internal/gtsmodel/accountsettings.go
+++ b/internal/gtsmodel/accountsettings.go
@@ -18,6 +18,7 @@
package gtsmodel
import (
+ "strings"
"time"
)
@@ -35,9 +36,51 @@ type AccountSettings struct {
EnableRSS *bool `bun:",nullzero,notnull,default:false"` // enable RSS feed subscription for this account's public posts at [URL]/feed
HideCollections *bool `bun:",nullzero,notnull,default:false"` // Hide this account's followers/following collections.
WebVisibility Visibility `bun:",nullzero,notnull,default:3"` // Visibility level of statuses that visitors can view via the web profile.
+ WebLayout WebLayout `bun:",nullzero,notnull,default:1"` // Layout to use when showing this profile via the web.
InteractionPolicyDirect *InteractionPolicy `bun:""` // Interaction policy to use for new direct visibility statuses by this account. If null, assume default policy.
InteractionPolicyMutualsOnly *InteractionPolicy `bun:""` // Interaction policy to use for new mutuals only visibility statuses. If null, assume default policy.
InteractionPolicyFollowersOnly *InteractionPolicy `bun:""` // Interaction policy to use for new followers only visibility statuses. If null, assume default policy.
InteractionPolicyUnlocked *InteractionPolicy `bun:""` // Interaction policy to use for new unlocked visibility statuses. If null, assume default policy.
InteractionPolicyPublic *InteractionPolicy `bun:""` // Interaction policy to use for new public visibility statuses. If null, assume default policy.
}
+
+// WebLayout represents an account owner's
+// choice for how they want their profile to be
+// laid out via the web view, by default.
+type WebLayout enumType
+
+const (
+ WebLayoutUnknown WebLayout = 0
+
+ // "Classic" / default GtS microblog view.
+ WebLayoutMicroblog WebLayout = 1
+
+ // 'gram-style gallery view with media only.
+ WebLayoutGallery WebLayout = 2
+)
+
+// String returns a stringified, frontend
+// API compatible form of WebLayout.
+func (wrm WebLayout) String() string {
+ switch wrm {
+ case WebLayoutMicroblog:
+ return "microblog"
+ case WebLayoutGallery:
+ return "gallery"
+ default:
+ panic("invalid web layout")
+ }
+}
+
+// ParseWebLayout returns a web
+// layout from the given value.
+func ParseWebLayout(in string) WebLayout {
+ switch strings.ToLower(in) {
+ case "microblog":
+ return WebLayoutMicroblog
+ case "gallery":
+ return WebLayoutGallery
+ default:
+ return WebLayoutUnknown
+ }
+}