~netlandish/links-dev

links: Fix error fetching payment history v1 APPLIED

Peter Sanchez: 1
 Fix error fetching payment history

 1 files changed, 7 insertions(+), 7 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.code.netlandish.com/~netlandish/links-dev/patches/154/mbox | git am -3
Learn more about email & git

[PATCH links] Fix error fetching payment history Export this patch

---
 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
Applied.

To git@git.code.netlandish.com:~netlandish/links
   23918f3..bf24123  master -> master