From 56e2243f3be7e859666ce0e4e1a8b8b94444f8d4 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 12 Aug 2010 12:15:48 +0800 Subject: Use generic email confirmation object Rather than having a UserPerson-specific confirmation, add an EmailConfirmation object to allow multiple types of confirmations (eg, opt-out requests in future). To do this, we use a view (patchwork.views.confirm) that will call the type-specific view with the confirmation object. Also, add tests to check that the User/Person linkage system works. Signed-off-by: Jeremy Kerr --- lib/sql/migration/008-confirmations.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/sql/migration/008-confirmations.sql (limited to 'lib/sql/migration') diff --git a/lib/sql/migration/008-confirmations.sql b/lib/sql/migration/008-confirmations.sql new file mode 100644 index 0000000..89437a2 --- /dev/null +++ b/lib/sql/migration/008-confirmations.sql @@ -0,0 +1,11 @@ +BEGIN; +ALTER TABLE "patchwork_userpersonconfirmation" + RENAME TO "patchwork_emailconfirmation"; +ALTER SEQUENCE "patchwork_userpersonconfirmation_id_seq" + RENAME TO "patchwork_emailconfirmation_id_seq"; +ALTER TABLE "patchwork_emailconfirmation" + ALTER COLUMN "user_id" DROP NOT NULL, + ADD COLUMN "type" varchar(20) NOT NULL DEFAULT 'userperson'; +ALTER TABLE "patchwork_emailconfirmation" + ALTER COLUMN "type" DROP DEFAULT; +COMMIT; -- cgit v1.2.3 From c2c6a408c7764fa29389ce160f52776c9308d50a Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Sun, 31 Oct 2010 19:29:29 -0400 Subject: registration: use EmailConfimation rather than separate registration app Since we have infrastructure for email confirmations, we no longer need the separate registration app. Requires a migration script, which will delete all inactive users, including those newly added and pending confirmation. Use carefully. Signed-off-by: Jeremy Kerr --- lib/sql/migration/009-drop-registrationprofile.sql | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/sql/migration/009-drop-registrationprofile.sql (limited to 'lib/sql/migration') diff --git a/lib/sql/migration/009-drop-registrationprofile.sql b/lib/sql/migration/009-drop-registrationprofile.sql new file mode 100644 index 0000000..f1c2b43 --- /dev/null +++ b/lib/sql/migration/009-drop-registrationprofile.sql @@ -0,0 +1,27 @@ +BEGIN; + +DELETE FROM registration_registrationprofile; + +-- unlink users who have contributed + +UPDATE patchwork_person SET user_id = NULL + WHERE user_id IN (SELECT id FROM auth_user WHERE is_active = False) + AND id IN (SELECT DISTINCT submitter_id FROM patchwork_comment); + +-- remove persons who only have a user linkage + +DELETE FROM patchwork_person WHERE user_id IN + (SELECT id FROM auth_user WHERE is_active = False); + +-- delete profiles + +DELETE FROM patchwork_userprofile WHERE user_id IN + (SELECT id FROM auth_user WHERE is_active = False); + +-- delete inactive users + +DELETE FROM auth_user WHERE is_active = False; + +DROP TABLE registration_registrationprofile; + +COMMIT; -- cgit v1.2.3 From 41f19b6643b44768dc06561c992c04ed6148477d Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 11 Aug 2010 14:16:28 +0800 Subject: Add email opt-out system We're going to start generating emails on patchwork updates, so firstly allow people to opt-out of all patchwork communications. We do this with a 'mail settings' interface, allowing non-registered users to set preferences on their email address. Logged-in users can do this through the user profile view. Signed-off-by: Jeremy Kerr --- lib/sql/migration/010-optout-tables.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 lib/sql/migration/010-optout-tables.sql (limited to 'lib/sql/migration') diff --git a/lib/sql/migration/010-optout-tables.sql b/lib/sql/migration/010-optout-tables.sql new file mode 100644 index 0000000..0a5d835 --- /dev/null +++ b/lib/sql/migration/010-optout-tables.sql @@ -0,0 +1,5 @@ +BEGIN; +CREATE TABLE "patchwork_emailoptout" ( + "email" varchar(200) NOT NULL PRIMARY KEY +); +COMMIT; -- cgit v1.2.3 From 798a73b8bfb41f742e78e481ab9c961556e117b3 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Tue, 29 Mar 2011 11:58:39 +0800 Subject: models: Add PatchChangeNotification and record patch state changes Add a PatchChangeNotification model to keep track of changes to a patch's state. Hook this up to Patch's pre_save signal. Requires a DB schema upgrade. Signed-off-by: Jeremy Kerr --- lib/sql/migration/011-patch-change-notifications.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/sql/migration/011-patch-change-notifications.sql (limited to 'lib/sql/migration') diff --git a/lib/sql/migration/011-patch-change-notifications.sql b/lib/sql/migration/011-patch-change-notifications.sql new file mode 100644 index 0000000..0a9b9b7 --- /dev/null +++ b/lib/sql/migration/011-patch-change-notifications.sql @@ -0,0 +1,12 @@ +BEGIN; +CREATE TABLE "patchwork_patchchangenotification" ( + "patch_id" integer NOT NULL PRIMARY KEY REFERENCES "patchwork_patch" ("id") DEFERRABLE INITIALLY DEFERRED, + "last_modified" timestamp with time zone NOT NULL, + "orig_state_id" integer NOT NULL REFERENCES "patchwork_state" ("id") DEFERRABLE INITIALLY DEFERRED +) +; +ALTER TABLE "patchwork_project" ADD COLUMN + "send_notifications" boolean NOT NULL DEFAULT False; +ALTER TABLE "patchwork_project" ALTER COLUMN + "send_notifications" DROP DEFAULT; +COMMIT; -- cgit v1.2.3