feat(dashboard): add a guest registration tile to the guest quick actions - #451
Merged
Merged
Conversation
…ions The Buzz Event doctype has carried `allow_guest_booking` and `guest_verification_method` for a while, but nothing in the dashboard read or wrote them — an organiser had to open Desk to let strangers register themselves. The Registration toggle and the new Guest registration toggle now sit in one container, so the tile markup is lifted out of QuickActionsRail into QuickActionTile and the rail takes a slot for extra tiles. EventTalkActions is unchanged; its slot is empty. The dialog writes through frappe.client.set_value, which the dashboard already uses for events and which the team permission hooks guard, so there is no new write endpoint. Verification methods only work if the site is set up for them, and the failure modes were bad: Email OTP threw on save, and Phone OTP saved fine but left the guest waiting for a code that was never sent. get_verification_methods reports what the site can actually deliver — EmailAccount.find_default_outgoing() for email (what frappe.sendmail itself resolves through, so site_config mail counts), and for phone both an SMS gateway and a Guest role allowed to use it, because send_sms permission-checks its caller. The dialog skeletons the options until that answer lands, disables what the site cannot deliver, and says why in an Alert. A selection the site cannot deliver is dropped to None rather than saved. The controller's own email check now calls the same helper, so it no longer misses mail configured in site_config.json. Known gaps, left for a separate change: buzz/api/booking/guests.py calls the whitelisted send_sms, which raises PermissionError for the Guest role, and validate_guest_verification_config still has no Phone OTP branch.
Contributor
|
✅ UI Demo Check — a screenshot or demo is attached. |
Contributor
The dialog disabled the options it could not deliver, but the client is not a trust boundary: frappe.client.set_value is callable directly, and the dialog's own availability answer is a request behind the options it draws. On a reopen useCall keeps the previous response until the new one lands, so a gateway removed since the last open left Phone OTP selectable for that window. validate_guest_verification_config now guards Phone OTP the way it already guarded Email OTP, through the same phone_otp_available() the dialog reads, so the two agree on what "configured" means. Save is disabled until that answer arrives, so the options on screen are always the ones the save is written against. The email branch keeps its behaviour; both branches now share one import and read as a pair.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Buzz Eventalready hadallow_guest_bookingandguest_verification_method. Nothing in the dashboard read or wrote them, so an organiser had to open Desk. This adds a Guest registration tile beside the Registration toggle, with a settings dialog behind it.QuickActionsRailinto a newQuickActionTile. The rail takes a slot for extra tiles.EventTalkActionsis unchanged.frappe.client.set_value. The team permission hooks already guardBuzz Event, so there is no new write endpoint.buzz.api.events.get_verification_methodsreports what the site can deliver:EmailAccount.find_default_outgoing(), the same resolverfrappe.sendmailuses. Mail set insite_config.jsonnow counts. The controller's own check calls this helper too, so it no longer rejects sites it should accept.allowed_roles, becausesend_smspermission-checks its caller.Alert.None, and Save stays disabled until availability resolves.validate_guest_verification_configrefuses an undeliverable method through the same helper, so the server holds the line however the field is set.Demo
demo-buzz-guestregistration.mp4
Testing
bench --site buzz.localhost run-tests --module buzz.api.events.test_events— 88 pass. New:TestVerificationMethods(gateway required, Guest role required, email follows the outgoing account) and a case assertingget_event_guestscarries the two new fields.npx vue-tsc --noEmitclean onsrc/.bench --site buzz.localhost run-tests --module buzz.events.doctype.buzz_event.test_buzz_event— 4 new cases inTestGuestVerificationConfig. The module has 24 pre-existing errors ondevelop, unchanged by this branch.pre-commitclean on the changed files.