Previously, we would only deliver tracker/ticket webhooks where the user
ID matched the currently authenticated user, which meant that
tracker/ticket webhooks for other users would not be delivered. This
updates the tracker/ticket webhook filters to allow other users to
receive webhook events while also ensuring that they have access to the
tracker.
When using the ticket preview feature, the URL would previously change
to /~user/tracker/submit. Attempting to navigate to the next page of
tickets afterwards would cause a 405 error since
/~user/tracker/submit?page=N is an invalid link.
Fix by changing the ticket submit route to /~user/tracker, so that
adding ?page=N results in a valid link.
If the service is not behind a reverse proxy (e.g. during local
development/testing) then this is needed by meta.sr.ht for API discovery
for all services that have a seperate API component. Add this (commented
out) to the example config, to make it easier to discover (and
require less documentation).
Use GraphQL to submit comments from incoming emails so that
GraphQL-native webhooks are delivered.
Also use comments to document internal GraphQL mutations instead of
docstrings.
References: https://todo.sr.ht/~sircmpwn/sr.ht/315
Make mutations return errors when the resource is not found. Also
improve the error message when renaming a label to an existing label
name.
References: https://todo.sr.ht/~sircmpwn/sr.ht/300
Replace the tracker, trackerByName and trackerByOwner queries with a new
User.tracker query which is more graph-like.
References: https://todo.sr.ht/~sircmpwn/sr.ht/309
In Go, an un-initialized `time.Time` has a value of "0" which the
GraphQL server will accept (as it is not `nil`) and PostgreSQL will
write it to the database. However, the API will afterwards fail to
return the creation date for this ticket, as the value is considered
null, but the ticket type defined to not allow null.
As a first step, prevent clients from creating tickets with the "0"
timestamp by adding a validation that checks the value.
References: https://todo.sr.ht/~sircmpwn/todo.sr.ht/259
Previously, SQL queries in SendEmail would return NULL for participant
types other than 'user' or 'email'. This would panic for participant
types like 'external' since NULL cannot be scanned to a string, which
caused the submitTicket mutation to fail when called with an externalId.
Fix by returning and checking for an empty string instead.
This takes advantages of the improvements to core-go/valid, which allow
us to remove various placeholder errors. This also fixes a few broken
error checks which call err.Error() even when the err is nil, causing a
panic on success.