From 5e5b790faf215d2c238f6d6f20375f3e127f2388 Mon Sep 17 00:00:00 2001 From: Mark Musante Date: Sun, 1 Jun 2025 17:35:41 -0400 Subject: [PATCH 1/5] latest docker doesn't support volume options like nocopy --- IFComp-Dev/docker-compose.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/IFComp-Dev/docker-compose.yml b/IFComp-Dev/docker-compose.yml index ba8f64e9..df9c5bb8 100644 --- a/IFComp-Dev/docker-compose.yml +++ b/IFComp-Dev/docker-compose.yml @@ -13,13 +13,9 @@ services: - type: bind source: ../IFComp target: /opt/IFComp - volume: - nocopy: true - type: bind source: ./docker-app/docker-script target: /opt/IFComp-Dev/script - volume: - nocopy: true web: build: ./docker-web ports: @@ -32,8 +28,6 @@ services: - type: bind source: ../IFComp target: /opt/IFComp - volume: - nocopy: true db: image: mariadb:10.3 environment: From bb6a15920c07f229ffd7a12eb86d4a13b283124a Mon Sep 17 00:00:00 2001 From: Mark Musante Date: Sun, 1 Jun 2025 17:36:29 -0400 Subject: [PATCH 2/5] split paypal and venmo; ensure entrant has filled in something --- IFComp/lib/IFComp/Controller/Entry.pm | 4 +++ IFComp/lib/IFComp/Form/UserFields.pm | 38 +++++++++++++++++++++---- IFComp/lib/IFComp/Schema/Result/User.pm | 12 ++++++-- IFComp/root/src/entry/list.tt | 6 +++- 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/IFComp/lib/IFComp/Controller/Entry.pm b/IFComp/lib/IFComp/Controller/Entry.pm index 5b2e093d..1fcfeb9d 100644 --- a/IFComp/lib/IFComp/Controller/Entry.pm +++ b/IFComp/lib/IFComp/Controller/Entry.pm @@ -101,6 +101,10 @@ sub create : Chained('root') : PathPart('create') : Args(0) { $c->res->redirect( $c->uri_for_action('/entry/list') ); } + if ( $c->user->paypal eq '' && $c->user->venmo eq '' ) { + $c->res->redirect( $c->uri_for_action('/entry/list') ); + } + my %new_result_args = ( comp => $c->stash->{current_comp}, author => $c->user->get_object->id, diff --git a/IFComp/lib/IFComp/Form/UserFields.pm b/IFComp/lib/IFComp/Form/UserFields.pm index a3fe2737..2e08807e 100644 --- a/IFComp/lib/IFComp/Form/UserFields.pm +++ b/IFComp/lib/IFComp/Form/UserFields.pm @@ -41,7 +41,14 @@ has_field 'forum_handle' => ( has_field 'paypal' => ( type => 'Text', label => - 'Paypal address, or Venmo handle/phone number (or "decline" if not interested in monetary awards)', + 'Paypal email address, or enter "decline" if not interested in monetary awards', + maxlength => 64, +); + +has_field 'venmo' => ( + type => 'Text', + label => + 'Venmo username/phone number, or enter "decline" if not interested in monetary awards', maxlength => 64, ); @@ -87,8 +94,7 @@ sub validate_url { } -# The paypal field can contain "decline", a paypal email address, or -# a venmo account name / phone number. We allow all of the above. +# The paypal field can contain "decline", a paypal email address sub validate_paypal { my $self = shift; my ($field) = @_; @@ -97,15 +103,35 @@ sub validate_paypal { return unless $payment; if ( ( $payment eq "decline" ) - || ( Email::Valid->address($payment) ) + || ( Email::Valid->address($payment) ) ) + { + $field->value($payment); + } + else { + $field->add_error( + "This doesn't look like a valid paypal address." + ); + + } +} + +# a venmo account name / phone number +sub validate_venmo { + my $self = shift; + my ($field) = @_; + + my $payment = $field->value; + return unless $payment; + + if ( ( $payment eq "decline" ) || ( $payment =~ /^[-+()\d ]*$/ ) - || ( $payment =~ /^@\w+/ ) ) + || ( $payment =~ /^@?\w+/ ) ) { $field->value($payment); } else { $field->add_error( - "This doesn't look like a valid paypal address, venmo address, or phone number." + "This doesn't look like a valid venmo name or phone number." ); } diff --git a/IFComp/lib/IFComp/Schema/Result/User.pm b/IFComp/lib/IFComp/Schema/Result/User.pm index 0e20c22e..e105151c 100644 --- a/IFComp/lib/IFComp/Schema/Result/User.pm +++ b/IFComp/lib/IFComp/Schema/Result/User.pm @@ -124,6 +124,12 @@ __PACKAGE__->table("user"); is_nullable: 1 size: 64 +=head2 venmo + + data_type: 'char' + is_nullable: 1 + size: 64 + =head2 rising_star data_type: 'integer' @@ -175,6 +181,8 @@ __PACKAGE__->add_columns( { data_type => "char", is_nullable => 1, size => 32 }, "paypal", { data_type => "char", is_nullable => 1, size => 64 }, + "venmo", + { data_type => "char", is_nullable => 1, size => 64 }, "rising_star", { data_type => "integer", is_nullable => 1 }, ); @@ -300,8 +308,8 @@ __PACKAGE__->has_many( #>>> -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-07-02 23:04:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QWBgb307tu4QG/bg7rfGWA +# Created by DBIx::Class::Schema::Loader v0.07053 @ 2025-06-01 20:06:17 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9WoAg24sR0ghQIGGZebiCw __PACKAGE__->add_column( '+password' => { diff --git a/IFComp/root/src/entry/list.tt b/IFComp/root/src/entry/list.tt index 25cb1fce..43ebd687 100644 --- a/IFComp/root/src/entry/list.tt +++ b/IFComp/root/src/entry/list.tt @@ -78,7 +78,11 @@

Register an entry

[% IF current_comp.status == 'accepting_intents' %] [% IF entries.size < 3 %] -

Add a new entry.

+ [% IF c.user.venmo == '' && c.user.paypal == '' %] +

You cannot add entries until you've speicified either a paypal or venmo account for prizes. Please visit your account profile and update it. + [% ELSE %] +

Add a new entry.

+ [% END %] [% ELSE %]

You can't declare any further entries this year, since you've reached the annual limit of three.

[% END %] From 8029398460ee9cebca0b296bd6d452fa4c6edd5d Mon Sep 17 00:00:00 2001 From: Mark Musante Date: Sun, 1 Jun 2025 17:41:54 -0400 Subject: [PATCH 3/5] ubuntu 20.04 is no longer supported - using 24.04 instead --- .github/workflows/Test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 846d6bc2..8a0f8892 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -10,7 +10,7 @@ on: jobs: Test-Linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 container: image: perl:5.30 From 4cf7c846756456270d6e891ba18847fb4e27a129 Mon Sep 17 00:00:00 2001 From: Mark Musante Date: Sun, 1 Jun 2025 18:07:24 -0400 Subject: [PATCH 4/5] tidyall --- IFComp/lib/IFComp/Form/UserFields.pm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/IFComp/lib/IFComp/Form/UserFields.pm b/IFComp/lib/IFComp/Form/UserFields.pm index 2e08807e..a24bb757 100644 --- a/IFComp/lib/IFComp/Form/UserFields.pm +++ b/IFComp/lib/IFComp/Form/UserFields.pm @@ -108,9 +108,7 @@ sub validate_paypal { $field->value($payment); } else { - $field->add_error( - "This doesn't look like a valid paypal address." - ); + $field->add_error("This doesn't look like a valid paypal address."); } } @@ -131,8 +129,7 @@ sub validate_venmo { } else { $field->add_error( - "This doesn't look like a valid venmo name or phone number." - ); + "This doesn't look like a valid venmo name or phone number."); } } From 083d49a04573ca57d82a033075236e5b1e08af1e Mon Sep 17 00:00:00 2001 From: Mark Musante Date: Sun, 1 Jun 2025 18:33:54 -0400 Subject: [PATCH 5/5] update tests to match new code --- IFComp/lib/IFComp/Controller/Entry.pm | 4 +++- IFComp/t/lib/IFCompTestData.pm | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/IFComp/lib/IFComp/Controller/Entry.pm b/IFComp/lib/IFComp/Controller/Entry.pm index 1fcfeb9d..ce9c1300 100644 --- a/IFComp/lib/IFComp/Controller/Entry.pm +++ b/IFComp/lib/IFComp/Controller/Entry.pm @@ -101,7 +101,9 @@ sub create : Chained('root') : PathPart('create') : Args(0) { $c->res->redirect( $c->uri_for_action('/entry/list') ); } - if ( $c->user->paypal eq '' && $c->user->venmo eq '' ) { + if ( ( !defined( $c->user->paypal ) || $c->user->paypal eq '' ) + && ( !defined( $c->user->venmo ) || $c->user->venmo eq '' ) ) + { $c->res->redirect( $c->uri_for_action('/entry/list') ); } diff --git a/IFComp/t/lib/IFCompTestData.pm b/IFComp/t/lib/IFCompTestData.pm index a253e96f..8dce581e 100644 --- a/IFComp/t/lib/IFCompTestData.pm +++ b/IFComp/t/lib/IFCompTestData.pm @@ -31,7 +31,7 @@ sub add_test_data_to_schema { 'password_md5', 'salt_md5', 'email', 'email_is_public', 'url', 'verified', - 'forum_handle', + 'forum_handle', 'venmo', ], [ 1, 'user1', $HASHED_PASSWORD, $SALT, @@ -40,23 +40,23 @@ sub add_test_data_to_schema { 'user1_forum', ], [ 2, 'Alice Author', $HASHED_PASSWORD, - $SALT, 'author@example.com', 1, undef, 1, undef, + $SALT, 'author@example.com', 1, undef, 1, undef, 'aliceworks', ], [ 3, 'Victor Votecounter', $HASHED_PASSWORD, - $SALT, 'votecounter@example.com', 1, undef, 1, undef, + $SALT, 'votecounter@example.com', 1, undef, 1, undef, undef, ], [ 4, 'Connie Curator', $HASHED_PASSWORD, - $SALT, 'curator@example.com', 1, undef, 1, undef, + $SALT, 'curator@example.com', 1, undef, 1, undef, undef, ], [ 5, 'Cheddar Cheez', $HASHED_PASSWORD, - $SALT, 'cheez@example.com', 1, undef, 1, undef, + $SALT, 'cheez@example.com', 1, undef, 1, undef, undef, ], [ 6, 'Patricia Prizemanager', $HASHED_PASSWORD, - $SALT, 'prizes@example.com', 1, undef, 1, undef, + $SALT, 'prizes@example.com', 1, undef, 1, undef, undef, ], ], );