Show registration modal only when unregistered - #1600
Conversation
|
Use Run test server using develop.opencast.org as backend: Specify a different backend like stable.opencast.org: It may take a few seconds for the interface to spin up. |
|
This pull request is deployed at test.admin-interface.opencast.org/1600/2026-05-11_21-10-31/ . |
…in suboptimal cases
75e3a11 to
298d1a8
Compare
|
Now that the GHA issues are done, I made a final change and I think this is ready for re-review @Arnei |
| onClick={() => showAdoptersRegistrationModal()} | ||
| > | ||
| <span className="wide-text">Registration</span> | ||
| <span className="multi-value multi-value-yellow">Unregistered</span> |
There was a problem hiding this comment.
multi-value-yellow does not seem to exist (maybe I removed it in my cleaning frenzy?).
| <ButtonLikeAnchor | ||
| onClick={() => showAdoptersRegistrationModal()} | ||
| > | ||
| <span className="wide-text">Registration</span> |
There was a problem hiding this comment.
The text in the little colored bubbles is now translated. Shouldn't "Registration" be translated too?
…represents whether the registration service can talk to the main registration server.
… the modal will open even if the user has already registered.
340024a to
3247ac4
Compare
|
Ok, so I think this is more or less done... I noticed that the registration modal itself was using a script in utils, so I removed it and moved its functionality into the selector. Hopefully I didn't miss anything obvious. This now requires opencast/opencast#7786 as well. |
| // Refetch the registration data since otherwise what we just submitted does not show up if the user immediately returns to the modal | ||
| dispatch(fetchRegistration()); |
There was a problem hiding this comment.
This seems like bad practice to me. We need to fetch registration data on modal open anyway, right? So if submitting closes the modal, and the user then reopens the modal, the data should be fetched anyway?
Unless we allow the user to submit without closing the modal, and the backend modifies the data we want to display?
There was a problem hiding this comment.
I think this is an artifact of the registrationLoaded boolean, since it does not refetch without clearing that.
That fflag is there because the endpoint returns a bare null if there is no registration data, which makes differentiating between not-loaded and loaded-but-blank states hard. I hadn't started the backend pr changed when I added the loaded flags, so maybe I should change that in the backend pr...
| dateModified: "", | ||
| dateCreated: "", | ||
| registered: false, | ||
| statistics: null, |
There was a problem hiding this comment.
Why are we adding statistics to formik? I don't think we want to let the user change them? And it makes handling formik values more annoying, because now we have to do stuff like filter the statistics variable away (e.g. below in the summary)
There was a problem hiding this comment.
Will swap this back!
| useEffect(() => { | ||
| if (!registrationLoaded) { | ||
| dispatch(fetchRegistration()); | ||
| } | ||
| if (!statisticsLoaded) { | ||
| dispatch(fetchStatistics()); | ||
| } | ||
| }, [registrationLoaded, statisticsLoaded, dispatch]); |
There was a problem hiding this comment.
Not quite sure on the logic here. When registration has loaded but statistics has not yet loaded, we want to fetch statistics again?
If you just want to fetch things once on component mount, you'd do
useEffect(() => {
dispatch(fetchRegistration());
dispatch(fetchStatistics());
}, [dispatch]);
There was a problem hiding this comment.
This is a bad rebase, I'll fix it. I was having issues with Formik and thought this was related.
|
|
||
|
|
||
| // post request for adopter information | ||
| export const postAdopterRegistration = async ( |
There was a problem hiding this comment.
This block is one indentation level off
This PR only shows the registraiton modal when the adopter has not already registered.
This PR contains a few extra bits that haven't been turned on yet - notably the warning bell stuff for when the core can't reach the registration server.This PR now uses the bell if the user is not registered. Notably:


If you haven't registered at all:
If you have registered, but haven't agreed to the latest ToU:
Clicking on either of these notices opens the registration modal.
Requires opencast/opencast#7786 on the backend.
TODOs:
Make the new strings into translatable strings rather than hardcoding them.In the case of an out of date ToU, uncheck the agreed-to-ToU checkbox when presenting the registration modal, and highlight what's wrong.Fixed #1516