Commit Graph

783 Commits

Author SHA1 Message Date
Adnan Maolood a4ef456246 api/trackers: Always clear import flag on import error 2023-02-20 10:39:29 +01:00
Conrad Hoffmann ed005d6b4f Send out notifications to users via meta.sr.ht GQL
This moves handling of (potentially) encrypted emails into the
meta.sr.ht API. Emails to external addresses are still sent
(unencrypted) via the core.sr.ht Pyhon module.
2023-01-26 10:04:57 +01:00
Adnan Maolood 5c4ba72503 schema.sql: Fix syntax error 2023-01-26 09:55:45 +01:00
Adnan Maolood fc70ae13a4 api: Implement tracker dump signature verification
Changes the ticket and comment signature format to remove useless
fields.

Also updates the frontend to use the GraphQL API for tracker dump
imports.
2022-11-10 11:28:56 +01:00
Adnan Maolood 9f4e4b5a0b api/imports: Make loaders available in context 2022-11-10 11:28:55 +01:00
Adnan Maolood 2422df8a4f api/trackers: Rename from api/imports 2022-11-10 11:28:50 +01:00
Drew DeVault d1c0e43b66 API: implement user account deletion 2022-11-01 15:57:29 +01:00
Adnan Maolood a26fc1fbfd todosrht: Use canonical user IDs
Update user IDs across todo.sr.ht to match those of meta.sr.ht.
2022-10-26 10:47:57 +02:00
Drew DeVault 30084360aa API: upgrade gqlgen 2022-10-20 15:31:20 +02:00
Adnan Maolood e02ddb0888 api: Implement tracker dump imports
This currently does not support authenticating the imported data.
2022-09-29 10:39:44 +02:00
Thorben Günther 4827e61f97 Fix flask send_file arguments
The deprecated attachment_filename was removed in a recent flask release
and is superseded by download_name [1].

[1]: https://github.com/pallets/flask/pull/4667
2022-09-29 10:38:25 +02:00
Adnan Maolood ec4fdf350d todosrht/access: Fetch trackers case-sensitively 2022-09-06 15:37:17 +02:00
Drew DeVault 050c219153 all: deal with nil participant ID
This can happen in the case of EVENT_TICKET_MENTIONED. In the future we
might want to consider swapping ByParticipantID for ParticipantID in the
database for these events.
2022-09-05 15:51:30 +02:00
Adnan Maolood 6517544340 Add schema.sql 2022-08-17 10:05:15 +02:00
Simon Ser c4bfcd1ff7 Add CLOSED ticket resolution
This is a neutral resolution picked by default when the user doesn't
need/want to select a more precise resolution.
2022-07-25 13:44:18 +02:00
Adnan Maolood 75add26e2f api/graph: Fix duplicates in User.trackers query
Fixes: https://todo.sr.ht/~sircmpwn/todo.sr.ht/273
2022-07-24 09:27:03 +02:00
Adnan Maolood 268dacdc07 api/graph/model: Fix Tracker.QueryWithCursor 2022-06-29 17:22:01 +02:00
Adnan Maolood c116c0db22 api/graph: Conform to WebhookSubscription 2022-06-29 17:22:00 +02:00
Dean Weaver e93dff9824 Fix user mentions for usernames with a dash 2022-06-29 17:12:38 +02:00
Thorben Günther 0bb9ef9657 api/webhooks: Fix deletion error message for tickets 2022-06-14 10:09:19 +02:00
Adnan Maolood 0da003766d Update core-go 2022-05-30 14:19:15 +02:00
Adnan Maolood cdf9a77c46 api/graph: Ensure access when creating webhooks
Ensure that the user has access to the ticket/tracker when creating
ticket/tracker webhooks.
2022-05-30 13:36:08 +02:00
Adnan Maolood af242ca93e api/webhooks: Fix ticket/tracker webhook queries
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.
2022-05-30 13:35:56 +02:00
Adnan Maolood f299d2f9a9 api/graph: Fix webhook subscription name 2022-05-30 13:35:06 +02:00
Adnan Maolood 7d65b3653c api/graph: Implement ticket deletion 2022-05-16 13:15:29 +02:00
Adnan Maolood 5650249985 todosrht: Fix 405 error when clicking 'next' in ticket list
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.
2022-05-16 13:13:02 +02:00
Conrad Hoffmann 833e2a5588 Add api-origin to example config
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).
2022-05-10 10:30:23 +02:00
Adnan Maolood b779d41133 todosrht: Use proper access for Resolve button 2022-05-09 16:13:36 +02:00
Adnan Maolood 1e32f8eb9b api/loaders: Fix tracker queries 2022-05-09 16:13:31 +02:00
Adnan Maolood 322b245f4b api/graph/events: Fix query 2022-05-06 15:00:46 +02:00
Drew DeVault b7a3c26d24 API: Update core-go 2022-05-05 10:56:54 +02:00
Adnan Maolood b3e13fc94d api/graph/events: Use submitter info instead of auth info
Use the name and email of the submitter of the ticket for sending event
emails instead of the name and email of the currently authenticated
user.
2022-05-05 10:54:43 +02:00
Adnan Maolood 2521148108 api/graph/events: Add more headers 2022-05-05 10:54:43 +02:00
Adnan Maolood 10d9d29edb todosrht-lmtp: Use GraphQL for comment submission
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
2022-05-03 08:23:58 +02:00
Adnan Maolood 75a118a77d api/graph: Bump updated timestamps where necessary 2022-05-03 08:23:51 +02:00
Adnan Maolood 357ced1876 api/webhooks: Fix legacy event:create ticket id 2022-05-03 08:23:38 +02:00
Adnan Maolood e84fbbdddb api/graph: Improve error handling
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
2022-05-03 08:23:37 +02:00
Adnan Maolood 4b8eba4944 api/webhooks: Fix legacy event:create 'comment' webhook 2022-04-29 11:48:55 +02:00
Adnan Maolood fc6eecd33f api/graph: Make mutations return non-null values
References: https://todo.sr.ht/~sircmpwn/sr.ht/300
2022-04-29 11:09:53 +02:00
Adnan Maolood 646b1e55db api/graph: Add User.tracker query
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
2022-04-29 11:09:52 +02:00
Adnan Maolood 8dd35065ed api/graph: Make createLabel consistent with updateLabel
Rename createLabel parameter names to match those used in
UpdateLabelInput.
2022-04-29 11:09:50 +02:00
Adnan Maolood 9a205600aa api/graph: Implement GraphQL-native ticket webhooks
Implement GraphQL-native ticket webhooks for ticket CRUD operations.
2022-04-29 11:09:40 +02:00
Adnan Maolood f495ccdf32 api/graph: Implement GraphQL-native tracker webhooks
Implement GraphQL-native tracker webhooks for tracker, label, and ticket
CRUD operations.
2022-04-29 11:09:39 +02:00
Adnan Maolood 467dd4075f api/webhooks: Fix legacy ticket event:create webhooks
Look up ticket webhook subscriptions by the ticket ID instead of the
ticket scoped_id.
2022-04-28 12:49:59 +02:00
Adnan Maolood 4c2e2792fa api/graph: Set resolution = UNRESOLVED for open tickets
Set resolution = UNRESOLVED for ticket statuses other than RESOLVED in
UpdateTicketStatus.
2022-04-28 12:49:59 +02:00
Adnan Maolood 037e2bf9fe todosrht: Use GraphQL for ticket CRUD operations
Use GraphQL for the remaining ticket CRUD operations.
2022-04-28 12:49:36 +02:00
Adnan Maolood 071d6ca781 api/server: Register @private directive 2022-04-18 11:14:28 +02:00
Drew DeVault 23ed990f12 Updates per jinja2 breaking changes 2022-04-11 22:10:33 +02:00
Adnan Maolood 67c96a4a54 todosrht-lmtp: Commit transaction before calling exec_gql
Commit the current transaction before calling exec_gql to ensure that
the senderId passed to the GraphQL API is always valid.
2022-04-11 11:27:28 +02:00
Adnan Maolood a250ca81ff todosrht-lmtp: Use tracker owner for exec_gql
Use the tracker owner as the user for exec_gql since the sender user may
be None (e.g. in the case of an email not associated with a user).
2022-04-11 11:27:27 +02:00