diff options
author | 2022-04-15 14:33:01 +0200 | |
---|---|---|
committer | 2022-04-15 14:33:01 +0200 | |
commit | 26683b3d49beea9b1f0e8f78df4720285d4c0825 (patch) | |
tree | 06bf09cdee7a60c41947a0bd03d6a42ad83ee784 /internal/db/bundb/account.go | |
parent | [bugfix] Fix broken only_media and only_public flags on /api/v1/accounts/:id/... (diff) | |
download | gotosocial-26683b3d49beea9b1f0e8f78df4720285d4c0825.tar.xz |
[feature] Web profile pages for accounts (#449)
* add default avatars
* allow webModule to error
* return errWithCode from account get
* add AccountGetLocalByUsername
* check nil requesting account
* add timestampShort function for just month/year
* move loading logic to New + add default avatars
* add profile page view
* update swagger docs
* add excludeReblogs to GetAccountStatuses
* ignore casing when selecting local account by username
* appropriate redirects
* css fiddling
* add 'about' heading
* adjust thread page to work with routing
* return AP representation if requested + authorized
* simplify auth check
* go fmt
* golangci-lint ignore math/rand
Diffstat (limited to 'internal/db/bundb/account.go')
-rw-r--r-- | internal/db/bundb/account.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/db/bundb/account.go b/internal/db/bundb/account.go index 50b0bfa38..876fb5186 100644 --- a/internal/db/bundb/account.go +++ b/internal/db/bundb/account.go @@ -199,7 +199,7 @@ func (a *accountDB) GetLocalAccountByUsername(ctx context.Context, username stri account := new(gtsmodel.Account) q := a.newAccountQ(account). - Where("username = ?", username). + Where("LOWER(?) = LOWER(?)", bun.Ident("username"), username). // ignore casing WhereGroup(" AND ", whereEmptyOrNull("domain")) if err := q.Scan(ctx); err != nil { @@ -230,7 +230,7 @@ func (a *accountDB) CountAccountStatuses(ctx context.Context, accountID string) Count(ctx) } -func (a *accountDB) GetAccountStatuses(ctx context.Context, accountID string, limit int, excludeReplies bool, maxID string, minID string, pinnedOnly bool, mediaOnly bool, publicOnly bool) ([]*gtsmodel.Status, db.Error) { +func (a *accountDB) GetAccountStatuses(ctx context.Context, accountID string, limit int, excludeReplies bool, excludeReblogs bool, maxID string, minID string, pinnedOnly bool, mediaOnly bool, publicOnly bool) ([]*gtsmodel.Status, db.Error) { statuses := []*gtsmodel.Status{} q := a.conn. @@ -250,6 +250,10 @@ func (a *accountDB) GetAccountStatuses(ctx context.Context, accountID string, li q = q.WhereGroup(" AND ", whereEmptyOrNull("in_reply_to_id")) } + if excludeReblogs { + q = q.WhereGroup(" AND ", whereEmptyOrNull("boost_of_id")) + } + if maxID != "" { q = q.Where("id < ?", maxID) } |