Skip to content

Show registration modal only when unregistered#1600

Open
gregorydlogan wants to merge 1 commit intoopencast:r/19.xfrom
gregorydlogan:t/registration-modal
Open

Show registration modal only when unregistered#1600
gregorydlogan wants to merge 1 commit intoopencast:r/19.xfrom
gregorydlogan:t/registration-modal

Conversation

@gregorydlogan
Copy link
Copy Markdown
Member

@gregorydlogan gregorydlogan commented May 4, 2026

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.

Fixed #1516

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

github-actions Bot commented May 4, 2026

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
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

This pull request is deployed at test.admin-interface.opencast.org/1600/2026-05-04_05-29-07/ .
It might take a few minutes for it to become available.

Comment thread src/components/Header.tsx
Comment on lines +73 to +81
// dispatch(fetchLatestToU());
// dispatch(fetchIsUpToDate());

const _getLatestToU = async () => {
await dispatch(fetchLatestToU());
};
const _getIsUpToDate = async () => {
await dispatch(fetchIsUpToDate());
};
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 is going unused and should be removed.

Comment thread src/components/Header.tsx
Comment on lines +70 to +72
if (registration == null) {
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 will dispatch a redux action (and thus a fetch request) every time the component rerenders and registration is still null. This could potentially cause multiple fetch requests. To avoid this, we usually use a useEffect that only runs once on component mount for fetch requests. (see the useEffect in e.g. SeriesDetails.tsx).

If you need to monitor the state of the action, you would usually add a variable to the redux state that tracks the action state (LOADING, SUCCEEDED, FAILED what have you). Then track the action state in your component via a selector and use a useEffect to respond properly.

And if you don't actually need all that redux boilerplate, you could also do the fetch requesting and state tracking here with useEffect and useState.

import { WritableDraft } from "immer";
import { createAppAsyncThunk } from "../createAsyncThunkWithTypes";

export type Registration = {
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.

Since all this PR really does is checking if ´/admin-ng/adopter/registration` returns null or not, creating a whole redux state is complete overkill. If you'll need this for some other PR, would it not be better to add it then?

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