~netlandish/links-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
1

[PATCH links] Fix error fetching payment history

Details
Message ID
<20250628150048.21436-1-peter@netlandish.com>
Sender timestamp
1751101242
DKIM signature
missing
Download raw message
Patch: +7 -7
---
 api/graph/schema.resolvers.go | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/api/graph/schema.resolvers.go b/api/graph/schema.resolvers.go
index 956e692..e056216 100644
--- a/api/graph/schema.resolvers.go
+++ b/api/graph/schema.resolvers.go
@@ -4945,13 +4945,13 @@ func (r *queryResolver) GetPaymentHistory(ctx context.Context, input *model.GetP
				WithCode(valid.ErrNotFoundCode)
			return nil, nil
		}
		org = orgs[0]

		if !user.IsSuperUser() && !org.CanRead(ctx, user) {
			validator.Error("%s", lt.Translate("This user is not allowed to perform this action")).
				WithCode(valid.ErrNotFoundCode)
			return nil, nil
		}
		org = orgs[0]
	}

	opts = &database.FilterOptions{
@@ -6618,28 +6618,28 @@ func (r *queryResolver) GetAuditLogs(ctx context.Context, input *model.AuditLogI
		return nil, nil
	}

	var userId int
	var userID int
	if org == nil && !user.IsSuperUser() {
		userId = int(user.ID)
		userID = int(user.ID)
	}

	if input.UserID != nil && *input.UserID > 0 {
		if user.IsSuperUser() {
			userId = *input.UserID
			userID = *input.UserID
		} else if *input.UserID != int(user.ID) {
			if org != nil {
				// If the given user was never part of the organization, no records would be returned.
				// However if a user is removed from an organization we still want to be able to
				// view their audit logs
				userId = *input.UserID
				userID = *input.UserID
			}
		}
	}

	if userId > 0 {
	if userID > 0 {
		opts.Filter = sq.And{
			opts.Filter,
			sq.Eq{"al.user_id": userId},
			sq.Eq{"al.user_id": userID},
		}
	}

-- 
2.49.0
Details
Message ID
<DAY9C8JTYYWR.2N3R5NWYV4YRJ@netlandish.com>
In-Reply-To
<20250628150048.21436-1-peter@netlandish.com> (view parent)
Sender timestamp
1751101521
DKIM signature
missing
Download raw message
Applied.

To git@git.code.netlandish.com:~netlandish/links
   23918f3..bf24123  master -> master
Reply to thread Export thread (mbox)