From 76ad744936652d7e95e0a8fdd58eed6e7e8f7738 Mon Sep 17 00:00:00 2001 From: Jonathan Zernik Date: Sun, 5 Sep 2021 12:30:58 -0700 Subject: [PATCH] Updrage squeaklib to 0.7.1 (#1194) * Updrage squeaklib to 0.7.1 * Add case to handle secret key msg in peer msg handler * Add fields for custom price and use custom price to profile table * Got itest working with new profile fields * Use default values for profile struct constructor * Fix db migration to use use profile columns * Got itest passing for set use custom price * Show custom price or default price in profile page * Change wording of selling with price in profile page * Got set use custom price toggle working in configure profile dialog --- .../ConfigureProfileDialog.js | 17 ++++++ .../SqueakProfileDetailItem.js | 17 ++++++ frontend/src/squeakclient/requests.js | 10 ++++ itests/tests/test_squeak_node.py | 26 +++++++++ proto/squeak_admin.proto | 25 +++++++- requirements-itest.txt | 2 +- requirements.txt | 2 +- setup.py | 2 +- squeaknode/admin/messages.py | 2 + .../admin/squeak_admin_server_handler.py | 13 +++++ .../admin/squeak_admin_server_servicer.py | 3 + squeaknode/core/squeak_profile.py | 10 ++-- ..._add_custom_price_and_use_custom_price_.py | 58 +++++++++++++++++++ squeaknode/db/models.py | 2 + squeaknode/db/squeak_db.py | 12 ++++ squeaknode/network/peer_message_handler.py | 8 +++ squeaknode/node/squeak_controller.py | 14 ++--- tests/core/test_squeak_core.py | 2 + 18 files changed, 206 insertions(+), 19 deletions(-) create mode 100644 squeaknode/db/alembic/versions/af0082f29c93_add_custom_price_and_use_custom_price_.py diff --git a/frontend/src/components/ConfigureProfileDialog/ConfigureProfileDialog.js b/frontend/src/components/ConfigureProfileDialog/ConfigureProfileDialog.js index 7b1d3abd..8bfe8a0d 100644 --- a/frontend/src/components/ConfigureProfileDialog/ConfigureProfileDialog.js +++ b/frontend/src/components/ConfigureProfileDialog/ConfigureProfileDialog.js @@ -17,6 +17,7 @@ import useStyles from './styles'; import { setSqueakProfileFollowingRequest, + setSqueakProfileUseCustomPriceRequest, } from '../../squeakclient/requests'; export default function ConfigureProfileDialog({ @@ -34,12 +35,24 @@ export default function ConfigureProfileDialog({ }); }; + const setUseCustomPrice = (id, useCustomPrice) => { + setSqueakProfileUseCustomPriceRequest(id, useCustomPrice, () => { + reloadProfile(); + }); + }; + const handleSettingsFollowingChange = (event) => { console.log(`Following changed for profile id: ${squeakProfile.getProfileId()}`); console.log(`Following changed to: ${event.target.checked}`); setFollowing(squeakProfile.getProfileId(), event.target.checked); }; + const handleSettingsUseCustomPriceChange = (event) => { + console.log(`UseCustomPrice changed for profile id: ${squeakProfile.getProfileId()}`); + console.log(`UseCustomPrice changed to: ${event.target.checked}`); + setUseCustomPrice(squeakProfile.getProfileId(), event.target.checked); + }; + function MakeCancelButton() { return (