summaryrefslogtreecommitdiff
path: root/internal/db/bundb/status.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-12-15 14:24:39 +0000
committerLibravatar GitHub <noreply@github.com>2023-12-15 15:24:39 +0100
commitf4fcffc8b56ef73c184ae17892b69181961c15c7 (patch)
treeb678c44c9106e2ec8069dcf596a0554dee7410ab /internal/db/bundb/status.go
parent[bugfix] Let templates deref pointers, as a treat (#2448) (diff)
downloadgotosocial-f4fcffc8b56ef73c184ae17892b69181961c15c7.tar.xz
[bugfix] use a much shorter refresh limit for statuses with polls (#2453)v0.13.0
* specifically use a much shorter refresh limit for statuses with polls * allow specifying whether status must be upToDate in calls to Get(Visible)?TargetStatusBy_(), limit force refresh to 5 minute cooldown * remove the PollID check from statusUpToDate() * remove unnecessary force flag checks * remove unused field * check refresh status error * use argument name 'refresh' instead of 'upToDate' to better fit with the codebase * add statuses_poll_id_idx * remove the definitely-not copy-pasted comment i accidentally typed out in full * only synchronously refresh if the refresh flag is provided, otherwise do async * fix wrong force value being provided for async --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/db/bundb/status.go')
-rw-r--r--internal/db/bundb/status.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/db/bundb/status.go b/internal/db/bundb/status.go
index dd161e1ec..da252c7f7 100644
--- a/internal/db/bundb/status.go
+++ b/internal/db/bundb/status.go
@@ -87,6 +87,17 @@ func (s *statusDB) GetStatusByURL(ctx context.Context, url string) (*gtsmodel.St
)
}
+func (s *statusDB) GetStatusByPollID(ctx context.Context, pollID string) (*gtsmodel.Status, error) {
+ return s.getStatus(
+ ctx,
+ "PollID",
+ func(status *gtsmodel.Status) error {
+ return s.db.NewSelect().Model(status).Where("? = ?", bun.Ident("status.poll_id"), pollID).Scan(ctx)
+ },
+ pollID,
+ )
+}
+
func (s *statusDB) GetStatusBoost(ctx context.Context, boostOfID string, byAccountID string) (*gtsmodel.Status, error) {
return s.getStatus(
ctx,