Skip to content

Show registration modal only when unregistered - #1600

Open
gregorydlogan wants to merge 19 commits into
opencast:r/19.xfrom
gregorydlogan:t/registration-modal
Open

Show registration modal only when unregistered#1600
gregorydlogan wants to merge 19 commits into
opencast:r/19.xfrom
gregorydlogan:t/registration-modal

Conversation

@gregorydlogan

@gregorydlogan gregorydlogan commented May 4, 2026

Copy link
Copy Markdown
Member

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:
Pasted image
If you have registered, but haven't agreed to the latest ToU:
Pasted image (2)

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.
  • In the case of an out of date ToU, launch the registration modal to the input pane, not the general info pane.

Fixed #1516

@gregorydlogan gregorydlogan added the type:bug Something isn't working label May 4, 2026
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Use docker or podman to test this pull request locally.

Run test server using develop.opencast.org as backend:

podman run --rm -it -p 127.0.0.1:3000:3000 ghcr.io/opencast/admin-interface:pr-1600

Specify a different backend like stable.opencast.org:

podman run --rm -it -p 127.0.0.1:3000:3000 -e PROXY_TARGET=https://stable.opencast.org ghcr.io/opencast/admin-interface:pr-1600

It may take a few seconds for the interface to spin up.
It will then be available at http://127.0.0.1:3000.
For more options you can pass on to the proxy, take a look at the README.md.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

This pull request is deployed at test.admin-interface.opencast.org/1600/2026-05-11_21-10-31/ .
It might take a few minutes for it to become available.

Comment thread src/components/Header.tsx Outdated
Comment thread src/components/Header.tsx Outdated
Comment thread src/slices/registrationSlice.ts
@gregorydlogan
gregorydlogan force-pushed the t/registration-modal branch from 75e3a11 to 298d1a8 Compare June 10, 2026 22:15
@gregorydlogan

Copy link
Copy Markdown
Member Author

Now that the GHA issues are done, I made a final change and I think this is ready for re-review @Arnei

Comment thread src/styles/components/_header.scss Outdated
Comment thread src/components/Header.tsx Outdated
Comment thread src/components/Header.tsx Outdated
Comment thread src/components/Header.tsx Outdated
onClick={() => showAdoptersRegistrationModal()}
>
<span className="wide-text">Registration</span>
<span className="multi-value multi-value-yellow">Unregistered</span>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multi-value-yellow does not seem to exist (maybe I removed it in my cleaning frenzy?).

Comment thread src/components/Header.tsx Outdated
<ButtonLikeAnchor
onClick={() => showAdoptersRegistrationModal()}
>
<span className="wide-text">Registration</span>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untranslated strings.

@Arnei Arnei Jul 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text in the little colored bubbles is now translated. Shouldn't "Registration" be translated too?

Comment thread src/slices/registrationSlice.ts
Comment thread src/slices/registrationSlice.ts Outdated
Comment thread src/slices/registrationSlice.ts Outdated
Comment thread src/slices/registrationSlice.ts Outdated
Comment thread src/slices/registrationSlice.ts Outdated
@gregorydlogan
gregorydlogan force-pushed the t/registration-modal branch from 340024a to 3247ac4 Compare July 15, 2026 23:02
@gregorydlogan

Copy link
Copy Markdown
Member Author

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.

Comment on lines +119 to +120
// Refetch the registration data since otherwise what we just submitted does not show up if the user immediately returns to the modal
dispatch(fetchRegistration());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will swap this back!

Comment on lines +91 to +98
useEffect(() => {
if (!registrationLoaded) {
dispatch(fetchRegistration());
}
if (!statisticsLoaded) {
dispatch(fetchStatistics());
}
}, [registrationLoaded, statisticsLoaded, dispatch]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (

@Arnei Arnei Jul 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is one indentation level off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants