~bigbes/core-go

50a876e14c815eb4192cbc0d6bd08217c9a28bce — Maxwell G 9 months ago 77b64d2
webhooks: do not limit webhooks by token_hash

When a user re-authenticates with an OAuth2 app, the app would not be
able to query or delete webhooks it created with a previous session.
This was a problem for a tool I am developing and removing this
constraint fixes the issue.
1 files changed, 0 insertions(+), 2 deletions(-)

M webhooks/config.go
M webhooks/config.go => webhooks/config.go +0 -2
@@ 76,10 76,8 @@ func FilterWebhooks(ctx context.Context) (sq.Sqlizer, error) {
			sq.Expr(`auth_method = 'INTERNAL'`),
		}, nil
	} else if ac.ClientID != nil {
		// XXX: Should we maybe return all webhooks configured by client ID?
		return sq.And{
			sq.Expr(`NOW() at time zone 'utc' < expires`),
			sq.Expr(`token_hash = ?`, ac.TokenHash),
			sq.Expr(`client_id = ?`, *ac.ClientID),
			sq.Expr(`user_id = ?`, user.UserID),
		}, nil