]> git.ipfire.org Git - thirdparty/patchwork.git/log
thirdparty/patchwork.git
19 months agoRemove tox-pyenv stable/3.1
Stephen Finucane [Wed, 25 Jan 2023 19:56:16 +0000 (19:56 +0000)] 
Remove tox-pyenv

This doesn't appear to be maintained and isn't necessary once we add a
missing 'pyenv init'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit 5d63f97fefad90485d0041cbe822ed1a5d446e88)

19 months agotools: Use stable-3.1 tag for Docker
Stephen Finucane [Wed, 17 Jan 2024 13:09:26 +0000 (13:09 +0000)] 
tools: Use stable-3.1 tag for Docker

Since we've removed Python 3.7 support in latest.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2 years agoAdditional updates for compatibility with tox 4
Stephen Finucane [Fri, 13 Jan 2023 12:20:01 +0000 (12:20 +0000)] 
Additional updates for compatibility with tox 4

'[tox] skipsdist' behaves differently in tox 4 [1]. In addition, setting
'[testenv] basepython' with '[tox] ignore_basepython_conflict' has been
the cause of a few tox 4 bugs (most since fixed, thankfully) and might
be deprecated [2]. Remove it since we don't need it in any of our
environments.

[1] https://github.com/tox-dev/tox/issues/2730
[2] https://github.com/tox-dev/tox/issues/2846

Conflicts:
tox.ini

NOTE(stephenfin): Conflicts are due to lack of support for Django 4.1.

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit a03a0a5ea8e4a3299c02f318179001a8092a728c)

2 years agotox: fix failure due to whitespaces in passenv
You-Sheng Yang (vicamo) [Fri, 13 Jan 2023 02:53:58 +0000 (10:53 +0800)] 
tox: fix failure due to whitespaces in passenv

When installed tox >= 4, space-separated variables specified for passenv
are no longer allowed.

Signed-off-by: You-Sheng Yang (vicamo) <vicamo@gmail.com>
(cherry picked from commit 8fd3f6a5c424dda953fba52a8d4df09333afd105)

2 years agolib: add missing permissions for patchwork_covercomment_id_seq
Ali Alnubani [Tue, 1 Aug 2023 08:15:35 +0000 (11:15 +0300)] 
lib: add missing permissions for patchwork_covercomment_id_seq

Grants UPDATE and SELECT privileges on patchwork_covercomment_id_seq table
for user 'nobody' to fix the following exception when cover comments
are being parsed:
django.db.utils.ProgrammingError: permission denied for sequence
  patchwork_covercomment_id_seq

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
(cherry picked from commit 3ede6b34618d2553ecdaf7f29426a4456c2b47ae)

2 years agolib: add missing permissions for patchwork_cover_id_seq
Ali Alnubani [Mon, 31 Jul 2023 10:54:21 +0000 (13:54 +0300)] 
lib: add missing permissions for patchwork_cover_id_seq

Grants UPDATE and SELECT privileges on patchwork_cover_id_seq table
for user 'nobody' to fix the following exception when cover letters
are being parsed:
django.db.utils.ProgrammingError: permission denied for sequence
  patchwork_cover_id_seq

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
(cherry picked from commit efa27b7730274791b223b5e855dd9c9324a3c2e4)

2 years agolib: add missing permissions for patchwork_comment_id_seq
Ali Alnubani [Tue, 20 Jun 2023 11:06:07 +0000 (14:06 +0300)] 
lib: add missing permissions for patchwork_comment_id_seq

Grants UPDATE and SELECT privileges on patchwork_comment_id_seq table
for web and mail users to fix the following exception when comments
are parsed:
django.db.utils.ProgrammingError: permission denied for sequence
  patchwork_comment_id_seq

Fixes: 5b53f46def5f ("lib: fix table names")
Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
(cherry picked from commit f7bb805037d7d8710a0b025536616ef9cdfd4cef)

2 years agoPost-release version bump
Stephen Finucane [Tue, 1 Aug 2023 17:22:31 +0000 (18:22 +0100)] 
Post-release version bump

Signed-off-by: Stephen Finucane <stephen@that.guru>
2 years agoRelease 3.1.3 v3.1.3
Stephen Finucane [Tue, 1 Aug 2023 17:19:42 +0000 (18:19 +0100)] 
Release 3.1.3

Signed-off-by: Stephen Finucane <stephen@that.guru>
2 years agotox: Use pre-commit for pep8 environment
Stephen Finucane [Tue, 1 Aug 2023 16:35:35 +0000 (17:35 +0100)] 
tox: Use pre-commit for pep8 environment

Avoid duplication.

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit dd8320a83873a1649adb0d78f35190ec61182b17)

2 years agoBump pre-commit versions
Stephen Finucane [Tue, 1 Aug 2023 16:27:25 +0000 (17:27 +0100)] 
Bump pre-commit versions

Changes:
  .pre-commit-config.yaml

NOTE(stephenfin): We avoid bumping black since that brings in a whole
load of changes that we don't want on a stable branch.

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit ee99e4248748bd0831716f9c0f02e9b1e2ca5e54)

2 years agotests: Address flake8 issue
Stephen Finucane [Tue, 1 Aug 2023 16:26:17 +0000 (17:26 +0100)] 
tests: Address flake8 issue

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit d556955460dc0fcd6f745e80e01dc6607beffe7b)

2 years agourls: Also decode slashes in message IDs
Stephen Finucane [Tue, 1 Aug 2023 17:05:03 +0000 (18:05 +0100)] 
urls: Also decode slashes in message IDs

In commit 2653fdbb2, we started encoding slashes in message IDs
presented to users. This allowed us to support message IDs containing
slashes, which are allowed per the RFC and have been seen in the wild.
However, we continue to store the original unencoded message IDs in the
database and unfortunately we neglected to reverse the decoding in the
functions for downloading patch diffs and mboxes. Address this now.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: 2653fdbb2 ("urls: Encode slashes in message IDs")
Closes: #518
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>
Cc: DJ Delorie <dj@delorie.com>
(cherry picked from commit ddc4c7e41a7eaec5c08296d4b441c896324f86d4)

2 years agoPost-release version bump
Stephen Finucane [Wed, 25 Jan 2023 18:16:32 +0000 (18:16 +0000)] 
Post-release version bump

Signed-off-by: Stephen Finucane <stephen@that.guru>
2 years agoRelease 3.1.2 v3.1.2
Stephen Finucane [Wed, 25 Jan 2023 18:16:04 +0000 (18:16 +0000)] 
Release 3.1.2

Signed-off-by: Stephen Finucane <stephen@that.guru>
2 years agoCorrectly append tags on patches without commit details
Stephen Finucane [Tue, 24 Jan 2023 23:31:22 +0000 (23:31 +0000)] 
Correctly append tags on patches without commit details

Only a commit summary (a.k.a. patch subject) is necessary in Git: we
don't need details. The regex we were using to search for postscripts
however assumed that there would be _something_ before the postscript,
resulting in a newline. This wasn't the case. Correct this assumption by
instead using 're.MULTILINE' and matching on '^' and '$' for newlines
instead of '\n'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #516
Cc: siddhesh@gotplt.org
(cherry picked from commit 05da32fef9140412bf0e822ce7f9706cb8aa7b5b)

2 years agoPost-release version bump
Stephen Finucane [Fri, 30 Sep 2022 16:52:51 +0000 (17:52 +0100)] 
Post-release version bump

Signed-off-by: Stephen Finucane <stephen@that.guru>
2 years agoRelease 3.1.1 v3.1.1
Stephen Finucane [Fri, 30 Sep 2022 16:52:15 +0000 (17:52 +0100)] 
Release 3.1.1

Signed-off-by: Stephen Finucane <stephen@that.guru>
2 years agotests: Change from expectedFailure to skip
Stephen Finucane [Fri, 30 Sep 2022 15:42:52 +0000 (16:42 +0100)] 
tests: Change from expectedFailure to skip

Python 3.10 recognises unexpected passes as failures now.

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit 40133ec5a0004dba0232a89185df4cc2e90b5455)

2 years agoREST: De-duplicate handling of nested resource URLs
Stephen Finucane [Fri, 30 Sep 2022 13:57:25 +0000 (14:57 +0100)] 
REST: De-duplicate handling of nested resource URLs

These were all doing the same thing. Make things more generic.

We also speed up test (inadvertently) by using the 'patch_id' attribute
of the 'Check' model rather than 'patch.id', thus avoiding the JOIN.

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit 4470c13e93ccd22b298deb290935b57f37bd2f55)

2 years agoREST: Fix issues with comment-related events
Stephen Finucane [Fri, 30 Sep 2022 13:21:09 +0000 (14:21 +0100)] 
REST: Fix issues with comment-related events

When we introduced this functionality, we missed the fact that these
resources use nested-style URLs that need to be specially handled. Fix
this now.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: e3d8f7548 ("REST: Add 'patch-comment-created', 'cover-comment-created' events")
Cc: Siddhesh Poyarekar <sipoyare@redhat.com>
Cc: DJ Delorie <dj@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit d05a2ff9b97e233036c7cc86e8cfbdccc3d313a0)

2 years agomanage: Check Django version on startup
Stephen Finucane [Fri, 30 Sep 2022 13:04:19 +0000 (14:04 +0100)] 
manage: Check Django version on startup

This was recently reported as an issue. Add a simple check to ensure
people update their dependencies as expected.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Cc: Siddhesh Poyarekar <sipoyare@redhat.com>
Cc: DJ Delorie <dj@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit b5769e6aabf6e42ffeb24f4a8edd88a54b11dd72)

2 years agourls: Encode slashes in message IDs
Stephen Finucane [Wed, 11 May 2022 13:52:36 +0000 (14:52 +0100)] 
urls: Encode slashes in message IDs

We were attempting to work around the fact that message IDs could
contain slashes which in some cases broke our ability to generate
meaningful URLs. Rather than doing this, insist that users encode these
slashes so that we can distinguish between semantically meaningful
slashes and those that form the URL. This is a slightly breaking change,
but the current behavior is already broken (see the linked bug) so this
seems reasonable.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #433
Cc: dja@axtens.net
Cc: siddhesh@gotplt.org
(cherry picked from commit 2653fdbb2f33a9c762936ca97e3c6888b185cb4b)

3 years agotrivial: Fix style issues
Stephen Finucane [Thu, 8 Sep 2022 20:43:59 +0000 (21:43 +0100)] 
trivial: Fix style issues

New flake8, same issues.

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit 210c0df715a87eb2a314e853f4db8a55e4b4786b)

3 years agodocs: Actually configure reno to use the main branch
Stephen Finucane [Mon, 18 Jul 2022 11:28:24 +0000 (12:28 +0100)] 
docs: Actually configure reno to use the main branch

I used the wrong setting [1]

[1] https://docs.openstack.org/reno/latest/user/usage.html#configuring-reno

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit b39dabffa4c55f45419b13b240bd924fea84b969)

3 years agoReplace references to master with main
Stephen Finucane [Mon, 18 Jul 2022 09:34:59 +0000 (10:34 +0100)] 
Replace references to master with main

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit c3e5c8899c1ba31b3f5f342c9aceecbcfb253e17)

3 years agoRelease 3.1.0 v3.1.0
Stephen Finucane [Fri, 15 Jul 2022 16:14:57 +0000 (17:14 +0100)] 
Release 3.1.0

A smaller release including a new API version (v1.3) and changes to the
supported Python and Django versions.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agodocs: Bump API version in docs to 1.3
Stephen Finucane [Fri, 15 Jul 2022 16:02:36 +0000 (17:02 +0100)] 
docs: Bump API version in docs to 1.3

We also need to add missing API documentation pages for this new API
version. These should have been added in commit 5b03443c ("api: add
auto-generated OpenAPI schema files")

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agotox: Run Python 3.10 tests in Python 3.10 environment
Stephen Finucane [Fri, 15 Jul 2022 15:53:56 +0000 (16:53 +0100)] 
tox: Run Python 3.10 tests in Python 3.10 environment

Correct a typo introduced when we added 3.10 support.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: dda111234 ("Add Python 3.10 support, drop Python 3.6 support")
3 years agoBump django-filter, django-debug-toolbar versions
Stephen Finucane [Fri, 15 Jul 2022 15:47:33 +0000 (16:47 +0100)] 
Bump django-filter, django-debug-toolbar versions

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoCI: Drop Python 3.6 testing, add Python 3.10, update actions
Stephen Finucane [Fri, 15 Jul 2022 15:38:01 +0000 (16:38 +0100)] 
CI: Drop Python 3.6 testing, add Python 3.10, update actions

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoparser: Handle binary git patches
Stephen Finucane [Wed, 11 May 2022 09:30:45 +0000 (10:30 +0100)] 
parser: Handle binary git patches

'git-format-patch' is able to generate binary patches. Fortunately,
these are quite easy to spot since they're explicitly labelled as such.
Add support for parsing these to the parser.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #463
3 years agolib: fix table names
Ali Alnubani [Sun, 24 Apr 2022 20:59:35 +0000 (23:59 +0300)] 
lib: fix table names

Migration 0042 (introduced in 0686a73) renamed the "Comment" model
to "PatchComment", and some of the table names changed in a51e7cf
were already correct.

This reverts a51e7cf and removes a nonexistent table name to resolve
the following error:

  $ psql -f lib/sql/grant-all.postgres.sql DATABASE_NAME
  BEGIN
  psql:lib/sql/grant-all.postgres.sql:38: ERROR:  relation
    "patchwork_comment" does not exist

Fixes: a51e7cfd95e2 ("lib: Correct PatchComment table")
Fixes: 7b967db4e12f ("lib: Update DB permissions to reflect model changes")
Cc: stephen@that.guru
Closes: #396
Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
3 years agohtdocs: Update package versions
Stephen Finucane [Sun, 9 Sep 2018 01:37:46 +0000 (19:37 -0600)] 
htdocs: Update package versions

  checkboxes.js            1.0.6   1.2.2
  clipboard.js             1.7.1   1.7.1
  jquery                  1.10.1   3.6.0
  selectize               0.11.2  0.13.5
  sticky-table-headers     ?.?.?  0.1.24
  tablednd                 0.4.0   1.0.5

Amazingly, the only functional change required here is to add an
additional piece of code to re-enable shift-select [1]. This is
otherwise a straight swap.

[1] https://rmariuzzo.github.io/checkboxes.js/#range-selection-of-checkboxes

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agotox: Trivial indentation fix
Stephen Finucane [Mon, 9 May 2022 10:45:09 +0000 (11:45 +0100)] 
tox: Trivial indentation fix

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoSilence warnings from openapi-core
Stephen Finucane [Mon, 9 May 2022 10:27:11 +0000 (11:27 +0100)] 
Silence warnings from openapi-core

This uses distutils. Hopefully my PR will be merged eventually. Until
then, silencing the warning is good enough (Python 3.12 is aaaages away)

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoRemove 'default_app_config'
Stephen Finucane [Mon, 9 May 2022 10:26:23 +0000 (11:26 +0100)] 
Remove 'default_app_config'

This is no longer necessary since we don't support Django < 3.2, which
is where the automatic configuration behavior was added [1].

[1] https://docs.djangoproject.com/en/4.0/releases/3.2/#automatic-appconfig-discovery

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoparser: Ignore CFWS in Message-ID header
Stephen Finucane [Fri, 6 May 2022 17:21:02 +0000 (18:21 +0100)] 
parser: Ignore CFWS in Message-ID header

We recently started stripping comments and folding white space from the
In-Reply-To and References headers. Do so also for the Message-ID
header. Because of the importance of the Message-ID header, we accept
even non-compliant headers and because we now have a pattern for this,
we also start (re-)accepting non-compliant In-Reply-To headers.

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

3 years agoparser: Ignore CFWS in In-Reply-To, References headers
Stephen Finucane [Fri, 6 May 2022 16:53:13 +0000 (17:53 +0100)] 
parser: Ignore CFWS in In-Reply-To, References headers

RFC2822 states that [1] a comment or folding white space is permitted to
be inserted before or after a msg-id in in the Message-ID, In-Reply-To
or References fields. Allow for this.

[1] https://tools.ietf.org/html/rfc2822#section-3.6.4

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: DJ Delorie <dj@redhat.com>
Closes: #399
3 years agopre-commit: Ignore files we don't have access to
Stephen Finucane [Fri, 6 May 2022 19:06:30 +0000 (20:06 +0100)] 
pre-commit: Ignore files we don't have access to

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoEnable black in pep8 tox job, pre-commit
Stephen Finucane [Fri, 6 May 2022 19:01:43 +0000 (20:01 +0100)] 
Enable black in pep8 tox job, pre-commit

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoUpdate pre-commit plugins
Stephen Finucane [Fri, 6 May 2022 19:00:19 +0000 (20:00 +0100)] 
Update pre-commit plugins

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoCreate git-blame-ignore-revs file
Stephen Finucane [Fri, 6 May 2022 18:58:30 +0000 (19:58 +0100)] 
Create git-blame-ignore-revs file

Allows us to ignore the application of black to the codebase.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoBlackify code
Stephen Finucane [Fri, 6 May 2022 18:57:37 +0000 (19:57 +0100)] 
Blackify code

Run code through black.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoREST: Include 'first', 'last' refs in 'Link' header
Stephen Finucane [Tue, 14 Apr 2020 09:46:05 +0000 (10:46 +0100)] 
REST: Include 'first', 'last' refs in 'Link' header

I've no idea why this wasn't done from day one, but it's a huge
usability win for anyone attempting to do pagination with this header.
Note that this change is not versioned as I haven't figured out how to
do that at this layer.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agotemplatetags: Add 'site_admins' tag
Stephen Finucane [Fri, 10 Apr 2020 16:34:15 +0000 (17:34 +0100)] 
templatetags: Add 'site_admins' tag

This lets us avoid complex templating.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agotemplatetags: Trivial cleanup
Stephen Finucane [Fri, 10 Apr 2020 16:33:02 +0000 (17:33 +0100)] 
templatetags: Trivial cleanup

Make this a little nicer to read.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agotemplates: Use standard indentation
Stephen Finucane [Fri, 10 Apr 2020 13:02:39 +0000 (14:02 +0100)] 
templates: Use standard indentation

Use a standard two space indentation across files, rewrapping some stuff
as we go along.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoREST: Add 'patch-comment-created', 'cover-comment-created' events
DJ Delorie [Tue, 29 Mar 2022 18:57:32 +0000 (19:57 +0100)] 
REST: Add 'patch-comment-created', 'cover-comment-created' events

This patch stitches in "comment created" events for patches and cover
letter into the event queue.

Signed-off-by: DJ Delorie <dj@redhat.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
Closes: #424
[stephenfin: Extend to cover letters also. Fix some formatting issues.
 Add a release note]

3 years agodocs: Don't version events
Stephen Finucane [Tue, 29 Mar 2022 18:57:31 +0000 (19:57 +0100)] 
docs: Don't version events

We don't actually version the types of events we emit. Doing so would be
possible, but this ship has already sailed (with API version 1.2).

We also remove some unnecessary line breaks.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agorequirements: Add pointer to fix for openapi-core
Stephen Finucane [Fri, 6 May 2022 14:50:49 +0000 (15:50 +0100)] 
requirements: Add pointer to fix for openapi-core

This will be fixed in a future openapi-core release [1]. Indicate as
much.

[1] https://github.com/p1c2u/openapi-core/pull/373

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agorequirements: Drop Django 2.2 support
Stephen Finucane [Fri, 6 May 2022 14:38:13 +0000 (15:38 +0100)] 
requirements: Drop Django 2.2 support

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agorequirements: Bump django-debug-toolbar to 3.4.x
Stephen Finucane [Fri, 6 May 2022 14:33:42 +0000 (15:33 +0100)] 
requirements: Bump django-debug-toolbar to 3.4.x

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoviews: Fix typo
Stephen Finucane [Mon, 4 Apr 2022 17:16:19 +0000 (18:16 +0100)] 
views: Fix typo

The filename field for a patch returned by the XML-RPC API does *not*
include a file extension. This was misleading.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agodocker: Further refine logic to apply migrations
Stephen Finucane [Fri, 25 Mar 2022 11:57:33 +0000 (11:57 +0000)] 
docker: Further refine logic to apply migrations

We don't want to apply migrations by default since this will cause WIP
migrations to be applied if someone runs e.g. 'docker-compose run'. What
we really want to check is "are there any migrations currently applied?"
and skip if so, but Django doesn't provide an easy way to do this, so we
instead check for a random Django application.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agodocker: Only apply migrations if necessary
Stephen Finucane [Fri, 25 Mar 2022 10:40:17 +0000 (10:40 +0000)] 
docker: Only apply migrations if necessary

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agodocker: Bump tested database versions
Stephen Finucane [Fri, 25 Mar 2022 09:30:08 +0000 (09:30 +0000)] 
docker: Bump tested database versions

We were attempting to test with PostgreSQL 9.6, but Django 4.0 requires
PostgreSQL 10.0 or greater [1]. This was causing failures like those
seens at [2]. Configure jobs to use 'latest' like we do in CI to avoid
this issue.

While we're here, we also switch from MariaDB to MySQL and use the
'latest' tag of this. Once again, this was what we were actually using
in CI and doing this limits future work.

[1] https://docs.djangoproject.com/en/4.0/ref/databases/#postgresql-notes
[2] https://stackoverflow.com/q/69477858

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agodocs: Fix typo
Stephen Finucane [Sun, 20 Mar 2022 12:31:50 +0000 (12:31 +0000)] 
docs: Fix typo

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agorequirements: Disable django-dbbackup
Stephen Finucane [Thu, 24 Feb 2022 11:13:58 +0000 (11:13 +0000)] 
requirements: Disable django-dbbackup

This is not yet compatible with Django 4.0.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoAdd Python 3.10 support, drop Python 3.6 support
Stephen Finucane [Wed, 23 Feb 2022 13:42:45 +0000 (13:42 +0000)] 
Add Python 3.10 support, drop Python 3.6 support

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agorequirements: Add support for Django 4.0, drop 3.1
Stephen Finucane [Wed, 23 Feb 2022 13:31:16 +0000 (13:31 +0000)] 
requirements: Add support for Django 4.0, drop 3.1

An older release note that mistakenly stated Django 3.1 had been removed
is updated to reflect the fact that this was actually 3.0.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agotests: Mark 'test_series.test_duplicated' as expected failure
Stephen Finucane [Sun, 8 Sep 2019 15:28:34 +0000 (16:28 +0100)] 
tests: Mark 'test_series.test_duplicated' as expected failure

This is failing again :(

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoci: Randomize database credentials a bit
You-Sheng Yang [Thu, 9 Dec 2021 03:38:43 +0000 (11:38 +0800)] 
ci: Randomize database credentials a bit

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
3 years agoci: Add tests for sqlite3
You-Sheng Yang [Thu, 9 Dec 2021 03:38:42 +0000 (11:38 +0800)] 
ci: Add tests for sqlite3

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
3 years agodocker: Drop database maintenance stuff
You-Sheng Yang [Thu, 9 Dec 2021 03:38:41 +0000 (11:38 +0800)] 
docker: Drop database maintenance stuff

Trying to re-create database inside a client docker could be risky and
error prone.

1. The previous handling process may fail service startup when an empty
database was created. `test_database()` will always succeed as it tests
only the existence of the database, not any table inside. Without
migrations being called on such empty database, patchwork cannot work
normally.

2. Checking the existence of a patchwork specific table is also invalid
under the empty database scenario, because migrations might still remain
to be done.

As a result, we shall test if the database exist and do migrations
always, so this change removes database maintenance functions.

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
[stephenfin] Removed release note, since this is not end-user focused

3 years agoci: Test supported docker container operations
You-Sheng Yang [Thu, 9 Dec 2021 03:38:40 +0000 (11:38 +0800)] 
ci: Test supported docker container operations

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
3 years agodocker: Remove deprecated startup arguments
You-Sheng Yang [Thu, 9 Dec 2021 03:38:39 +0000 (11:38 +0800)] 
docker: Remove deprecated startup arguments

This also adds a default CMD directive so that it will launch a
patchwork instance when started with no argument.

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
[stephenfin] Removed release note, since this is not end-user focused

3 years agodocker, tests: Reference DATABASE_* where possible
You-Sheng Yang [Thu, 9 Dec 2021 03:38:38 +0000 (11:38 +0800)] 
docker, tests: Reference DATABASE_* where possible

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
3 years agosettings: Move database settings into base
You-Sheng Yang [Thu, 9 Dec 2021 03:38:37 +0000 (11:38 +0800)] 
settings: Move database settings into base

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
[stephenfin] Reworked release note

3 years agosettings: Unify database connection variables
You-Sheng Yang [Thu, 9 Dec 2021 03:38:36 +0000 (11:38 +0800)] 
settings: Unify database connection variables

This changeset replaces all PW_TEST_DB_* with corresponding DATABASE_*
variables and fixes inconsistent DATABASE_PASS/DATABASE_PASSWORD usages.

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
[stephenfin] Tweaked release notes

3 years agodocker: Use mariadb-client, not mysql-client
Stephen Finucane [Wed, 23 Feb 2022 12:47:33 +0000 (12:47 +0000)] 
docker: Use mariadb-client, not mysql-client

As noted in [1], use of mysql-client with mariadb-server can result in
the following errors:

  mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"')
  FROM information_schema.COLUMN_STATISTICS
  WHERE SCHEMA_NAME =3D 'patchwork' AND TABLE_NAME =3D 'auth_group';':
  Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

Use the correct client for the backend.

[1] https://stackoverflow.com/a/67563944/613428

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agoREST: Remove use of deprecated distuils classes
Stephen Finucane [Tue, 22 Feb 2022 17:34:50 +0000 (17:34 +0000)] 
REST: Remove use of deprecated distuils classes

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agotests: Disable schema validation for events
Stephen Finucane [Tue, 22 Feb 2022 16:47:16 +0000 (16:47 +0000)] 
tests: Disable schema validation for events

This is not running. I don't know what's changed. Disable it for now.

Signed-off-by: Stephen Finucane <stephen@that.guru>
3 years agodocker: Rebase onto custom image
You-Sheng Yang [Sun, 12 Dec 2021 06:17:40 +0000 (14:17 +0800)] 
docker: Rebase onto custom image

Rebuild pyenv environments can be time-consuming and irrelevant to this
project. Use a prebuild image to save some time here.

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
[stephenfin: Modified to use our own vendored image]

3 years agodocs: pin mistune version due to breakage
You-Sheng Yang [Mon, 6 Dec 2021 08:42:23 +0000 (16:42 +0800)] 
docs: pin mistune version due to breakage

mistune made a new release which breaks API referenced by Sphinx v4.3.1.

Closes: #442
Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>