]> git.ipfire.org Git - thirdparty/patchwork.git/log
thirdparty/patchwork.git
3 years agotox: pin max supported django version to v3.2.x
You-Sheng Yang [Tue, 7 Dec 2021 11:20:45 +0000 (19:20 +0800)] 
tox: pin max supported django version to v3.2.x

Django made a new release v4.0 supporting python3.8 and 3.9 today. This
breaks some test cases and need further inspectation.

See: #443
Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
3 years agoci: add docker-compose tests
You-Sheng Yang [Sat, 27 Nov 2021 09:40:15 +0000 (17:40 +0800)] 
ci: add docker-compose tests

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
[stephenfin: Removed release note, since this isn't user-facing]

3 years agoSwitch from Travis CI to GitHub Actions
Stephen Finucane [Fri, 19 Nov 2021 12:09:06 +0000 (12:09 +0000)] 
Switch from Travis CI to GitHub Actions

Travis has imposed quotas on builds that require us to contact them to
obtain OSS credits. The CI tool is irrelevant so long as builds do
happen, so switch to GitHub Actions for now. This is a little more
complicated that the switch for related projects like git-pw, given the
need for a database service. We may wish to investigate reusing some of
our own Docker files in the future but for now, this should do the
trick.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agotests: Tweak comment API tests
Stephen Finucane [Thu, 26 Aug 2021 17:18:31 +0000 (18:18 +0100)] 
tests: Tweak comment API tests

We were missing tests for 'GET /patch/{patch_id}/comment' (list patch
comments) and 'GET /cover/{cover_id}/comment' (list cover comments) when
using API version 1.2. In addition, we had effectively duplicated tests
by including explicit tests for API 1.3. These are unnecessary since we
default to testing against the latest version. Address both issues.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoparser: Add 'X-Patchwork-Action-Required' header
Stephen Finucane [Thu, 26 Aug 2021 17:18:30 +0000 (18:18 +0100)] 
parser: Add 'X-Patchwork-Action-Required' header

Allow submitters to indicate that their comment is something that needs
to be addressed.

Some minors issues are addressed in the docs while we're here.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agodocs: Document the address/unaddressed comment feature
Stephen Finucane [Thu, 26 Aug 2021 17:18:29 +0000 (18:18 +0100)] 
docs: Document the address/unaddressed comment feature

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoMake addressed/unaddressed workflow opt-in
Stephen Finucane [Thu, 26 Aug 2021 17:18:28 +0000 (18:18 +0100)] 
Make addressed/unaddressed workflow opt-in

The current workflow for the address/unaddressed attribute of comments
sets all comments to unaddressed by default. This is unintuitive, as it
assumes that all comments are actionable items. It also imposes a
massive burden on maintainers, who will need to manually sift through
every single comment received to a list and manually set the
non-actionable items as "addressed".

Change this workflow so that the 'addressed' field defaults to NULL.
This means maintainers or users must manually set this to False when
they're requesting additional feedback. This is currently possible via
the web UI or REST API. A future change will make it possible via a
custom mail header.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Cc: Raxel Gutierrez <raxel@google.com>
Cc: Daniel Axtens <dja@axtens.net>
4 years agorequirements: Pin jsonschema
Stephen Finucane [Thu, 28 Oct 2021 10:38:41 +0000 (11:38 +0100)] 
requirements: Pin jsonschema

The new 4.x release of jsonschema has borked our schemas for reasons I
do not yet fully understand (though I have an idea - see inline). Unbork
things now and fix our CI, while we work on a longer-term fix.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agotrivial: Stop universally disabling F405 check
Stephen Finucane [Wed, 29 Sep 2021 16:38:11 +0000 (17:38 +0100)] 
trivial: Stop universally disabling F405 check

We only need this for one file. Simply filter out the things we want to
ignore.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agorequirements: Bump psycopg2-binary, openapi-core
Stephen Finucane [Wed, 29 Sep 2021 14:58:01 +0000 (15:58 +0100)] 
requirements: Bump psycopg2-binary, openapi-core

Once again, openapi-core has moved stuff around internally. Nothing we
can't fix though, as it seems the thing moved is no longer necessary.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agotox: Use compatible minor releases
Stephen Finucane [Wed, 29 Sep 2021 14:53:04 +0000 (15:53 +0100)] 
tox: Use compatible minor releases

As we previously did for the requirements files (commit c90473ea44),
switch to use compatible releases for tox. We previously avoided doing
this on the basis that the existing system gave an idea of supported
package versions, but we weren't actually testing these combinations
since pip will always install the latest available version of each
package. This will apply to anyone using pip to manage their
dependencies, while anyone using distro packages can rely on the distro
having done this testing for them. Given the above, this makes our
effort to track supported ranges moot. So long as we cap newer versions
of e.g. django-filter when they're not compatible with older Django
versions, we should be good.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agorequirements: Bump Django to 3.2.x, django-filter to 21.1
Stephen Finucane [Wed, 29 Sep 2021 14:44:04 +0000 (15:44 +0100)] 
requirements: Bump Django to 3.2.x, django-filter to 21.1

It seems the ORM is now smarter and requires less JOINs that previously
in two tests. In addition, a new setting is required to ensure the type
of our primary field columns doesn't change when Django 4.0 is released.

We drop support for Django 3.1 in the process, though this doesn't have
much of a real-world impact since we still support Django 2.2, an LTS
release.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agorequirements: Bump doc requirements
Stephen Finucane [Tue, 28 Sep 2021 10:56:42 +0000 (11:56 +0100)] 
requirements: Bump doc requirements

We were suggesting we supported positively ancient versions of Sphinx
and reno in particular. Bump these.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoRevert "docs: prevent build error by rolling back Sphinx version"
Stephen Finucane [Tue, 28 Sep 2021 10:52:29 +0000 (11:52 +0100)] 
Revert "docs: prevent build error by rolling back Sphinx version"

This reverts commit 65547c8701004f1a2a9ed9d16f1a372f4bd856e4. There is a
new release of sphinxcontrib-httpdomain [1] that fixes the issues with
Sphinx 4.1.x and later [2]

[1] https://github.com/sphinx-contrib/httpdomain/releases/tag/1.8.0
[2] https://github.com/sphinx-contrib/httpdomain/pull/54

4 years agoREADME: Add Discord badge
Stephen Finucane [Fri, 3 Sep 2021 15:24:42 +0000 (16:24 +0100)] 
README: Add Discord badge

Add a Discord badge that can be used to connect to the server. Link
taken from daxtens' email to the list about the server [1].

[1] https://lists.ozlabs.org/pipermail/patchwork/2021-September/007226.html

Signed-off-by: Stephen Finucane <stephen@that.guru>
Cc: Daniel Axtens <dja@axtens.net>
[dja: change badge url to get users from the PW discord, not another
      mystery discord. Also, enable the PW discord to report its status
      via badges.]
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agomailmap: update email
raxelg [Tue, 31 Aug 2021 21:00:17 +0000 (17:00 -0400)] 
mailmap: update email

Update Google email used during internship to personal email.

Signed-off-by: Raxel Gutierrez <raxelgutierrez09@gmail.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agodocs: prevent build error by rolling back Sphinx version
Daniel Axtens [Mon, 23 Aug 2021 06:48:59 +0000 (16:48 +1000)] 
docs: prevent build error by rolling back Sphinx version

We're hitting a sphinxcontrib-httpdomain vs sphinx issue that was
causing the openapi part of doc builds to error out with:

<openapi>:1:Problem in http domain: field is supposed to use role 'obj', but that role is not in the domain.

See https://github.com/sphinx-contrib/httpdomain/pull/51

Until it's fixed, hold back the Sphinx version to < 4.1.0

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
4 years agodocs: add release note for addressed/unaddressed comments
Raxel Gutierrez [Fri, 20 Aug 2021 04:50:30 +0000 (04:50 +0000)] 
docs: add release note for addressed/unaddressed comments

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agopatch-detail: add label and button for comment addressed status
Raxel Gutierrez [Fri, 20 Aug 2021 04:50:29 +0000 (04:50 +0000)] 
patch-detail: add label and button for comment addressed status

Add new label to patch and cover comments to show the status of whether
they are addressed or not and add an adjacent button to allow users to
change the status of the comment. Only users that can edit the patch
(i.e. patch author, delegate, project maintainers) as well as comment
authors can change the status of a patch comment. For cover comments,
there are no delegates, so only maintainers and cover/cover comment
authors can edit the status of the cover comment. Before [1] and after
[2] images for reference.

Use new comment detail REST API endpoint to update the addressed field
value when "Addressed" or "Unaddressed" buttons are clicked. After a
successful request is made, the appearance of the comment status label
and buttons are toggled appropriately. For unsuccessful requests (e.g.
network errors prevents reaching the server), the error message is
populated to the page. A future improvement on this behavior is to add
a spinner to the button to provide a feedback that the request is in a
pending state until it's handled.

[1] https://imgur.com/3ZKzgjN
[2] https://imgur.com/hWZrrnM

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agoapi: add auto-generated OpenAPI schema files
Raxel Gutierrez [Fri, 20 Aug 2021 04:50:28 +0000 (04:50 +0000)] 
api: add auto-generated OpenAPI schema files

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agoapi: add comments detail endpoint
Raxel Gutierrez [Fri, 20 Aug 2021 04:50:27 +0000 (04:50 +0000)] 
api: add comments detail endpoint

Add new endpoint for patch and cover comments at api/.../comments/<comment_id>.
This involves updating the API version to v1.3 to reflect the new
endpoints as a minor change, following the usual semantic versioning
convention.

The endpoint will make it possible to use the REST API to update the new
`addressed` field for individual patch and cover comments with JavaScript
on the client side. In the process of these changes, clean up the use of
the CurrentPatchDefault context so that it exists in base.py and can be
used throughout the API (e.g. Check and Comment REST endpoints).

The tests cover retrieval and update requests and also handle calls from
the various API versions. Also, they cover permissions for update
requests and handle invalid update values for the new `addressed` field.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
[dja: changes to not conflict with, and to adopt the changes in, fecf7c86c2c5
      various other minor changes as described on list]
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agomodels: change edit permissions for comments
Raxel Gutierrez [Fri, 20 Aug 2021 04:50:26 +0000 (04:50 +0000)] 
models: change edit permissions for comments

Change patch comments' edit permissions to match that of the patch
associated with the comment (i.e. patch author, project maintainers, and
delegate) and add permissions for both patch and cover comment authors
to be able to change the `addressed` status of comments as well. For
cover comments, add permissions to edit for cover submitter and project
maintainers.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agomodels: add addressed field
Raxel Gutierrez [Fri, 20 Aug 2021 04:50:25 +0000 (04:50 +0000)] 
models: add addressed field

Currently, there is no state or status associated with comments. In
particular, knowing whether a comment on a patch or cover letter is
addressed or not is useful for transparency and accountability in the
patch review and contribution process. This patch is backend setup for
tracking the state of patch and cover comments.

Add `addressed` boolean field to patch and cover comments to be able to
distinguish between unaddressed and addressed comments in the
patch-detail page.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
[dja: give the migration a more meaningful name]
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agotemplatetags: add utils template filters and tags
Raxel Gutierrez [Fri, 20 Aug 2021 04:50:24 +0000 (04:50 +0000)] 
templatetags: add utils template filters and tags

Add utils.py file to create template filters and tags that can be used
by most if not all objects in Patchwork. In particular, add a template
filter to get the plural verbose name of a model and add a template tag
that returns whether an object is editable by the current user. These
utilities will be used in an upcoming patch that adds the `addressed`
status label to patch and cover comments.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agoapi: change <pk> parameter to <cover_id> for cover comments endpoint
Raxel Gutierrez [Fri, 20 Aug 2021 04:50:23 +0000 (04:50 +0000)] 
api: change <pk> parameter to <cover_id> for cover comments endpoint

Rename cover lookup parameter `pk` to `cover_id` for the cover comments
list endpoints to disambiguate from the lookup parameter `comment_id` in
upcoming patches which introduces the cover comments detail endpoint.
This doesn't affect the user-facing API.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
[dja: fixup to apply on top of fecf7c86c2c5 and 0ed2feb26c84]
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agopatch-detail: left align message headers
Raxel Gutierrez [Fri, 20 Aug 2021 04:50:22 +0000 (04:50 +0000)] 
patch-detail: left align message headers

Change both of the message containers in the "Commit Message" and
"Comments" to have their content be left-aligned which improves the
proximity of items which boosts the efficiency of gathering information
and performing actions. Before [1] and after [2] images for reference.

[1] https://i.imgur.com/ji2ZINL.png
[2] https://i.imgur.com/Dtn8lm9.png

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agoREST: squish final open-codings of get_object_or_404
Daniel Axtens [Mon, 23 Aug 2021 07:29:53 +0000 (17:29 +1000)] 
REST: squish final open-codings of get_object_or_404

Basically, finish the job of commit fecf7c86c2c5 ("urls: Add missing path
converters for REST APIs"). With this commit, there are no more uses of
Http404 in patchwork/api

Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agourls: Add missing path converters for REST APIs
Stephen Finucane [Fri, 20 Aug 2021 21:57:51 +0000 (22:57 +0100)] 
urls: Add missing path converters for REST APIs

Almost all of the API endpoints expect numerical resource IDs, with
'/projects' being the sole exception. However, we were not actually
enforcing this anywhere. Instead, we were relying on the custom
'get_object_or_404' implementation used by 'GenericAPIView.retrieve' via
'GenericAPIView.get_object'. Unfortunately we weren't using this
everywhere, most notably in our handler for 'GET /patches/{id}/checks'.
The end result was a HTTP 500 due to a ValueError.

Resolve this by adding the path converters for all REST API paths in
'patchwork.urls', along with tests to prevent regressions going forward.
We also switch to the DRF variant of 'get_object_or_404' in some places
to provide additional protection.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Cc: Daniel Axtens <dja@axtens.net>
[dja: s/TypeError/ValueError/; dropped an unrelated change]
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agomigrations: ignore flake8 on 0041_python3
Daniel Axtens [Thu, 19 Aug 2021 03:04:26 +0000 (13:04 +1000)] 
migrations: ignore flake8 on 0041_python3

commit 3a979ed8bfc6 ("migrations: don't go to the db for 0041_python3 migration")
made a bunch of strings go past 79 characters, breaking flake8 checks.

`black` doesn't seem to fix this and reflowing the strings manually is
error-prone.

We're not really expecting future changes to this file so just don't run
flake8 against it.

Fixes: 3a979ed8bfc6 ("migrations: don't go to the db for 0041_python3 migration")
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agoREST: Don't error if a versioned field we would remove is absent
Daniel Axtens [Fri, 20 Aug 2021 14:57:58 +0000 (00:57 +1000)] 
REST: Don't error if a versioned field we would remove is absent

We remove fields that shouldn't be seen on old versions of the API.
This was done with `pop(field name)`, which will throw an exception
if the named field is absent from the data. However, sometimes if
a patch request is via an old API version, we hit this line without
ever having the field present.

This is odd, but not harmful and we definitely shouldn't 500.

Signed-off-by: Daniel Axtens <dja@axtens.net>
[stephenfin: Merge test into bug fix]
Signed-off-by: Stephen Finucane <stephen@that.guru>
Tested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Fixes: d944f17ec059 ("REST: Use versioning for modified responses")
Closes: #423
4 years agostatic: add rest.js to handle PATCH requests & respective responses
Raxel Gutierrez [Thu, 19 Aug 2021 04:20:23 +0000 (04:20 +0000)] 
static: add rest.js to handle PATCH requests & respective responses

Add `rest.js` file to have a utilities JavaScript module that can be
reused by any Patchwork JS files that make requests to the REST API. The
comments for each function follow the Google JS Style guide [1] which is
something that would be nice to have for better documented frontend code,
especially for JS modules that export functions like rest.js. In
particular, this patch provides the following function:

 - `updateProperty`: make PATCH requests that partially update the
   fields of an object given it's REST API endpoint specified by the
   caller. Also, the caller can specify the field(s) to modify and the
   associated content for update messages in the case of both failed
   successful requests that render to the current webpage. The caller
   receives whether the request was successful or not.

The `rest.js` module can be further expanded to support and provide
functions that allow for other requests (e.g. GET, POST, PUT) to the
REST API.

Also, add functions that handle update & error messages for these PATCH
requests that match the Django messages framework format and form error
styling. These functions are internal to the module and aren't exposed
outside of the `rest.js` file.

Error and accompanying failed update messages are replaced by successful
update messages and vice versa. Consecutive successful update messages
add to a counter of updated objects. Consecutive error messages stack up.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
4 years agomessages: clean up messages and errors containers
Raxel Gutierrez [Tue, 17 Aug 2021 21:31:40 +0000 (21:31 +0000)] 
messages: clean up messages and errors containers

Refactor the messages container to make use of message.tags [1] which
allows for more customization for each level (e.g. success, warning,
error, etc.) of a message through CSS selectors. As basic proof of
concept, customize the text color of each existing message level. Also,
this addition resolves a TODO by stephenfin in the previous code.

Move the errors container after the messages container in the DOM in the
base.html template so that every template can share the same errors
container. Also, add a background color to the errors container so that
both containers blend in as a uniform block. Add bullet points to each
error item in the list of errors.

Change both the messages and errors containers to always exist in
the DOM. With this, the addition of update and error messages is simpler
because it eliminates the need to create the containers if they don't
exist. These changes will be useful in a following patch that introduces
an internal JS module to make client-side requests to the REST API.

[1] https://docs.djangoproject.com/en/3.2/ref/contrib/messages/#message-tags

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
[dja: converted HTML comment to django template comment, thanks sfin]
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agohtdocs: Fix formatting issues with README
Stephen Finucane [Sun, 9 Sep 2018 01:18:23 +0000 (19:18 -0600)] 
htdocs: Fix formatting issues with README

You can't have spaces between a term and definition in a definition
list.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agohtdocs: Move all jQuery files from 'lib'
Stephen Finucane [Sun, 9 Sep 2018 01:14:35 +0000 (19:14 -0600)] 
htdocs: Move all jQuery files from 'lib'

These were previously symlinked, for reasons that I cannot fathom. Just
move them to where they are moved. In the future, we will probably want
to manage these with a package manager.

A README is removed as it mostly duplicated content already found in
'htdocs/README.rst'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agostatic: add JS Cookie library to get csrftoken for client-side requests
Raxel Gutierrez [Tue, 17 Aug 2021 21:33:49 +0000 (21:33 +0000)] 
static: add JS Cookie library to get csrftoken for client-side requests

Currently in Patchwork, requests are made only through older methods via
form submissions, which means the UI is rendered strictly server-side.
This lags behind more modern and versatile approaches that use
JavaScript to send requests and dynamically update the UI based on the
respective responses.

In order to make REST API requests on the client-side secure from CSRF
attacks, add the JS Cookie library which allows the CSRF token to be
passed in the request header. A following patch that introduces the
`rest.js` module will make use of the JS Cookie library in this patch.

The library is a recommendation from Django docs [1]. The files for the
library can be downloaded in the releases page of the GitHub [2].

[1] https://docs.djangoproject.com/en/3.2/ref/csrf/#ajax
[2] https://github.com/js-cookie/js-cookie/releases

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
4 years agopatch-detail: change patch info toggles from links to buttons
Raxel Gutierrez [Fri, 13 Aug 2021 05:31:21 +0000 (05:31 +0000)] 
patch-detail: change patch info toggles from links to buttons

Change toggle links (i.e. show/hide and expand/collapse) in patch info
section to buttons because links normally suggest movement to another
page whereas buttons indicate an action on the current page. Also,
buttons have a bigger clickable area which boosts the efficiency of
the toggle actions.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
4 years agopatch-detail: refactor JS code into submission.js
Raxel Gutierrez [Fri, 13 Aug 2021 05:31:20 +0000 (05:31 +0000)] 
patch-detail: refactor JS code into submission.js

Move submission.html script code for toggling header info to a separate
submission.js file that makes the code easy to read and ready for change
in one place.

The listener is moved from the 'href' to separate, explicit click
listener.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
[stephenfin: Removed existing JS href added in previous change and
             update commit message to reflect this]
Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agopatch-detail: clean up patch detail page template
Raxel Gutierrez [Fri, 13 Aug 2021 05:31:19 +0000 (05:31 +0000)] 
patch-detail: clean up patch detail page template

Clean up submission.html to have hyphen-delimited id and class selectors
names for better readability and code health.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
[stephenfin: temporarily re-add removed toggle-div JS]
Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoapi: change <pk> parameter to <patch_id> for comments endpoint
Raxel Gutierrez [Fri, 13 Aug 2021 05:31:18 +0000 (05:31 +0000)] 
api: change <pk> parameter to <patch_id> for comments endpoint

Refactor patch lookup parameter `pk` to `patch_id` for the comments list
endpoint to disambiguate from the lookup parameter `comment_id` in an
upcoming patch which introduces the comments detail endpoint. This
doesn't affect the user-facing API.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
4 years agomigrations: don't go to the db for 0041_python3 migration
Daniel Axtens [Fri, 16 Jul 2021 17:19:37 +0000 (03:19 +1000)] 
migrations: don't go to the db for 0041_python3 migration

When we moved to Python 3, makemigrations wanted to change a bunch of
things, see commit 4ad87ed72aec ("migrations: Add the Python 3 patch").

The change is, as observed then, just to make django happy; it's not
supposed to change the database at all.

So make the migration change the state as seen by Django only.
This makes the migration ~instant, even for a huge database.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
Related: #420

4 years agodocs: clarify and improve docker dev docs
Daniel Axtens [Tue, 22 Jun 2021 07:59:37 +0000 (17:59 +1000)] 
docs: clarify and improve docker dev docs

The docker dev docs:

 - had the links for docker and docker-compose swapped.

 - had a old docker install link.

 - lacked an up-front explanation of the requirement that a regular user
   be able to manage the docker daemon (and a fairly unhelpful reference
   link in the most appropriate note block.)

Fix it all.

Reported-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agodocker: install Python 3.9
Daniel Axtens [Wed, 23 Jun 2021 01:19:36 +0000 (11:19 +1000)] 
docker: install Python 3.9

Since commit 9a54bf4bfc54 ("Add Python 3.9 support"), Python 3.9 is tested
by tox, so currently `docker-compose run web --tox` fails due to missing
Py3.9 binaries. Fix it.

Fixes: 9a54bf4bfc54 ("Add Python 3.9 support")
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agotests: fix parallel tests
Daniel Axtens [Tue, 22 Jun 2021 15:03:19 +0000 (01:03 +1000)] 
tests: fix parallel tests

Parallel tests require:

 - the % wildcard to be in a token enclosed by backticks, not single
   quotes

 - that the user still be able to use 'test_patchwork' (so we don't want
   the \_ before the %)

Presumably this was skipped because if you get permissions working
manually but you miss part of the required permissions in the automated
script, you need to delete the old db data in order to observe the
issue.

Amusingly postgres worked the whole time.

Fixes: 6025f0e2533f ("Add parallel testing")
Signed-off-by: Daniel Axtens <dja@axtens.net>
4 years agotests: Move view tests to their own directory
Stephen Finucane [Sat, 6 Mar 2021 15:12:00 +0000 (15:12 +0000)] 
tests: Move view tests to their own directory

This lets our unit tests mirror the main code structure and highlights
gaps in coverage.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agotests: Simplify mbox tests
Stephen Finucane [Sat, 6 Mar 2021 15:35:01 +0000 (15:35 +0000)] 
tests: Simplify mbox tests

There's no need for these to have to go through the client machinery.
Simply test the functions generating the responses.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoOnly show unique checks
Stephen Finucane [Sat, 6 Mar 2021 14:54:59 +0000 (14:54 +0000)] 
Only show unique checks

Commit e5c641fc4 optimized fetching of checks when displaying a patch by
prefetching these checks ahead of time. Unfortunately we missed that
this should exclude older versions of checks for a given context. Make
the code used to generate the unique checks generic and allow us to use
that as a filter to the checks provided to the template, restoring the
correct behavior.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #398
Fixes: e5c641fc4 ("Optimise fetching checks when displaying a patch")
4 years agolib: Correct PatchComment table
Stephen Finucane [Wed, 24 Feb 2021 15:26:08 +0000 (15:26 +0000)] 
lib: Correct PatchComment table

The table is 'patchwork_comment', not 'patchwork_patchcomment'. Correct
this.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #396
Fixes: 7b967db4 ("lib: Update DB permissions to reflect model changes")
4 years agoapi: do not fetch every patch in a patch detail view 404 (v2)
Stephen Finucane [Wed, 24 Feb 2021 15:08:45 +0000 (15:08 +0000)] 
api: do not fetch every patch in a patch detail view 404 (v2)

Commit 08c5856 fixed an issue whereby a 404 on the aforementioned URL
could result in a large DB query due to DRF attempting to populate the
'related' list box with all patches on the instance. That was
accidentally reverted in commit fe07f30. "Unrevert" this change.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: fe07f30 ("Remove 'PatchRelationSerializer'")
Closes: #397
4 years agodocs: Refresh the guide for Ubuntu 20.04
Stephen Finucane [Sat, 20 Feb 2021 16:07:02 +0000 (16:07 +0000)] 
docs: Refresh the guide for Ubuntu 20.04

Nothing changes wrt package names, which is nice. We take the
opportunity to clarify some wording, however.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agodocs: Update docs to point to v3.0.0 release
Stephen Finucane [Sat, 20 Feb 2021 15:40:00 +0000 (15:40 +0000)] 
docs: Update docs to point to v3.0.0 release

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agodocs: Random Python 3 updates
Stephen Finucane [Sat, 20 Feb 2021 15:21:50 +0000 (15:21 +0000)] 
docs: Random Python 3 updates

Correct some documentation examples and other things to reflect the new,
Python 3-only world.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agodocs: Note UTF-8 requirements for databases
Stephen Finucane [Sat, 20 Feb 2021 15:12:53 +0000 (15:12 +0000)] 
docs: Note UTF-8 requirements for databases

MySQL 5.3 defaulted to 'latin1' encoding, meaning users would need to
explicitly configure their databases to use 'utf8'. Call this out.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #393
4 years agoAdd release note for #391
Stephen Finucane [Sat, 20 Feb 2021 14:50:27 +0000 (14:50 +0000)] 
Add release note for #391

Forgot to include this.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agomodels: Use parent model to get comment's 'list_archive_url'
Stephen Finucane [Sat, 20 Feb 2021 14:35:07 +0000 (14:35 +0000)] 
models: Use parent model to get comment's 'list_archive_url'

We were attempting to retrieve the 'list_archive_url' attribute from the
'PatchComment' or 'CoverComment' instances, rather than the parent
'Patch' and 'Cover' object, respectively. Correct this and add plenty of
tests to prevent this regressing.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: 02ffb1315 ("models: Add list archive lookup")
Closes: #391
4 years agourls: Convert to flask-style URL patterns
Stephen Finucane [Sat, 20 Feb 2021 13:08:04 +0000 (13:08 +0000)] 
urls: Convert to flask-style URL patterns

These are easier to grok that the old regex based paths, though three
of these are retained as an alternative to creating custom path
converters [1].

[1] https://docs.djangoproject.com/en/3.0/topics/http/urls/#registering-custom-path-converters

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agotests: Trivial formatting fixes
Stephen Finucane [Sat, 20 Feb 2021 12:34:43 +0000 (12:34 +0000)] 
tests: Trivial formatting fixes

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agourls: Support sha256-based tokens
Stephen Finucane [Sat, 20 Feb 2021 12:22:08 +0000 (12:22 +0000)] 
urls: Support sha256-based tokens

Django 3.1 changed the default hashing algorithm used for things like
password reset tokens from SHA-1 to SHA-256. As noted in the release
notes [1], this is configurable via the 'DEFAULT_HASHING_ALGORITHM'
transitional setting, but that's only intended to allow upgrades of
multiple instances in a HA deployment and shouldn't be used post
upgrade. Instead, we need to fix our URLs to support the longer tokens
generated by SHA-256.

Long term, we want to replace these regex-based routes with the simpler
flask-style template string routes. That's not really backportable so
we'll do that separately.

[1] https://docs.djangoproject.com/en/3.1/releases/3.1/#default-hashing-algorithm-settings

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #394
4 years agotests: Fix compatibility with openapi_core 0.13.7
Stephen Finucane [Sat, 20 Feb 2021 13:27:08 +0000 (13:27 +0000)] 
tests: Fix compatibility with openapi_core 0.13.7

It seems the 'openapi_core.schema.schemas.models.Format' mechanism of
defining custom formatters was deprecated in openapi_core 0.12.0 but we
never noticed. They've finally broken it in 0.13.7. Switch to the new
thing, 'openapi_core.unmarshalling.schemas.formatters.Formatter', which
expects a slightly different format.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #395
4 years agodocs: Update reno for stable/3.0
Stephen Finucane [Sun, 4 Oct 2020 11:22:18 +0000 (12:22 +0100)] 
docs: Update reno for stable/3.0

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoPost-release version bump
Stephen Finucane [Sun, 4 Oct 2020 11:19:00 +0000 (12:19 +0100)] 
Post-release version bump

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoRelease 3.0.0 v3.0.0
Stephen Finucane [Sun, 4 Oct 2020 11:18:11 +0000 (12:18 +0100)] 
Release 3.0.0

Major version bump because of Python 2.7 removal and the unfortunately
large DB migration.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoAdd Python 3.9 support
Stephen Finucane [Sun, 13 Dec 2020 20:06:50 +0000 (20:06 +0000)] 
Add Python 3.9 support

This has been out since October. Time to support it.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agorequirements: Switch to openapi-core 0.13.4
Stephen Finucane [Sun, 13 Dec 2020 19:44:53 +0000 (19:44 +0000)] 
requirements: Switch to openapi-core 0.13.4

In commit b7f3c3d34 ("tests: Switch to openapi-core 0.13.x") we added
support for 'openapi-core' 0.13.x. However, we needed to use a commit
from master since an important fix [1] was not included in the latest
release at the time, 0.13.3. 0.13.4 has since been released so let's
move on and use that.

[1] https://github.com/p1c2u/openapi-core/issues/226

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoRe-enable django-dbbackup
Stephen Finucane [Sun, 13 Dec 2020 19:16:38 +0000 (19:16 +0000)] 
Re-enable django-dbbackup

...and bump to 3.3.0, which does support Django 3.0 [1].

[1] https://github.com/django-dbbackup/django-dbbackup/issues/314#issuecomment-613608064

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agorequirements: Bump django-debug-toolbar to 3.2.x
Stephen Finucane [Sun, 13 Dec 2020 19:15:17 +0000 (19:15 +0000)] 
requirements: Bump django-debug-toolbar to 3.2.x

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoAdd release note for #379
Stephen Finucane [Sun, 13 Dec 2020 18:34:47 +0000 (18:34 +0000)] 
Add release note for #379

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoREST: Null out previous, current relation info
Stephen Finucane [Sun, 29 Nov 2020 12:50:22 +0000 (12:50 +0000)] 
REST: Null out previous, current relation info

These fields don't work like we expect them to. Because we're linking to
a non-idempotent entity, an instance of 'relation', what we're storing
in either of these fields is subject to change as patches are added and
removed. This makes the information pretty much useless after the fact.
It's best to just state the patch and request that people query the
information themselves if necessary. We don't want to remove the field
entirely from the API - that would be a truly breaking change - so
instead we null it out like we do for patch tags. In a v2 API (i.e. a
major version bump) we can remove this entirely.

A small bug with the schema generation is corrected.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Related: #379

4 years agoRemove 'PatchRelationSerializer'
Stephen Finucane [Thu, 1 Oct 2020 13:38:31 +0000 (14:38 +0100)] 
Remove 'PatchRelationSerializer'

This wasn't writeable for reasons I haven't been able to figure out.
However, it's not actually needed: the 'PatchSerializer' can do the job
just fine, given enough information. This exposes a bug in DRF, which
has been reported upstream [1]. While we wait for that fix, or some
variant of it, to be merged, we must monkey patch the library.

[1] https://github.com/encode/django-rest-framework/issues/7550
[2] https://github.com/encode/django-rest-framework/pull/7574

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reported-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
Closes: #379
Cc: Daniel Axtens <dja@axtens.net>
Cc: Rohit Sarkar <rohitsarkar5398@gmail.com>
4 years agotests: Add tests for 'patch-relation-changed' events
Stephen Finucane [Sun, 4 Oct 2020 11:03:19 +0000 (12:03 +0100)] 
tests: Add tests for 'patch-relation-changed' events

This event is rather odd. If you have two patches then the way a
relation is created is by creating a 'PatchRelation' instance and then
setting the 'related' attribute on the first patch followed by the
second patch. Because the event uses the 'Patch' model's 'pre_save'
signal, we'll only see events for the patch being currently saved. This
means no event will be raised for the first patch and only one event,
the one for the second patch, will be raised when the second patch is
being added to the relationship.

In hindsight, the structure of the event is off. We should have had
something like a 'patch-added-to-relationship' and a
'patch-removed-from-relationship' event, both with the same fields:
'project', 'actor', 'patch' and 'related', the latter of which would
have listed all of the _other_ patches in the relationship. Sadly, this
is an API change which means we can't do it now. We may well wish to do
so in the future though.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agotests: Rework 'create_relation' helper
Stephen Finucane [Sun, 4 Oct 2020 10:42:42 +0000 (11:42 +0100)] 
tests: Rework 'create_relation' helper

This wasn't actually creating just a patch relation object - it was also
creating patches, which is something we already have an explicit helper
for. Clean this thing up.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agolib: Grant SELECT on auth_user
Stephen Finucane [Sat, 28 Nov 2020 17:32:32 +0000 (17:32 +0000)] 
lib: Grant SELECT on auth_user

If a mail arrives with the 'X-Patchwork-Delegate' hint header, the
'patchwork.parser' script will need to index the users table to find the
appropriate user. This should be okay from a security perspective since
passwords are hashed and salted and the rest of the information is
mostly accessible publicly via the web UI and REST API.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Suggested-by: Ali Alnubani <alialnu@mellanox.com>
Closes: #365
4 years agoviews/patch: Set correct encoding for patches
Toke Høiland-Jørgensen [Tue, 1 Dec 2020 21:15:11 +0000 (22:15 +0100)] 
views/patch: Set correct encoding for patches

The patch_mbox view returns text/plain data without specifying a character
set, which means clients will assume the default of iso-8559-1 as defined
in the HTTP/1.1 standard. Since the data being returned is in fact utf-8
encoded, set the encoding accordingly in the HTTP Content-Type header.

Reported-by: Jakub Kicinski <kuba@kernel.org>
Suggested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
4 years agorequirements: Bump sqlparse to 0.4.0
Stephen Finucane [Mon, 30 Nov 2020 09:31:48 +0000 (09:31 +0000)] 
requirements: Bump sqlparse to 0.4.0

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agorequirements: Add tblib
Stephen Finucane [Sun, 29 Nov 2020 13:01:42 +0000 (13:01 +0000)] 
requirements: Add tblib

This is needed by the parallel test runner to handle pickling of
tracebacks.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoAdd parallel testing
Stephen Finucane [Thu, 1 Oct 2020 15:28:58 +0000 (16:28 +0100)] 
Add parallel testing

This saves us a good deal of time, even allowing for process startup and
general overhead. Before:

  real    6m39.103s
  user    1m9.561s
  sys     0m2.705s

After:

  real    4m5.267s
  user    1m24.527s
  sys     0m3.828s

This requires N databases, where N is the N of processors on the host.
We need to update the docker configuration for this.

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agoRemove landscape.yaml
Stephen Finucane [Sun, 29 Nov 2020 12:11:26 +0000 (12:11 +0000)] 
Remove landscape.yaml

landscape.io is dead [1]. No point keeping this artefact around.

[1] https://landscape.io/landscapes-story-in-2016.html

Signed-off-by: Stephen Finucane <stephen@that.guru>
4 years agolib: Update DB permissions to reflect model changes
Stephen Finucane [Sat, 28 Nov 2020 17:25:25 +0000 (17:25 +0000)] 
lib: Update DB permissions to reflect model changes

These should have been done when we made changes to the model.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: ac0e4de9 ("models: Merge 'Patch' and 'Submission'")
4 years agoparser: Update reference to PatchComment
Stephen Finucane [Sat, 28 Nov 2020 16:34:01 +0000 (16:34 +0000)] 
parser: Update reference to PatchComment

Commit 0686a736fbf6d869bd31bd135ba38080ac96de22 split out 'CoverLetter'
from the old 'Submission' model, removing the common 'Comment' model in
favour of distinct 'CoverComment' and 'PatchComment' models in the
process. Unfortunately we misssed some references to the old model in
the 'patchwork.parser' module. Correct these now, adding unit tests to
prevent regressions.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: 0686a736 ("models: Split 'CoverLetter' from 'Submission'")
Closes: #384
5 years agorequirements: Update doc requirements
Stephen Finucane [Thu, 1 Oct 2020 15:51:26 +0000 (16:51 +0100)] 
requirements: Update doc requirements

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agorequirements: Bump mysqlclient to 2.0.0
Stephen Finucane [Thu, 1 Oct 2020 14:17:49 +0000 (15:17 +0100)] 
requirements: Bump mysqlclient to 2.0.0

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agorequirements: Bump django-debug-toolbar to 3.1.x
Stephen Finucane [Thu, 1 Oct 2020 14:16:42 +0000 (15:16 +0100)] 
requirements: Bump django-debug-toolbar to 3.1.x

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agorequirements: Bump django-filter to 2.4.0
Stephen Finucane [Thu, 1 Oct 2020 14:15:37 +0000 (15:15 +0100)] 
requirements: Bump django-filter to 2.4.0

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agoAdd support for djangorestframework 3.12
Stephen Finucane [Thu, 1 Oct 2020 14:14:41 +0000 (15:14 +0100)] 
Add support for djangorestframework 3.12

No changes necessary.

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agomodels: Validate Project.linkname does not contain forward slash
Thomas Bracht Laumann Jespersen [Mon, 28 Sep 2020 16:37:07 +0000 (18:37 +0200)] 
models: Validate Project.linkname does not contain forward slash

I started by creating a project that contained a forward slash
(importing patches from https://lists.sr.ht/~sircmpwn/sr.ht-dev/) and
it fails to render the "projects" main page.

The specific error reads:

    NoReverseMatch at /

    Reverse for 'patch-list' with keyword arguments
    '{'project_id': 'foo/bar'}' not found. 1 pattern(s) tried:
    ['project/(?P<project_id>[^/]+)/list/$']

which appears to explicitly disallow forward slashes.

So I think it makes sense to validate that project linkname doesn't
contain forward slahes.

This implementation uses the validate_unicode_slug validator instead of just
rejecting inputs that contain forward slashes.

Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #380
5 years agoAdd support for Django 3.1
Andrew Donnellan [Thu, 27 Aug 2020 14:14:06 +0000 (00:14 +1000)] 
Add support for Django 3.1

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
5 years agorequirements: Update django-filter
Andrew Donnellan [Thu, 27 Aug 2020 14:14:05 +0000 (00:14 +1000)] 
requirements: Update django-filter

Update django-filter dependency to a version that's compatible with Django
3.1.

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
5 years agosettings: Add context processor django.template.context_processors.request
Andrew Donnellan [Thu, 27 Aug 2020 14:14:04 +0000 (00:14 +1000)] 
settings: Add context processor django.template.context_processors.request

Django 3.1 adds a new admin sidebar feature that requires the
django.template.context_processors.request context processor to be enabled
in the settings.

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
5 years agourls: Update url pattern functions
Andrew Donnellan [Thu, 27 Aug 2020 14:14:03 +0000 (00:14 +1000)] 
urls: Update url pattern functions

Django 3.1 deprecates django.conf.urls.url() as an alias for
django.urls.re_path(). Also switch to using django.urls.include() rather
than django.conf.urls.include().

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agotemplates: Replace ifequal and ifnotequal with if
Andrew Donnellan [Thu, 27 Aug 2020 14:14:02 +0000 (00:14 +1000)] 
templates: Replace ifequal and ifnotequal with if

Django 3.1 deprecates the ifequal and ifnotequal tags, for removal in 4.0.
Replace all occurrences of ifequal and ifnotequal with if.

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
5 years agomanagement: introduce replacerelations command
Rohit Sarkar [Sat, 1 Aug 2020 06:24:15 +0000 (11:54 +0530)] 
management: introduce replacerelations command

The replacerelations script is used to ingest relations into Patchwork's
patch database. A patch groups file is taken as input, which on each
line contains a space separated list of patchwork ids denoting a
relation. All the existing relations in Patchwork's database are removed
and the relations read from the patch groups file are ingested.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
[dja: pep8, drop relations directory as empty dirs don't get stored by git,
      comment about how lines are generated.]
Signed-off-by: Daniel Axtens <dja@axtens.net>
5 years agodocker: Switch to MariaDB for wider platform support
Stewart Smith [Sat, 13 Jun 2020 23:19:12 +0000 (16:19 -0700)] 
docker: Switch to MariaDB for wider platform support

MySQL docker images only have amd64 arch support
MariaDB images have amd64, arm64v8, and ppc64le

Signed-off-by: Stewart Smith <stewart@flamingspork.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
5 years agoadmin: fix series query
Jan Remmet [Mon, 25 May 2020 07:03:10 +0000 (09:03 +0200)] 
admin: fix series query

remove typo from search_fields.

Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agodocs: Bump sphinxcontrib-openapi to 0.7.0
Stephen Finucane [Fri, 8 May 2020 08:49:50 +0000 (09:49 +0100)] 
docs: Bump sphinxcontrib-openapi to 0.7.0

This picks up an important fix [1] we want for our docs build.

[1] https://github.com/sphinx-contrib/openapi/pull/87

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agoRevert "tox: Add default Django version"
Stephen Finucane [Fri, 1 May 2020 09:02:11 +0000 (10:02 +0100)] 
Revert "tox: Add default Django version"

This reverts commit 029aff107ea9950418f9ad3cf44c3ba1ca3ea3ee. It appears
this isn't supported by tox either :(

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agotox: Add default Django version
Stephen Finucane [Thu, 30 Apr 2020 21:22:10 +0000 (22:22 +0100)] 
tox: Add default Django version

I occasionally forget myself and run e.g. 'tox -e pyNN' when I want to
sanity check something instead of 'tox -e pyNN-djangoMM'. Add fallback
Django versions so that this doesn't crash and burn. It's less succict
than it could be since tox doesn't seem to support '!django{22,30}'
(yet!).

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agomigrations: Moved squashed migration
Stephen Finucane [Sun, 26 Apr 2020 20:20:46 +0000 (21:20 +0100)] 
migrations: Moved squashed migration

This should have been in the 'patchwork/migrations' directory, not
'migrations.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: 9bb5caec ("migrations: Squash 0001 to 0040")
5 years agomigrations: Resolve issues with other DB backends for 0042, 0043
Stephen Finucane [Sun, 26 Apr 2020 13:17:57 +0000 (14:17 +0100)] 
migrations: Resolve issues with other DB backends for 0042, 0043

0042 was using MySQL-specific SQL to delete entries in the
'patchwork_comment' table that were associated with entries in the
'patchwork_coverletter' table, while 0043 only considered MySQL and
PostgrSQL when attempting to copy fields from 'patchwork_patch' to
'patchwork_submission'. Both issues are resolved.

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agodocker: Ignore postgres data file
Stephen Finucane [Sun, 26 Apr 2020 14:28:20 +0000 (15:28 +0100)] 
docker: Ignore postgres data file

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agomigrations: Squash 0001 to 0040
Stephen Finucane [Fri, 10 Apr 2020 11:08:32 +0000 (12:08 +0100)] 
migrations: Squash 0001 to 0040

Now that we're moving a new major version, we can squash the migrations
we have to date. This coexists alongside the old migrations, which we
can remove and replace entirely when we release 4.0, per the advice of
the 'squashmigrations' tool.

  You should commit this migration but leave the old ones in place; the
  new migration will be used for new installs. Once you are sure all
  instances of the codebase have applied the migrations you squashed,
  you can delete them.

The 'squashmigrations' tool can't parse the output of 'RunPython' blocks
so the output of the tool was less optimized than it could be. As a
result, we've manually modified this change to remove the 'RunPython'
block and unnecessary 'AlterField' entries. This was done by removing
all migrations and generating a new "initial" migration, which was then
modified to mark all strings as byte strings (as they were when we were
using Python 2 to generate these migrations) so that 0041 would apply
cleanly.

The main benefit of this change is that it significantly reduces the
startup time for unit tests. Executed on my host, the run time for a
single test goes from ~ 22 seconds to ~ 14 seconds. This is obviously
reduced for additional tests.

Signed-off-by: Stephen Finucane <stephen@that.guru>
5 years agomodels: Trivial post-merge cleanup
Stephen Finucane [Thu, 9 Apr 2020 16:56:44 +0000 (17:56 +0100)] 
models: Trivial post-merge cleanup

Signed-off-by: Stephen Finucane <stephen@that.guru>