-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the visibility levels of some donations
- Loading branch information
Showing
6 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
SELECT 'after deployment'; | ||
BEGIN; | ||
CREATE TEMPORARY TABLE _tippees ON COMMIT DROP AS ( | ||
SELECT e.participant AS id | ||
, (CASE WHEN e.payload->>'patron_visibilities' = '2' THEN 2 ELSE 3 END) AS only_accepted_visibility | ||
, e.ts AS start_time | ||
, coalesce(( | ||
SELECT e2.ts | ||
FROM events e2 | ||
WHERE e2.participant = e.participant | ||
AND e2.type = 'recipient_settings' | ||
AND e2.ts > e.ts | ||
ORDER BY e2.ts | ||
LIMIT 1 | ||
), current_timestamp) AS end_time | ||
FROM events e | ||
WHERE e.type = 'recipient_settings' | ||
AND e.payload->>'patron_visibilities' IN ('2', '4') | ||
); | ||
UPDATE tips AS tip | ||
SET visibility = tippee.only_accepted_visibility | ||
FROM _tippees AS tippee | ||
WHERE tip.tippee = tippee.id | ||
AND tip.mtime > tippee.start_time | ||
AND tip.mtime < tippee.end_time | ||
AND tip.visibility <> tippee.only_accepted_visibility; | ||
UPDATE payin_transfers AS pt | ||
SET visibility = tippee.only_accepted_visibility | ||
FROM _tippees AS tippee | ||
WHERE pt.recipient = tippee.id | ||
AND pt.ctime > tippee.start_time | ||
AND pt.ctime < tippee.end_time | ||
AND pt.visibility <> tippee.only_accepted_visibility; | ||
ROLLBACK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ def test_donation_form_v2(self): | |
creator = self.make_participant( | ||
'creator', accepted_currencies=None, email='[email protected]', | ||
) | ||
creator.update_recipient_settings(patron_visibilities=7) | ||
r = self.client.GET('/creator/donate?currency=KRW') | ||
assert r.code == 200 | ||
assert ">Pledge<" in r.text | ||
|
@@ -54,6 +55,7 @@ def test_donation_form_v2_does_not_overwrite_visibility(self): | |
creator = self.make_participant( | ||
'creator', accepted_currencies=None, email='[email protected]', | ||
) | ||
creator.update_recipient_settings(patron_visibilities=7) | ||
self.add_payment_account(creator, 'stripe') | ||
donor = self.make_participant('donor') | ||
donor.set_tip_to(creator, USD('10.00'), renewal_mode=1, visibility=3) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters