~sircmpwn/lists.sr.ht

user.py: filter out mailing lists w/o browse
api: fix access checks

We were checking that the access entry had the required permissions,
but weren't checking that the access entry was for the right user.

Reported-by: Thorben Günther <admin@xenrox.net>
api: fix crash in triggerUserEmailWebhooks

A user can have post permissions for a private list that they cannot
browse. If this happens, the triggerUserEmailWebhooks mutation, which
gets triggered for every incoming email, currently crashes. This, in
turn causes an exception in lists.sr.ht-process in `dispatch_message`,
causing such emails to be never forwarded to list members.

The `emailsByIdLoader` rightfully refuses to load the email, so handle
this by allowing the mutation to return `nil` and return early. It is
arguably more correct to deny user webhooks for emails that are
inaccessible to the user anyways.

The internal mutation is currently only used in one place that does not
use the result, so no further changes are necessary.
Fix alembic history fork
schema: Rename SQL indexes to PostgreSQL-style

References: https://todo.sr.ht/~sircmpwn/sr.ht/306
api/webhooks: Deliver PATCHSET_RECEIVED user webhooks
schema: Add missing PATCHSET_RECEIVED user event
Move go.mod to root
Upgrade to Alpine 3.17
API: migrate list deletion to a worker

This can take a while so let's not block the request on it.
Make thread block parsing errors non-fatal
api/graph: skip emails with decoding errors in threadResolver.Blocks

Some emails can have a bad encoding, a bad charset, a bad header
field, etc. Skip these so that we can try to return a partial thread.

Ideally we'd return a list of errors alongside the partial thread,
but gqlgen doesn't support this yet.
api/lists: Fix logging
listssrht: Use list owner to authenticate query

Use the list owner to authenticate the GraphQL query. This fixes the
patch page when logged out.
Fix line offset for standalone feedback

The "index" argument was not specified for standalone feedback.

Fix this by grabbing the line offset from the feedback_block arg,
instead of using a separate arg.
Drop unnecessary if

That if is already wrapped in another if which checks for the same
condition, right above.
Rename line variable to line_index to improve clarity

The "line" variable is first assigned to the line string, then it's
overwritten with the line index. Use a different variable name to
reduce confusion.
Remove unused last_line variable
Fix permalinks for feedback blocks

They were linking to the Message-Id anchor. When a message contains
multiple feedback blocks, this is incorrect.

Use the feedback key instead.

While at it, remove the now unnecessary "body" param from
display_msg().
Simplify feedback variable in patchset template
Next