inveniosoftware / react-invenio-deposit

React application for Invenio deposit forms.
https://react-invenio-deposit.readthedocs.io
MIT License
3 stars 45 forks source link

non-standard person scheme label broken, shows only a colon ":" #648

Open phette23 opened 6 days ago

phette23 commented 6 days ago

Package version (if known): latest (2.6.1 / master)

Describe the bug

If you are using a non-standard (not ORCID, ROR, or GND) identifier scheme in your names vocabulary, the identifier label does not display properly due to a typo in CreatibutorsModal.js. Instead, an orphaned colon prefixes the identifier (see screenshot).

I'm using a url identifier scheme and the identifier renders as (: https://...) when it should be (URL: https://....) e.g. identifier scheme label, then colon, then identifier. This is because line 211 of CreatibutorsModal.js contains a typo:

{identifier.scehme}: {identifier.identifier}

Steps to Reproduce

There are several steps to use a non-standard identifier scheme for names but I'll try to list them all.

  1. Edit invenio.cfg and add a scheme to RDM_RECORDS_PERSONORG_SCHEMES and VOCABULARIES_NAMES_SCHEMES
# invenio.cfg
from idutils import is_url
from invenio_rdm_records.config import RDM_RECORDS_PERSONORG_SCHEMES
from invenio_vocabularies.config import VOCABULARIES_NAMES_SCHEMES

url_scheme = {
    "label": _("URL"),
    "validator": is_url,
    "datacite": "URL",
}

RDM_RECORDS_PERSONORG_SCHEMES["url"] = url_scheme
VOCABULARIES_NAMES_SCHEMES["url"] = url_scheme
  1. Create a names.yaml fixture with at least one name that uses this scheme
# names.yaml
- affiliations:
  - id: 01mmcf932
  family_name: Phetteplace
  given_name: Eric
  id: https://portal.cca.edu/people/ephetteplace
  identifiers:
  - identifier: https://portal.cca.edu/people/ephetteplace
    scheme: url
  1. Reference the names vocabulary from app_data/vocabularies.yaml
# vocabularies.yaml
names:
  pid-type: names
  data-file: vocabularies/names.yaml
  1. Create an InvenioRDM instance using the fixture
invenio-cli install
invenio-cli services setup --no-demo-data
invenio-cli run
  1. Sign in and visit the upload form
  2. Type the name e.g. "phetteplace"

Expected behavior

Autocompleted name renders as "Phetteplace, Eric (URL: https://portal.cca.edu/people/ephetteplace)". Instead, the "URL" label is absent.

Screenshots (if applicable)

Screenshot 2024-07-03 at 12 09 48

Additional context

PR incoming. FIxing the typo should be enough. Change shouldn't affect much else.

phette23 commented 6 days ago

Reviewing the code, it wouldbe preferable if the scheme's label could be used here, but identifier.scheme is just a string referencing the scheme, identifier.scheme.label doesn't work.