summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* templates: Combine series and related rowMete Polat2019-12-27
| | | | | | | | | Move the series patch list from row 'Related' to 'Series'. This allows us to use the 'Related' row for actually showing submission relations instead. Signed-off-by: Mete Polat <metepolat2000@gmail.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* fixtures: Fix typo in default_statesStephen Finucane2019-12-27
| | | | | Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 42b1dfa2 ("models: Add State.slug field")
* tests: Add test for broken parserStephen Finucane2019-12-27
| | | | | | | | | | Add tests for the recent changes we made to how we parse multiple series received at once. These tests actually highlighted what appeared to be the test failure that's been intermittently breaking our CI for years now, so the 'expectedFailure' marker has been removed in the hope that this is actually the case. Signed-off-by: Stephen Finucane <stephen@that.guru>
* parser: Use a second query to weed out duplicate seriesStephen Finucane2019-12-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Annoyingly, not all email clients properly thread emails using the message ID fields originally specified in RFC 822 [1]. Worse, some MTAs (cough, outlook.com, cough) actually override what the client configures, breaking the world in the process. Realising this is an issue, Patchwork supports threading using arbitrary metadata in addition to the RFC 822 metadata. Specifically, it uses a combination of submitter and list-id extracted from the headers along with the series version and total count metadata extracted from the subject. In addition to this, we timebox things so that two or more series that match on all of this metadata but which are sent some time apart from each other aren't combined by accident. This does leave one edge case - duplicate series received within the timebox will be combined. We've resigned ourselves to this fact on the basis that it's extremely unlikely for all of these things to go wrong at once. Given all the above, there should be no reason that attempting to find series by series markers should return more than one series. The timeboxing will prevent us grouping similar looking series by accident and the only other reason for this to happen is because we lost a race and we should try again. [1] https://tools.ietf.org/html/rfc822 Signed-off-by: Stephen Finucane <stephen@that.guru> Cc: Daniel Axtens <dja@axtens.net>
* models: Use database constraints to prevent split SeriesStephen Finucane2019-12-27
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, the 'SeriesReference' object has a unique constraint on the two fields it has, 'series', which is a foreign key to 'Series', and 'msgid'. This is the wrong constraint. What we actually want to enforce is that a patch, cover letter or comment is referenced by a single series, or rather a single series per project the submission appears on. As such, we should be enforcing uniqueness on the msgid and the project that the patch, cover letter or comment belongs to. This requires adding a new field to the object, 'project', since it's not possible to do something like the following: unique_together = [('msgid', 'series__project')] This is detailed here [1]. In addition, the migration needs a precursor migration step to merge any broken series. [1] https://stackoverflow.com/a/4440189/613428 Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #241 Cc: Daniel Axtens <dja@axtens.net> Cc: Petr Vorel <petr.vorel@gmail.com>
* tests: Skip tests that fail on SQLite DB backendStephen Finucane2019-12-27
| | | | | | | | These are failing due to differences in behavior of the backend. Since this will never be used for production, we can simply skip these unit tests and rely on the CI to catch potential issues. Signed-off-by: Stephen Finucane <stephen@that.guru>
* settings: Add configuration for sqlite DB backendStephen Finucane2019-12-27
| | | | Signed-off-by: Stephen Finucane <stephen@that.guru>
* models: Add State.slug fieldStephen Finucane2019-12-27
| | | | | | | | | | | | | This reduces a lot of the tech debt we had built up around this. This field is populated from a slugified representation of State.name and has a uniqueness constraint. As a result, we also need to a uniqueness constraint to the State.name field. This shouldn't be an issue and probably should have been used from day one. Note that there is no REST API impact for this since we've been using state slugs all along. Signed-off-by: Stephen Finucane <stephen@that.guru>
* REST: Allow configuration of user settings via APIStephen Finucane2019-12-24
| | | | | | Expose the embedded UserProfile field via the REST API. Signed-off-by: Stephen Finucane <stephen@that.guru>
* tests: Provide a way to disable API schemaStephen Finucane2019-12-24
| | | | | | | | | | | | | The API schema validation is strict, in that it will error out with invalid keys in either the request or response. Unfortunately the API itself is not. We're hopefully going to fix this in a distant v2.0, but for now we need a way to ensure that the API does what it's supposed to, namely not set fields that don't exist or that the user isn't allowed to set, even if proper error codes aren't raised. This isn't actually used yet. That will come later. Signed-off-by: Stephen Finucane <stephen@that.guru>
* docs: Add missing series index schemaMete Polat2019-12-08
| | | | | | Fixes: 7d8e24bc84bd ("docs: Start documenting API using OpenAPI") Signed-off-by: Mete Polat <metepolat2000@gmail.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* requirements: Add pyup markers to prevent dumb PRsStephen Finucane2019-12-01
| | | | | | | | | | | Until [1] is merged, we're going to have to override what these markers are doing. Perhaps it would be easier to just specify the markers in the comments as the actual marker, but I like using pip's features and the comments *should* be temporary. [1] https://github.com/pyupio/pyup/pull/367 Signed-off-by: Stephen Finucane <stephen@that.guru>
* docs: Change category of API release noteStephen Finucane2019-12-01
| | | | Signed-off-by: Stephen Finucane <stephen@that.guru>
* docs: Correct location of release noteStephen Finucane2019-12-01
| | | | | | | | Not sure how this ended up here but we both missed this. Correct the location. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: d380219e ("api: support filtering patches by hash")
* docs: Add release notes for recently added featuresStephen Finucane2019-12-01
| | | | Signed-off-by: Stephen Finucane <stephen@that.guru>
* REST: Add 'actor' field to '/events' modelJohan Herland2019-12-01
| | | | | | | | Signed-off-by: Johan Herland <johan@herland.net> Reviewed-by: Stephen Finucane <stephen@that.guru> Acked-by: Daniel Axtens <dja@axtens.net> Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Closes: #73
* Include the responsible actor in applicable eventsJohan Herland2019-12-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to use the events as an audit log. An important part of this is recording _who_ made the changes that the events represent. To accomplish this, we need to know the current user (aka. request.user) at the point where we create the Event instance. Event creation is currently triggered by signals, but neither the signal handlers, nor the model classes themselves have easy access to request.user. For some Patch-based events (patch-state-changed, patch-delegated), we can do the following hack: The relevant events are created in signal handlers that are all hooked up to either the pre_save or post_save signals sent by Patch.save(). But before calling Patch.save(), Patchwork must naturally query Patch.is_editable() to ascertain whether the patch can in fact be changed by the current user. Thus, we only need a way to communicate the current user from Patch.is_editable() to the signal handlers that create the resulting Events. The Patch object itself is available in both places, so we simply add an '_edited_by' attribute to the instance (which fortunately is not detected as a persistent db field by Django). For the check-created event the current user always happens to be the same as the 'user' field recorded in the Check object itself. For the other Patch-based events (patch-created, patch-completed, and series-completed), although they are also triggered by Patch.save(), they are triggered as a result of incoming emails, hence have no real actor as such, so we simply leave the actor as None/NULL. The same argument also applies to the cover-created and series-created events. Signed-off-by: Johan Herland <johan@herland.net> Reviewed-by: Stephen Finucane <stephen@that.guru> Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* models.Event: Add the user responsible for the eventJohan Herland2019-12-01
| | | | | | | | | This allows using the events as a kind of audit log, to see how a patch came to its current state/delegate. Signed-off-by: Johan Herland <johan@herland.net> Reviewed-by: Stephen Finucane <stephen@that.guru> Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
* templates: Use 'en' localeStephen Finucane2019-11-30
| | | | | | | | | | | | As discussed at [1], the UI was originally written in Australian English but as it's been through a couple of pairs of hands since the chances are things are more than a little messed up. Just use 'en' as our locale rather than 'en-US', 'en-AU' or anything else. [1] https://lists.ozlabs.org/pipermail/patchwork/2019-November/006342.html Signed-off-by: Stephen Finucane <stephen@that.guru> Suggested-by: Daniel Axtens <dja@axtens.net>
* docs: Only include 'order' filter in '/events/' for v1.2+Stephen Finucane2019-11-30
| | | | | | | | Even though we don't actually version this thing, don't document for older versions of the API lest people using older deployments get confused. Signed-off-by: Stephen Finucane <stephen@that.guru>
* Allow ordering events by dateJeremy Cline2019-11-30
| | | | | | | | | | | By default, the events API orders events by date in descending order (newest first). However, it's useful to be able to order the events by oldest events first. For example, when a client is polling the events API for new events since a given date and wishes to process them in chronological order. Signed-off-by: Jeremy Cline <jcline@redhat.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* REST: Exclude filters added in later versionStephen Finucane2019-11-30
| | | | | | | | | | If a person requests API version 1.1, they should get the exact same behavior regardless of the base Patchwork version. We already do this for fields in the output, so now extend this to filters in the querystring. Signed-off-by: Stephen Finucane <stephen@that.guru> Cc: Daniel Axtens <dja@axtens.net>
* api: support filtering patches by hashDaniel Axtens2019-11-30
| | | | | | | | | | | | | | | | | This is a feature that the XML-RPC API has, and which is used in the wild [1], so support it in the REST API. I tried to version the new filter field, but it's not at all clear how to do this with django-filters. The best way I could find requires manually manipulating request.GET, which seems to defeat the point of django-filters. So document it for 1.2, and have it work on older versions as an undocumented feature. [1] https://git.kernel.org/pub/scm/linux/kernel/git/mricon/korg-helpers.git/tree/git-patchwork-bot.py?id=104e7374e1be8458e6d2e82478625a7bf8c822ff Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Signed-off-by: Daniel Axtens <dja@axtens.net> Acked-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
* parser: Fix style issuesStephen Finucane2019-11-30
| | | | | Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 8c229caa ("Improve pull request URL matching regex")
* docs: Fix note about the required Postfix rightsAli Alnubani2019-11-30
| | | | | | | | | | | | | | The permissions for the user running the postfix process are not the ones used for external file or command delivery by default. The ones defined by default_privs are (in case the aliases(5) file that is owned by root was being used). A privileged user or the postfix owner should not be used in this case. See http://www.postfix.org/postconf.5.html#default_privs and local(8). Signed-off-by: Ali Alnubani <alialnu@mellanox.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* Disable i18n machinery, use correct localeStephen Finucane2019-11-30
| | | | | | | | | | | | | | | | | | | | | Two issues here. Firstly, the use of the 'USE_I18N'. The Django docs describe this as such: A boolean that specifies whether Django’s translation system should be enabled. This provides an easy way to turn it off, for performance. If this is set to False, Django will make some optimizations so as not to load the translation machinery. We don't do translations and won't until such a time as someone comes asking for them. Optimize things accordingly by setting 'USE_I18N' to False and removing the now-unnecessary 'LANGUAGE_CODE' setting. Secondly, the use of en-AU is a bit of a lie since our UI is actually written in US English (or should be). The primary reason for a lang tag to be present is to assist screenreaders and other accessibility tools, so make their lives easier by reflecting the truth. Signed-off-by: Stephen Finucane <stephen@that.guru>
* Improve pull request URL matching regexKonstantin Ryabitsev2019-11-30
| | | | | | | | | | | | | When git-request-pull output is pasted into a mail client instead of mailed directly, the ref part of the pull URL may end up wrapped to the next line. Example: https://lore.kernel.org/r/294422a4-37b2-def5-5d32-8988f27c3a5b@gmail.com/ This change properly parses URLs both with and without newlines. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
* README: trivial fixDaniel Axtens2019-11-07
| | | | | Reviewed-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Daniel Axtens <dja@axtens.net>
* README: stop trying to track supported versionsDaniel Axtens2019-11-07
| | | | | | | | | We're not doing a good job of it, the versions are out of date and we keep forgetting to update the README. We are a bit better at making release notes, so just point people there. Reviewed-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Daniel Axtens <dja@axtens.net>
* README: fix .envDaniel Axtens2019-11-07
| | | | | | | | | | | | | The .env setup didn't do GID. It's a bit of a chore to do because there doesn't seem to be a GID shell variable and because we need to do a bit more work to get a multi-line thing, but this should work. While we're at it, change the docker-compose info, it's hopelessly out of date. Reviewed-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Daniel Axtens <dja@axtens.net>
* Revert "Remove Django 2.0 support"Daniel Axtens2019-11-05
| | | | This reverts commit f09bfd460814d7125437b0b45a183a221692584a.
* Remove Django 2.0 supportDaniel Axtens2019-11-05
| | | | | | | It's no longer supported upstream, per https://www.djangoproject.com/download/#supported-versions Signed-off-by: Daniel Axtens <dja@axtens.net>
* templates: Specify languageAndrew Donnellan2019-11-05
| | | | | | | Specifying language in the <html> tag is recommended in HTML5. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* templates: Get rid of type attribute in script tagsAndrew Donnellan2019-11-05
| | | | | | | | | | | In HTML5, the type attribute of a script tag is optional if it's JavaScript. Remove all occurrences. The only real gain is slightly smaller page output, but it also shuts up validators that like to be noisy about this. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* templates: Move download buttons outside h1 tagAndrew Donnellan2019-11-05
| | | | | | | | It's not valid to put a <div> inside an <h1>. Move the download buttons in the submission template outside the <h1> tag. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* ui: Retain table header position on size changesMete Polat2019-11-01
| | | | | | | | Prevents table header labels from moving up and down when hiding or showing additional information for a patch. Signed-off-by: Mete Polat <metepolat2000@gmail.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* docs: Fix link to deployment guideAli Alnubani2019-10-29
| | | | | | | | The old format redirects to a nonexistent page when there are multiple versions of the docs. Signed-off-by: Ali Alnubani <alialnu@mellanox.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* templates: Fix mismatched close tagsAndrew Donnellan2019-10-29
| | | | | | | There's a </td> rather than </th> in the bundle list. Fix it. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* parser: extend SERIES_DELAY_INTERVALDaniel Axtens2019-10-29
| | | | | | | | | | There was a series on linuxppc today that was spread over ~13 mins, so the last two patches were put into a new series. Extend the time window to 20 mins, and attempt to document it. Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* travis, tox: only do coverage testing in py27Daniel Axtens2019-10-29
| | | | | | | | | | | | | | | | | Currently Travis calls `tox -e coverage` unconditionally. However, the environment has py27 basepython, so all the runs only generate py27 coverage! Rather than try to untangle that, just run the coverage when run in a py27 travis environment. This makes things faster for no loss of coverage. It means that codecov has nothing to submit for the py3x environments, but that's no real loss: it would otherwise submit lots of duplicate data. We could try to improve coverage by running coverage for 27 and 3x, but given that 27 is going away, don't stress at this point. Signed-off-by: Daniel Axtens <dja@axtens.net>
* README: remove dead landscape.io badgeDaniel Axtens2019-10-29
| | | | | | | | | | | | landsape.io is down and seems to have been for some time. The issue tracker [1] doesn't seem to have anything since April. Pull out the broken badge. If landscape.io returns we can add it back later. [1] https://github.com/landscapeio/landscape-issues/issues?q=is%3Aopen+is%3Aissue Signed-off-by: Daniel Axtens <dja@axtens.net>
* travis: fix codecovDaniel Axtens2019-10-29
| | | | | | | | | | | | | | | | | | | | | | | | In e017f69376da ("travis: run pep8/flake8 tests"), codecov was removed from the install step, on the basis that tox-travis would pull it in automatically. This, it turns out, isn't entirely true: it is pulled in to the tox environment, but the data is actually sent in an after_success step. That is outside the tox environment, as it should be - if it were part of the tox environment, running `tox -e coverage` on a developer laptop would try to send data to the web. But, as codecov now isn't present outside the tox environment, we see in the logs: $ codecov codecov: command not found We don't get any reporting of success/failure in the after_success step, so we didn't notice. Restore the installation in the travis environment. Fixes: e017f69376da ("travis: run pep8/flake8 tests") Signed-off-by: Daniel Axtens <dja@axtens.net>
* docker: Specify GID for docker-compose-pg.yml tooDaniel Axtens2019-10-29
| | | | | | | | We just need to mirror the changes in the MySQL/default docker-compose.yml file. Fixes: b4f4c8554c11 ("docker: Require GID also") Signed-off-by: Daniel Axtens <dja@axtens.net>
* travis: Test Python 3.8Daniel Axtens2019-10-29
| | | | | | | An embarassing miss when applying the previous patch. Fixes: 681609f9511c ("Python 3.8 support") Signed-off-by: Daniel Axtens <dja@axtens.net>
* Python 3.8 supportAndrew Donnellan2019-10-24
| | | | | | | Enable Python 3.8 in our tests and list it as a supported version. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* docs: bump the copyright year in the docsDaniel Axtens2019-10-18
| | | | | | | It's 2019. It's almost 2020, in fact! Signed-off-by: Daniel Axtens <dja@axtens.net> Reviewed-by: Stephen Finucane <stephen@that.guru>
* docs: document snowpatch as an API clientDaniel Axtens2019-10-18
| | | | | | | | Snowpatch is one of the few publically visible API clients. Document it in the clients list. Signed-off-by: Daniel Axtens <dja@axtens.net> Reviewed-by: Stephen Finucane <stephen@that.guru>
* tests: Rename inaccurately named test_patchwork_from_headerAndrew Donnellan2019-10-18
| | | | | | | | | | | The test_patchwork_from_header test claims to test for the presence of the X-Patchwork-From header, when we actually call it X-Patchwork-Submitter. Fix it. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> [dja: fix commit message] Signed-off-by: Daniel Axtens <dja@axtens.net>
* parser: Unmangle From: headers that have been mangled for DMARC purposesAndrew Donnellan2019-10-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid triggering spam filters due to failed signature validation, many mailing lists mangle the From header to change the From address to be the address of the list, typically where the sender's domain has a strict DMARC policy enabled. In this case, we should try to unmangle the From header. Add support for using the X-Original-From or Reply-To headers, as used by Google Groups and Mailman respectively, to unmangle the From header when necessary and associate the patch with the correct submitter based on the unmangled email address. When downloading mboxes, rewrite the From header using the unmangled address, and preserve the original header as X-Patchwork-Original-From in case someone needs it for some reason. The original From header will still be stored in the database and exposed via the API, as we want to keep messages as close to the original received format as possible. Closes: #64 ("Incorrect submitter when using googlegroups") Reported-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Tested-by: Daniel Axtens <dja@axtens.net> # mailman only [dja: add release note] Signed-off-by: Daniel Axtens <dja@axtens.net>
* REST: Allow creating, updating, deleting of bundlesStephen Finucane2019-10-17
| | | | | | | | | | Allow users to create a new bundle, change the name, public flag and patches of an existing bundle, and delete an existing bundle. Some small nits with existing tests are resolved. Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #316