~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH todo.sr.ht] api/graph: Fix duplicates in User.trackers query

Details
Message ID
<20220723120953.29105-1-me@adnano.co>
DKIM signature
pass
Download raw message
Patch: +3 -4
Fixes: https://todo.sr.ht/~sircmpwn/todo.sr.ht/273
---
 api/graph/model/tracker.go    | 6 +++---
 api/graph/schema.resolvers.go | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/api/graph/model/tracker.go b/api/graph/model/tracker.go
index ad52b48..d59166e 100644
--- a/api/graph/model/tracker.go
+++ b/api/graph/model/tracker.go
@@ -91,15 +91,15 @@ func (t *Tracker) QueryWithCursor(ctx context.Context, runner sq.BaseRunner,
	q = q.
		OrderBy(database.WithAlias(t.alias, "id")+" DESC").
		Limit(uint64(cur.Count+1)).
		LeftJoin(`user_access tr_ua ON tr_ua.tracker_id = tr.id AND tr_ua.user_id = ?`, auser.UserID).
		LeftJoin(`user_access ua ON ua.tracker_id = tr.id AND ua.user_id = ?`, auser.UserID).
		Column(`COALESCE(
			tr_ua.permissions,
			ua.permissions,
			CASE WHEN tr.owner_id = ?
				THEN ?
				ELSE tr.default_access
			END)`,
			auser.UserID, ACCESS_ALL).
		Column(`tr_ua.id`)
		Column(`ua.id`)

	if rows, err = q.RunWith(runner).QueryContext(ctx); err != nil {
		panic(err)
diff --git a/api/graph/schema.resolvers.go b/api/graph/schema.resolvers.go
index 40bbcd5..bbcb421 100644
--- a/api/graph/schema.resolvers.go
+++ b/api/graph/schema.resolvers.go
@@ -3225,7 +3225,6 @@ func (r *userResolver) Trackers(ctx context.Context, obj *model.User, cursor *co
		query := database.
			Select(ctx, tracker).
			From(`tracker tr`).
			LeftJoin(`user_access ua ON ua.tracker_id = tr.id`).
			Where(sq.And{
				sq.Expr(`tr.owner_id = ?`, obj.ID),
				sq.Or{
-- 
2.37.1

[todo.sr.ht/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CLN10BTT1RT9.O4KG8YSJHB4A@cirno>
In-Reply-To
<20220723120953.29105-1-me@adnano.co> (view parent)
DKIM signature
missing
Download raw message
todo.sr.ht/patches: SUCCESS in 3m58s

[api/graph: Fix duplicates in User.trackers query][0] from [Adnan Maolood][1]

[0]: https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/34108
[1]: me@adnano.co

✓ #807567 SUCCESS todo.sr.ht/patches/alpine.yml    https://builds.sr.ht/~sircmpwn/job/807567
✓ #807569 SUCCESS todo.sr.ht/patches/debian.yml    https://builds.sr.ht/~sircmpwn/job/807569
✓ #807568 SUCCESS todo.sr.ht/patches/archlinux.yml https://builds.sr.ht/~sircmpwn/job/807568
Details
Message ID
<CLNPIU40O170.11R0CG1DDHK7L@taiga>
In-Reply-To
<20220723120953.29105-1-me@adnano.co> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git@git.sr.ht:~sircmpwn/todo.sr.ht
   268dacd..75add26  master -> master
Reply to thread Export thread (mbox)