diff --git a/README.md b/README.md index cbe9dd9a..f90bb60f 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ This is a Django 4.2 application backed by PostgreSQL and running on Python 3.x. ### Ubuntu instructions +#### Install Dependencies / Configure Environment + First, prepare your development environment by installing pip, virtualenv, and postgresql-server-dev-X.Y. ```bash @@ -45,12 +47,24 @@ be provided. ./manage.py migrate ``` -You'll need either a database dump of the actual server's data or else to create a superuser: +#### Load data +For a quick start, you can load some dummy data into the database. Here's how you do that: + +``` +./manage.py loaddata auth_data.json +./manage.py loaddata commitfest_data.json +``` + +If you do this, the admin username and password are `admin` and `admin`. + +On the other hand, if you'd like to start from scratch instead, you can run the following command to create +a super user: ```bash ./manage.py createsuperuser ``` +#### Start application Finally, you're ready to start the application: ```bash @@ -69,3 +83,11 @@ codestyle. ln -s ../../tools/githook/pre-commit .git/hooks/ ``` + +If you'd like to regenerate the database dump files, you can run the following commands: +``` +./manage.py dumpdata auth --format=json --indent=4 --exclude=auth.permission > pgcommitfest/commitfest/fixtures/auth_data.json +./manage.py dumpdata commitfest --format=json --indent=4 > pgcommitfest/commitfest/fixtures/commitfest_data.json +``` + +If you want to reload data from dump file, you can run `drop owned by postgres;` in the `pgcommitfest` database first. diff --git a/pgcommitfest/commitfest/ajax.py b/pgcommitfest/commitfest/ajax.py index eaf7cdc8..76c260ce 100644 --- a/pgcommitfest/commitfest/ajax.py +++ b/pgcommitfest/commitfest/ajax.py @@ -9,6 +9,7 @@ import requests import json import textwrap +import re from pgcommitfest.auth import user_search from .models import CommitFest, Patch, MailThread, MailThreadAttachment @@ -23,7 +24,26 @@ class Http503(Exception): pass +def mockArchivesAPI(path): + with open(settings.MOCK_ARCHIVE_DATA, 'r', encoding='utf-8') as file: + data = json.load(file) + for message in data: + message['atts'] = [] + + message_pattern = re.compile(r"^/message-id\.json/(?P[^/]+)$") + + message_match = message_pattern.match(path) + if message_match: + message_id = message_match.group("message_id") + return [message for message in data if message['msgid'] == message_id] + else: + return data + + def _archivesAPI(suburl, params=None): + if getattr(settings, 'MOCK_ARCHIVES', False) and getattr(settings, 'MOCK_ARCHIVE_DATA'): + return mockArchivesAPI(suburl) + try: resp = requests.get( "http{0}://{1}:{2}{3}".format(settings.ARCHIVES_PORT == 443 and 's' or '', diff --git a/pgcommitfest/commitfest/fixtures/archive_data.json b/pgcommitfest/commitfest/fixtures/archive_data.json new file mode 100644 index 00000000..680ea086 --- /dev/null +++ b/pgcommitfest/commitfest/fixtures/archive_data.json @@ -0,0 +1,602 @@ +[ + { + "msgid": "example@message-0", + "date": "2025-01-20T14:20:10", + "from": "test@test.com", + "subj": "Re: Sample rate added to pg_stat_statements" + }, + { + "msgid": "example@message-1", + "date": "2025-01-20T14:01:53", + "from": "test@test.com", + "subj": "Re: [PATCH] Add get_bytes() and set_bytes() functions" + }, + { + "msgid": "example@message-2", + "date": "2025-01-20T13:49:45", + "from": "test@test.com", + "subj": "pg_stat_statements: improve loading and saving routines for the dump\n file" + }, + { + "msgid": "example@message-3", + "date": "2025-01-20T13:26:55", + "from": "test@test.com", + "subj": "Re: per backend I/O statistics" + }, + { + "msgid": "example@message-4", + "date": "2025-01-20T12:44:40", + "from": "test@test.com", + "subj": "Re: create subscription with (origin = none, copy_data = on)" + }, + { + "msgid": "example@message-5", + "date": "2025-01-20T11:10:40", + "from": "test@test.com", + "subj": "Re: per backend I/O statistics" + }, + { + "msgid": "example@message-6", + "date": "2025-01-20T08:21:35", + "from": "test@test.com", + "subj": "Re: Statistics Import and Export" + }, + { + "msgid": "example@message-7", + "date": "2025-01-20T08:03:54", + "from": "test@test.com", + "subj": "Re: Introduce XID age and inactive timeout based replication slot invalidation" + }, + { + "msgid": "example@message-8", + "date": "2025-01-20T06:53:39", + "from": "test@test.com", + "subj": "RE: Conflict detection for update_deleted in logical replication" + }, + { + "msgid": "example@message-9", + "date": "2025-01-20T06:49:41", + "from": "test@test.com", + "subj": "Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility." + }, + { + "msgid": "example@message-10", + "date": "2025-01-20T06:34:41", + "from": "test@test.com", + "subj": "Re: per backend I/O statistics" + }, + { + "msgid": "example@message-11", + "date": "2025-01-20T05:56:21", + "from": "test@test.com", + "subj": "Re: [PATCH] immediately kill psql process if server is not running." + }, + { + "msgid": "example@message-12", + "date": "2025-01-20T05:33:23", + "from": "test@test.com", + "subj": "Re: connection establishment versus parallel workers" + }, + { + "msgid": "example@message-13", + "date": "2025-01-20T05:32:07", + "from": "test@test.com", + "subj": "Re: Pgoutput not capturing the generated columns" + }, + { + "msgid": "example@message-14", + "date": "2025-01-20T04:10:41", + "from": "test@test.com", + "subj": "Re: Pgoutput not capturing the generated columns" + }, + { + "msgid": "example@message-15", + "date": "2025-01-20T04:01:27", + "from": "test@test.com", + "subj": "int64 support in List API" + }, + { + "msgid": "example@message-16", + "date": "2025-01-19T23:55:17", + "from": "test@test.com", + "subj": "Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options" + }, + { + "msgid": "example@message-17", + "date": "2025-01-19T23:47:14", + "from": "test@test.com", + "subj": "Re: attndims, typndims still not enforced, but make the value within a sane threshold" + }, + { + "msgid": "example@message-18", + "date": "2025-01-19T15:50:49", + "from": "test@test.com", + "subj": "Re: Parallel heap vacuum" + }, + { + "msgid": "example@message-19", + "date": "2025-01-19T14:56:49", + "from": "test@test.com", + "subj": "Re: [RFC] Lock-free XLog Reservation from WAL" + }, + { + "msgid": "example@message-20", + "date": "2025-01-19T12:16:49", + "from": "test@test.com", + "subj": "Re: Pgoutput not capturing the generated columns" + }, + { + "msgid": "example@message-21", + "date": "2025-01-19T09:33:55", + "from": "test@test.com", + "subj": "Re: Add XMLNamespaces to XMLElement" + }, + { + "msgid": "example@message-22", + "date": "2025-01-19T00:11:32", + "from": "test@test.com", + "subj": "Get rid of WALBufMappingLock" + }, + { + "msgid": "example@message-23", + "date": "2025-01-18T23:42:50", + "from": "test@test.com", + "subj": "Re: improve DEBUG1 logging of parallel workers for CREATE INDEX?" + }, + { + "msgid": "example@message-24", + "date": "2025-01-18T20:37:54", + "from": "test@test.com", + "subj": "Re: Adding comments to help understand psql hidden queries" + }, + { + "msgid": "example@message-25", + "date": "2025-01-18T19:44:00", + "from": "test@test.com", + "subj": "Re: Coccinelle for PostgreSQL development [1/N]: coccicheck.py" + }, + { + "msgid": "example@message-26", + "date": "2025-01-18T17:32:10", + "from": "test@test.com", + "subj": "Re: Replace current implementations in crypt() and gen_salt() to\n OpenSSL" + }, + { + "msgid": "example@message-27", + "date": "2025-01-18T17:00:04", + "from": "test@test.com", + "subj": "Re: Statistics Import and Export" + }, + { + "msgid": "example@message-28", + "date": "2025-01-18T16:51:08", + "from": "test@test.com", + "subj": "Re: Confine vacuum skip logic to lazy_scan_skip" + }, + { + "msgid": "example@message-29", + "date": "2025-01-18T14:18:00", + "from": "test@test.com", + "subj": "Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements" + }, + { + "msgid": "example@message-30", + "date": "2025-01-18T12:59:35", + "from": "test@test.com", + "subj": "Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY" + }, + { + "msgid": "example@message-31", + "date": "2025-01-18T07:14:02", + "from": "test@test.com", + "subj": "Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs" + }, + { + "msgid": "example@message-32", + "date": "2025-01-18T06:42:15", + "from": "test@test.com", + "subj": "Re: Collation & ctype method table, and extension hooks" + }, + { + "msgid": "example@message-33", + "date": "2025-01-18T05:01:27", + "from": "test@test.com", + "subj": "Re: create subscription with (origin = none, copy_data = on)" + }, + { + "msgid": "example@message-34", + "date": "2025-01-18T03:45:13", + "from": "test@test.com", + "subj": "RE: Conflict detection for update_deleted in logical replication" + }, + { + "msgid": "example@message-35", + "date": "2025-01-18T02:02:03", + "from": "test@test.com", + "subj": "Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs" + }, + { + "msgid": "example@message-36", + "date": "2025-01-18T01:23:19", + "from": "test@test.com", + "subj": "rename es_epq_active to es_epqstate" + }, + { + "msgid": "example@message-37", + "date": "2025-01-18T01:11:41", + "from": "test@test.com", + "subj": "Re: pg_trgm comparison bug on cross-architecture replication due to\n different char implementation" + }, + { + "msgid": "example@message-38", + "date": "2025-01-18T00:34:43", + "from": "test@test.com", + "subj": "Re: Add CASEFOLD() function." + }, + { + "msgid": "example@message-39", + "date": "2025-01-18T00:27:43", + "from": "test@test.com", + "subj": "Re: [PATCH] Add roman support for to_number function" + }, + { + "msgid": "example@message-40", + "date": "2025-01-17T22:11:56", + "from": "test@test.com", + "subj": "Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs" + }, + { + "msgid": "example@message-41", + "date": "2025-01-17T20:44:01", + "from": "test@test.com", + "subj": "Re: Bug in detaching a partition with a foreign key." + }, + { + "msgid": "example@message-42", + "date": "2025-01-17T19:02:15", + "from": "test@test.com", + "subj": "Re: [PoC] Federated Authn/z with OAUTHBEARER" + }, + { + "msgid": "example@message-43", + "date": "2025-01-17T16:43:29", + "from": "test@test.com", + "subj": "Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options" + }, + { + "msgid": "example@message-44", + "date": "2025-01-17T16:01:53", + "from": "test@test.com", + "subj": "Re: Accept recovery conflict interrupt on blocked writing" + }, + { + "msgid": "example@message-45", + "date": "2025-01-17T15:45:46", + "from": "test@test.com", + "subj": "Re: Set AUTOCOMMIT to on in script output by pg_dump" + }, + { + "msgid": "example@message-46", + "date": "2025-01-17T15:42:13", + "from": "test@test.com", + "subj": "Re: POC: track vacuum/analyze cumulative time per relation" + }, + { + "msgid": "example@message-47", + "date": "2025-01-17T15:40:54", + "from": "test@test.com", + "subj": "Re: pure parsers and reentrant scanners" + }, + { + "msgid": "example@message-48", + "date": "2025-01-17T14:20:12", + "from": "test@test.com", + "subj": "Re: Statistics Import and Export" + }, + { + "msgid": "example@message-49", + "date": "2025-01-17T12:50:15", + "from": "test@test.com", + "subj": "Re: NOT ENFORCED constraint feature" + }, + { + "msgid": "example@message-50", + "date": "2025-01-17T12:03:09", + "from": "test@test.com", + "subj": "Re: Bypassing cursors in postgres_fdw to enable parallel plans" + }, + { + "msgid": "example@message-51", + "date": "2025-01-17T10:23:48", + "from": "test@test.com", + "subj": "Re: per backend I/O statistics" + }, + { + "msgid": "example@message-52", + "date": "2025-01-17T09:29:50", + "from": "test@test.com", + "subj": "Re: Add “FOR UPDATE NOWAIT” lock details to the log." + }, + { + "msgid": "example@message-53", + "date": "2025-01-17T08:30:04", + "from": "test@test.com", + "subj": "create subscription with (origin = none, copy_data = on)" + }, + { + "msgid": "example@message-54", + "date": "2025-01-17T07:18:20", + "from": "test@test.com", + "subj": "Re: Re: proposal: schema variables" + }, + { + "msgid": "example@message-55", + "date": "2025-01-17T07:15:34", + "from": "test@test.com", + "subj": "Re: SQLFunctionCache and generic plans" + }, + { + "msgid": "example@message-56", + "date": "2025-01-17T05:05:41", + "from": "test@test.com", + "subj": "Re: Some ExecSeqScan optimizations" + }, + { + "msgid": "example@message-57", + "date": "2025-01-17T05:00:49", + "from": "test@test.com", + "subj": "Remove XLogRecGetFullXid() in xlogreader.c?" + }, + { + "msgid": "example@message-58", + "date": "2025-01-17T04:22:07", + "from": "test@test.com", + "subj": "Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility." + }, + { + "msgid": "example@message-59", + "date": "2025-01-17T03:18:45", + "from": "test@test.com", + "subj": "Automatic update of time column" + }, + { + "msgid": "example@message-60", + "date": "2025-01-17T01:06:14", + "from": "test@test.com", + "subj": "Re: Parallel heap vacuum" + }, + { + "msgid": "example@message-61", + "date": "2025-01-17T01:05:53", + "from": "test@test.com", + "subj": "Timeline issue if StartupXLOG() is interrupted right before\n end-of-recovery record is done" + }, + { + "msgid": "example@message-62", + "date": "2025-01-16T22:50:14", + "from": "test@test.com", + "subj": "Re: Trigger more frequent autovacuums of heavy insert tables" + }, + { + "msgid": "example@message-63", + "date": "2025-01-16T22:41:06", + "from": "test@test.com", + "subj": "Re: Document NULL" + }, + { + "msgid": "example@message-64", + "date": "2025-01-16T21:43:49", + "from": "test@test.com", + "subj": "Re: Trigger more frequent autovacuums of heavy insert tables" + }, + { + "msgid": "example@message-65", + "date": "2025-01-16T20:52:54", + "from": "test@test.com", + "subj": "Re: An improvement of ProcessTwoPhaseBuffer logic" + }, + { + "msgid": "example@message-66", + "date": "2025-01-16T19:38:21", + "from": "test@test.com", + "subj": "Re: Document How Commit Handles Aborted Transactions" + }, + { + "msgid": "example@message-67", + "date": "2025-01-16T18:42:32", + "from": "test@test.com", + "subj": "Re: Non-text mode for pg_dumpall" + }, + { + "msgid": "example@message-68", + "date": "2025-01-16T15:59:31", + "from": "test@test.com", + "subj": "Re: per backend WAL statistics" + }, + { + "msgid": "example@message-69", + "date": "2025-01-16T14:14:25", + "from": "test@test.com", + "subj": "Re: [PATCH] Add sortsupport for range types and btree_gist" + }, + { + "msgid": "example@message-70", + "date": "2025-01-16T13:53:31", + "from": "test@test.com", + "subj": "Bug in detaching a partition with a foreign key." + }, + { + "msgid": "example@message-71", + "date": "2025-01-16T13:52:46", + "from": "test@test.com", + "subj": "Increase NUM_XLOGINSERT_LOCKS" + }, + { + "msgid": "example@message-72", + "date": "2025-01-16T13:32:09", + "from": "test@test.com", + "subj": "Re: POC: make mxidoff 64 bits" + }, + { + "msgid": "example@message-73", + "date": "2025-01-16T13:24:41", + "from": "test@test.com", + "subj": "Re: Accept recovery conflict interrupt on blocked writing" + }, + { + "msgid": "example@message-74", + "date": "2025-01-16T11:16:06", + "from": "test@test.com", + "subj": "Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility." + }, + { + "msgid": "example@message-75", + "date": "2025-01-16T10:54:53", + "from": "test@test.com", + "subj": "Re: Change GUC hashtable to use simplehash?" + }, + { + "msgid": "example@message-76", + "date": "2025-01-16T10:54:22", + "from": "test@test.com", + "subj": "Re: Psql meta-command conninfo+" + }, + { + "msgid": "example@message-77", + "date": "2025-01-16T08:47:08", + "from": "test@test.com", + "subj": "Re: Pgoutput not capturing the generated columns" + }, + { + "msgid": "example@message-78", + "date": "2025-01-16T08:44:18", + "from": "test@test.com", + "subj": "Re: Non-text mode for pg_dumpall" + }, + { + "msgid": "example@message-79", + "date": "2025-01-16T08:40:51", + "from": "test@test.com", + "subj": "Re: Show WAL write and fsync stats in pg_stat_io" + }, + { + "msgid": "example@message-80", + "date": "2025-01-16T07:50:09", + "from": "test@test.com", + "subj": "Re: An improvement of ProcessTwoPhaseBuffer logic" + }, + { + "msgid": "example@message-81", + "date": "2025-01-16T07:21:13", + "from": "test@test.com", + "subj": "Re: XMLDocument (SQL/XML X030)" + }, + { + "msgid": "example@message-82", + "date": "2025-01-16T07:05:16", + "from": "test@test.com", + "subj": "Re: Introduce XID age and inactive timeout based replication slot invalidation" + }, + { + "msgid": "example@message-83", + "date": "2025-01-16T07:04:23", + "from": "test@test.com", + "subj": "Re: Log a warning in pg_createsubscriber for max_slot_wal_keep_size" + }, + { + "msgid": "example@message-84", + "date": "2025-01-16T05:38:19", + "from": "test@test.com", + "subj": "Re: TOAST versus toast" + }, + { + "msgid": "example@message-85", + "date": "2025-01-16T05:17:39", + "from": "test@test.com", + "subj": "Re: Log a warning in pg_createsubscriber for max_slot_wal_keep_size" + }, + { + "msgid": "example@message-86", + "date": "2025-01-16T05:13:08", + "from": "test@test.com", + "subj": "Re: Make pg_stat_io view count IOs as bytes instead of blocks" + }, + { + "msgid": "example@message-87", + "date": "2025-01-16T04:14:31", + "from": "test@test.com", + "subj": "Re: Make pg_stat_io view count IOs as bytes instead of blocks" + }, + { + "msgid": "example@message-88", + "date": "2025-01-16T03:57:49", + "from": "test@test.com", + "subj": "TOAST versus toast" + }, + { + "msgid": "example@message-89", + "date": "2025-01-16T02:19:49", + "from": "test@test.com", + "subj": "Limit length of queryies in pg_stat_statement extension" + }, + { + "msgid": "example@message-90", + "date": "2025-01-16T01:45:15", + "from": "test@test.com", + "subj": "Re: Confine vacuum skip logic to lazy_scan_skip" + }, + { + "msgid": "example@message-91", + "date": "2025-01-16T01:15:31", + "from": "test@test.com", + "subj": "Re: Change GUC hashtable to use simplehash?" + }, + { + "msgid": "example@message-92", + "date": "2025-01-16T01:12:51", + "from": "test@test.com", + "subj": "Fix misuse use of pg_b64_encode function (contrib/postgres_fdw/connection.c)" + }, + { + "msgid": "example@message-93", + "date": "2025-01-16T01:00:51", + "from": "test@test.com", + "subj": "Re: An improvement of ProcessTwoPhaseBuffer logic" + }, + { + "msgid": "example@message-94", + "date": "2025-01-16T00:42:49", + "from": "test@test.com", + "subj": "Re: Infinite loop in XLogPageRead() on standby" + }, + { + "msgid": "example@message-95", + "date": "2025-01-15T23:47:51", + "from": "test@test.com", + "subj": "Re: convert libpgport's pqsignal() to a void function" + }, + { + "msgid": "example@message-96", + "date": "2025-01-15T22:20:58", + "from": "test@test.com", + "subj": "Re: Use Python \"Limited API\" in PL/Python" + }, + { + "msgid": "example@message-97", + "date": "2025-01-15T20:56:04", + "from": "test@test.com", + "subj": "Re: Statistics Import and Export" + }, + { + "msgid": "example@message-98", + "date": "2025-01-15T20:55:52", + "from": "test@test.com", + "subj": "Re: Eagerly scan all-visible pages to amortize aggressive vacuum" + }, + { + "msgid": "example@message-99", + "date": "2025-01-15T20:35:41", + "from": "test@test.com", + "subj": "Re: Add XMLNamespaces to XMLElement" + } +] diff --git a/pgcommitfest/commitfest/fixtures/auth_data.json b/pgcommitfest/commitfest/fixtures/auth_data.json new file mode 100644 index 00000000..bfaf3bfb --- /dev/null +++ b/pgcommitfest/commitfest/fixtures/auth_data.json @@ -0,0 +1,20 @@ +[ +{ + "model": "auth.user", + "pk": 1, + "fields": { + "password": "pbkdf2_sha256$600000$49rgHaLmmFQUm7c663LCrU$i68PFeI493lPmgNx/RHnWNuw4ZRzzvJWNqU4os5VnF4=", + "last_login": "2025-01-26T10:43:07.735", + "is_superuser": true, + "username": "admin", + "first_name": "", + "last_name": "", + "email": "test@test.com", + "is_staff": true, + "is_active": true, + "date_joined": "2025-01-20T15:47:04.132", + "groups": [], + "user_permissions": [] + } +} +] diff --git a/pgcommitfest/commitfest/fixtures/commitfest_data.json b/pgcommitfest/commitfest/fixtures/commitfest_data.json new file mode 100644 index 00000000..4befdfa4 --- /dev/null +++ b/pgcommitfest/commitfest/fixtures/commitfest_data.json @@ -0,0 +1,373 @@ +[ +{ + "model": "commitfest.commitfest", + "pk": 1, + "fields": { + "name": "Sample Old Commitfest", + "status": 4, + "startdate": "2024-05-01", + "enddate": "2024-05-31" + } +}, +{ + "model": "commitfest.commitfest", + "pk": 2, + "fields": { + "name": "Sample In Progress Commitfest", + "status": 3, + "startdate": "2025-01-01", + "enddate": "2025-02-28" + } +}, +{ + "model": "commitfest.commitfest", + "pk": 3, + "fields": { + "name": "Sample Open Commitfest", + "status": 2, + "startdate": "2025-03-01", + "enddate": "2025-03-31" + } +}, +{ + "model": "commitfest.commitfest", + "pk": 4, + "fields": { + "name": "Sample Future Commitfest", + "status": 1, + "startdate": "2025-05-01", + "enddate": "2025-05-31" + } +}, +{ + "model": "commitfest.topic", + "pk": 1, + "fields": { + "topic": "Bugs" + } +}, +{ + "model": "commitfest.topic", + "pk": 2, + "fields": { + "topic": "Performance" + } +}, +{ + "model": "commitfest.topic", + "pk": 3, + "fields": { + "topic": "Miscellaneous" + } +}, +{ + "model": "commitfest.targetversion", + "pk": 1, + "fields": { + "version": "18" + } +}, +{ + "model": "commitfest.patch", + "pk": 1, + "fields": { + "name": "Conflict detection for update_deleted in logical replication", + "topic": 1, + "wikilink": "", + "gitlink": "", + "targetversion": null, + "committer": null, + "created": "2025-01-26T10:48:31.579", + "modified": "2025-01-26T10:53:20.498", + "lastmail": "2025-01-20T06:53:39", + "authors": [ + 1 + ], + "reviewers": [], + "subscribers": [], + "mailthread_set": [ + 1 + ] + } +}, +{ + "model": "commitfest.patch", + "pk": 2, + "fields": { + "name": "Sample rate added to pg_stat_statements", + "topic": 3, + "wikilink": "", + "gitlink": "", + "targetversion": null, + "committer": null, + "created": "2025-01-26T10:51:17.305", + "modified": "2025-01-26T10:51:19.631", + "lastmail": "2025-01-20T14:20:10", + "authors": [], + "reviewers": [], + "subscribers": [], + "mailthread_set": [ + 2 + ] + } +}, +{ + "model": "commitfest.patch", + "pk": 3, + "fields": { + "name": "Per Backend I/O statistics", + "topic": 3, + "wikilink": "", + "gitlink": "", + "targetversion": null, + "committer": null, + "created": "2025-01-26T11:02:07.467", + "modified": "2025-01-26T11:02:10.911", + "lastmail": "2025-01-20T13:26:55", + "authors": [], + "reviewers": [], + "subscribers": [], + "mailthread_set": [ + 3 + ] + } +}, +{ + "model": "commitfest.patchoncommitfest", + "pk": 1, + "fields": { + "patch": 1, + "commitfest": 2, + "enterdate": "2025-01-26T10:48:31.579", + "leavedate": null, + "status": 3 + } +}, +{ + "model": "commitfest.patchoncommitfest", + "pk": 2, + "fields": { + "patch": 2, + "commitfest": 2, + "enterdate": "2025-01-26T10:51:17.305", + "leavedate": null, + "status": 1 + } +}, +{ + "model": "commitfest.patchoncommitfest", + "pk": 3, + "fields": { + "patch": 1, + "commitfest": 1, + "enterdate": "2024-04-01T10:52:24", + "leavedate": "2024-06-05T10:52:34", + "status": 5 + } +}, +{ + "model": "commitfest.patchoncommitfest", + "pk": 4, + "fields": { + "patch": 3, + "commitfest": 3, + "enterdate": "2025-01-26T11:02:07.467", + "leavedate": null, + "status": 1 + } +}, +{ + "model": "commitfest.patchhistory", + "pk": 1, + "fields": { + "patch": 1, + "date": "2025-01-26T10:48:31.580", + "by": 1, + "by_cfbot": false, + "what": "Created patch record" + } +}, +{ + "model": "commitfest.patchhistory", + "pk": 2, + "fields": { + "patch": 1, + "date": "2025-01-26T10:48:31.582", + "by": 1, + "by_cfbot": false, + "what": "Attached mail thread example@message-8" + } +}, +{ + "model": "commitfest.patchhistory", + "pk": 3, + "fields": { + "patch": 1, + "date": "2025-01-26T10:48:54.115", + "by": 1, + "by_cfbot": false, + "what": "Changed authors to (admin)" + } +}, +{ + "model": "commitfest.patchhistory", + "pk": 4, + "fields": { + "patch": 2, + "date": "2025-01-26T10:51:17.306", + "by": 1, + "by_cfbot": false, + "what": "Created patch record" + } +}, +{ + "model": "commitfest.patchhistory", + "pk": 5, + "fields": { + "patch": 2, + "date": "2025-01-26T10:51:17.307", + "by": 1, + "by_cfbot": false, + "what": "Attached mail thread example@message-0" + } +}, +{ + "model": "commitfest.patchhistory", + "pk": 6, + "fields": { + "patch": 1, + "date": "2025-01-26T10:53:20.498", + "by": 1, + "by_cfbot": false, + "what": "New status: Ready for Committer" + } +}, +{ + "model": "commitfest.patchhistory", + "pk": 7, + "fields": { + "patch": 3, + "date": "2025-01-26T11:02:07.468", + "by": 1, + "by_cfbot": false, + "what": "Created patch record" + } +}, +{ + "model": "commitfest.patchhistory", + "pk": 8, + "fields": { + "patch": 3, + "date": "2025-01-26T11:02:07.469", + "by": 1, + "by_cfbot": false, + "what": "Attached mail thread example@message-3" + } +}, +{ + "model": "commitfest.mailthread", + "pk": 1, + "fields": { + "messageid": "example@message-8", + "subject": "RE: Conflict detection for update_deleted in logical replication", + "firstmessage": "2025-01-20T06:53:39", + "firstauthor": "test@test.com", + "latestmessage": "2025-01-20T06:53:39", + "latestauthor": "test@test.com", + "latestsubject": "RE: Conflict detection for update_deleted in logical replication", + "latestmsgid": "example@message-8" + } +}, +{ + "model": "commitfest.mailthread", + "pk": 2, + "fields": { + "messageid": "example@message-0", + "subject": "Re: Sample rate added to pg_stat_statements", + "firstmessage": "2025-01-20T14:20:10", + "firstauthor": "test@test.com", + "latestmessage": "2025-01-20T14:20:10", + "latestauthor": "test@test.com", + "latestsubject": "Re: Sample rate added to pg_stat_statements", + "latestmsgid": "example@message-0" + } +}, +{ + "model": "commitfest.mailthread", + "pk": 3, + "fields": { + "messageid": "example@message-3", + "subject": "Re: per backend I/O statistics", + "firstmessage": "2025-01-20T13:26:55", + "firstauthor": "test@test.com", + "latestmessage": "2025-01-20T13:26:55", + "latestauthor": "test@test.com", + "latestsubject": "Re: per backend I/O statistics", + "latestmsgid": "example@message-3" + } +}, +{ + "model": "commitfest.patchstatus", + "pk": 1, + "fields": { + "statusstring": "Needs review", + "sortkey": 10 + } +}, +{ + "model": "commitfest.patchstatus", + "pk": 2, + "fields": { + "statusstring": "Waiting on Author", + "sortkey": 15 + } +}, +{ + "model": "commitfest.patchstatus", + "pk": 3, + "fields": { + "statusstring": "Ready for Committer", + "sortkey": 20 + } +}, +{ + "model": "commitfest.patchstatus", + "pk": 4, + "fields": { + "statusstring": "Committed", + "sortkey": 25 + } +}, +{ + "model": "commitfest.patchstatus", + "pk": 5, + "fields": { + "statusstring": "Moved to next CF", + "sortkey": 30 + } +}, +{ + "model": "commitfest.patchstatus", + "pk": 6, + "fields": { + "statusstring": "Rejected", + "sortkey": 50 + } +}, +{ + "model": "commitfest.patchstatus", + "pk": 7, + "fields": { + "statusstring": "Returned with Feedback", + "sortkey": 50 + } +}, +{ + "model": "commitfest.patchstatus", + "pk": 8, + "fields": { + "statusstring": "Withdrawn", + "sortkey": 50 + } +} +] diff --git a/pgcommitfest/commitfest/forms.py b/pgcommitfest/commitfest/forms.py index 61d90463..ec0c62ae 100644 --- a/pgcommitfest/commitfest/forms.py +++ b/pgcommitfest/commitfest/forms.py @@ -44,7 +44,7 @@ class PatchForm(forms.ModelForm): class Meta: model = Patch - exclude = ('commitfests', 'mailthreads', 'modified', 'lastmail', 'subscribers', ) + exclude = ('commitfests', 'mailthread_set', 'modified', 'lastmail', 'subscribers', ) def __init__(self, *args, **kwargs): super(PatchForm, self).__init__(*args, **kwargs) diff --git a/pgcommitfest/commitfest/migrations/0008_move_mail_thread_many_to_many.py b/pgcommitfest/commitfest/migrations/0008_move_mail_thread_many_to_many.py new file mode 100644 index 00000000..72d9d425 --- /dev/null +++ b/pgcommitfest/commitfest/migrations/0008_move_mail_thread_many_to_many.py @@ -0,0 +1,28 @@ +# Generated by Django 4.2.17 on 2025-01-25 11:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('commitfest', '0007_needs_rebase_emails'), + ] + + operations = [ + migrations.RunSQL( + migrations.RunSQL.noop, + reverse_sql=migrations.RunSQL.noop, + state_operations=[ + migrations.RemoveField( + model_name='mailthread', + name='patches', + ), + migrations.AddField( + model_name='patch', + name='mailthread_set', + field=models.ManyToManyField(db_table='commitfest_mailthread_patches', related_name='patches', to='commitfest.mailthread'), + ), + ] + ) + ] diff --git a/pgcommitfest/commitfest/models.py b/pgcommitfest/commitfest/models.py index 0a7e9e01..43804468 100644 --- a/pgcommitfest/commitfest/models.py +++ b/pgcommitfest/commitfest/models.py @@ -109,6 +109,8 @@ class Patch(models.Model, DiffableModel): # Users to be notified when something happens subscribers = models.ManyToManyField(User, related_name='patch_subscriber', blank=True) + mailthread_set = models.ManyToManyField("MailThread", related_name="patches", blank=False, db_table="commitfest_mailthread_patches") + # Datestamps for tracking activity created = models.DateTimeField(blank=False, null=False, auto_now_add=True) modified = models.DateTimeField(blank=False, null=False) @@ -302,7 +304,6 @@ class MailThread(models.Model): # so we can keep track of when there was last a change on the # thread in question. messageid = models.CharField(max_length=1000, null=False, blank=False, unique=True) - patches = models.ManyToManyField(Patch, blank=False) subject = models.CharField(max_length=500, null=False, blank=False) firstmessage = models.DateTimeField(null=False, blank=False) firstauthor = models.CharField(max_length=500, null=False, blank=False) diff --git a/pgcommitfest/local_settings_example.py b/pgcommitfest/local_settings_example.py index d3648ccb..31da1f02 100644 --- a/pgcommitfest/local_settings_example.py +++ b/pgcommitfest/local_settings_example.py @@ -1,3 +1,5 @@ +import os + # Enable more debugging information DEBUG = True # Prevent logging to try to send emails to postgresql.org admins. @@ -22,3 +24,7 @@ # It's not great, because it won't redirect to the page you were trying to # access, but it's better than a HTTP 500 error. PGAUTH_REDIRECT = '/admin/login/' + +MOCK_ARCHIVES = True +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +MOCK_ARCHIVE_DATA = os.path.join(BASE_DIR, 'commitfest', 'fixtures', 'archive_data.json')