diff options
author | 2025-01-30 12:52:03 +0000 | |
---|---|---|
committer | 2025-01-30 13:52:03 +0100 | |
commit | 91cef3495d40d2af06b448b5871b1a8101fd6515 (patch) | |
tree | 31b053266dda48310ecc827145f02e731b8a0569 /internal/gtsmodel/account.go | |
parent | [bugfix] harden checks for remotes masquerading as local, and return correct ... (diff) | |
download | gotosocial-91cef3495d40d2af06b448b5871b1a8101fd6515.tar.xz |
[bugfix] Missing emoji urls (#3707)
* filter out emoji that are uncached when converting to frontend models
* some very small fixups
* remove TODO notice
Diffstat (limited to 'internal/gtsmodel/account.go')
-rw-r--r-- | internal/gtsmodel/account.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/internal/gtsmodel/account.go b/internal/gtsmodel/account.go index 79a35e561..bb07b8b16 100644 --- a/internal/gtsmodel/account.go +++ b/internal/gtsmodel/account.go @@ -31,7 +31,8 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/log" ) -// Account represents either a local or a remote fediverse account, gotosocial or otherwise (mastodon, pleroma, etc). +// Account represents either a local or a remote fediverse +// account, gotosocial or otherwise (mastodon, pleroma, etc). type Account struct { ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database CreatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item created. @@ -83,9 +84,19 @@ type Account struct { Stats *AccountStats `bun:"-"` // gtsmodel.AccountStats for this account. } +// UsernameDomain returns account @username@domain (missing domain if local). +func (a *Account) UsernameDomain() string { + if a.IsLocal() { + return "@" + a.Username + } + return "@" + a.Username + "@" + a.Domain +} + // IsLocal returns whether account is a local user account. func (a *Account) IsLocal() bool { - return a.Domain == "" || a.Domain == config.GetHost() || a.Domain == config.GetAccountDomain() + return a.Domain == "" || + a.Domain == config.GetHost() || + a.Domain == config.GetAccountDomain() } // IsRemote returns whether account is a remote user account. |