diff options
author | 2024-12-04 09:35:48 +0000 | |
---|---|---|
committer | 2024-12-04 10:35:48 +0100 | |
commit | 3e18d97a6eb2a823af952392f1dd344abbe0addf (patch) | |
tree | 6130e8461927831097967c9e6d47053a0ba4eb40 /internal/db/bundb/poll.go | |
parent | [chore] bumps modernc/sqlite version to v1.34.2 on our custom fork (#3599) (diff) | |
download | gotosocial-3e18d97a6eb2a823af952392f1dd344abbe0addf.tar.xz |
[feature] unending polls (#3592)
* adds support for unending polls to be created locally
* remove unused argument
Diffstat (limited to 'internal/db/bundb/poll.go')
-rw-r--r-- | internal/db/bundb/poll.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/db/bundb/poll.go b/internal/db/bundb/poll.go index b9384774b..e8c3e7e54 100644 --- a/internal/db/bundb/poll.go +++ b/internal/db/bundb/poll.go @@ -88,12 +88,15 @@ func (p *pollDB) getPoll(ctx context.Context, lookup string, dbQuery func(*gtsmo func (p *pollDB) GetOpenPolls(ctx context.Context) ([]*gtsmodel.Poll, error) { var pollIDs []string - // Select all polls with unset `closed_at` time. + // Select all polls with: + // - UNSET `closed_at` + // - SET `expires_at` if err := p.db.NewSelect(). Table("polls"). Column("polls.id"). Join("JOIN ? ON ? = ?", bun.Ident("statuses"), bun.Ident("polls.id"), bun.Ident("statuses.poll_id")). Where("? = true", bun.Ident("statuses.local")). + Where("? IS NOT NULL", bun.Ident("polls.expires_at")). Where("? IS NULL", bun.Ident("polls.closed_at")). Scan(ctx, &pollIDs); err != nil { return nil, err |