Skip to content

Conversation

@mkloeppe
Copy link
Contributor

@mkloeppe mkloeppe commented Sep 22, 2025

❤️ Thank you for your contribution!

Description

This is the frontend part of this PR.
It changes the help text depending on the configuration and adds error styles if the expiration date is required.
This PR has to be merged AFTER inveniosoftware/invenio-rdm-records#2169

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Frontend

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

@karkraeg
Copy link
Member

sorry for my non-conventional commit message. I will think about it next time!

@karkraeg karkraeg added this to vNext Sep 23, 2025
@karkraeg karkraeg moved this to To test in vNext Sep 23, 2025
@karkraeg karkraeg force-pushed the configure-share-link-expiration-date-required-frontend branch 4 times, most recently from 4621e0e to 096adaa Compare September 30, 2025 06:29
@karkraeg karkraeg requested a review from max-moser October 2, 2025 05:19
Copy link
Contributor

@max-moser max-moser left a comment

Choose a reason for hiding this comment

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

the logic looks good to me, i just have a few minor suggestions about consistency and intentionality 🙂

value='{{ permissions | tojson }}'>
{%- endif %}

<span id="deposit-share-btn-require-link-expiration"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<span id="deposit-share-btn-require-link-expiration"
<input type="hidden" id="deposits-share-btn-require-link-expiration"

i'd keep the indentation consistent with other elements – in my experience, inconsistent indenting makes HTML very hard to read very quickly.

the change from <span> to <input> + ID change (deposit- -> deposits-) is also mostly for consistency with the other config data elements on the deposit form.



{%- block page_body %}
<span id="detail-share-btn-require-link-expiration"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<span id="detail-share-btn-require-link-expiration"
<span id="detail-share-btn-require-link-expiration"

note: in contrast to the deposit form, i couldn't quickly identify a trend on the landing page regarding type and ID of config elements

}
checkIfIsAccessLinksExpirationRequired = () => {
return (
document.getElementById("deposit-share-btn-require-link-expiration")?.dataset
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
document.getElementById("deposit-share-btn-require-link-expiration")?.dataset
document.getElementById("deposits-share-btn-require-link-expiration")?.dataset

render() {
const { results, record, onItemAddedOrDeleted, onPermissionChanged } = this.props;
const { loading, error } = this.state;
const isLinkExpirationDateError = this.checkIfLinkExpirationError(error);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const isLinkExpirationDateError = this.checkIfLinkExpirationError(error);
const hasLinkExpirationDateError = this.checkIfLinkExpirationError(error);


<Table color="green">
<CreateAccessLink
hasError={isLinkExpirationDateError}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
hasError={isLinkExpirationDateError}
hasError={hasLinkExpirationDateError}

};

CreateAccessLink.defaultProps = {
hasError: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

i feel there's a slight discrepancy between the naming and actual use of the property here:
the naming suggests the presence/absence of any generic error, but the use is limited only to the expiration date

i'd prefer an alternative, like the following suggestions:

  • rename the variable to something more narrow like hasExpirationDateError, or
  • change the nature of the variable, e.g. into a list named errors that contains the names of all fields with validation errors... or a dictionary of the shape {fieldName: errorMessage, ...}

the second option is a bit more flexible but probably overkill, the first one is simpler but a bit more limited.
note that these two are just the first ideas that came to my mind, i'm fine with other alternatives as long as they make the intentionality a bit clearer!

Copy link
Contributor

@max-moser max-moser left a comment

Choose a reason for hiding this comment

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

the logic looks good to me, i just have a few minor suggestions about consistency and intentionality 🙂

@mkloeppe mkloeppe force-pushed the configure-share-link-expiration-date-required-frontend branch 2 times, most recently from 096adaa to ab0e4dc Compare October 13, 2025 12:08
@max-moser
Copy link
Contributor

I just remembered that there is another spot that needs to know about required expiration dates for secret links:
The "guest access request" (which generates secret links & sends them to the guest's email address), i.e. AccessRequestTimelineEdit.js & co

@mkloeppe mkloeppe force-pushed the configure-share-link-expiration-date-required-frontend branch from ab0e4dc to 4ab69ec Compare October 14, 2025 09:49
@mkloeppe mkloeppe closed this Oct 14, 2025
@mkloeppe mkloeppe force-pushed the configure-share-link-expiration-date-required-frontend branch from 4ab69ec to 2186821 Compare October 14, 2025 10:37
@github-project-automation github-project-automation bot moved this from To test to To release 🤖 in vNext Oct 14, 2025
@mkloeppe mkloeppe reopened this Oct 14, 2025
@mkloeppe
Copy link
Contributor Author

So, to get the config variable to the <AccessRequestTab> I lifted it to the parent component (<ShareModal>). When the config variable is true in <AccessRequestExpirationSelect> the "never expires" option is being removed. I additionally adjusted all the feedback from before.

@mkloeppe mkloeppe force-pushed the configure-share-link-expiration-date-required-frontend branch 2 times, most recently from 264c363 to bb007ea Compare October 22, 2025 14:59
Copy link
Contributor

@max-moser max-moser left a comment

Choose a reason for hiding this comment

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

thanks a lot for the update, and sorry for the long wait!
from my perspective, just one more comment about an else if – other than that, I'm setting up a new my-site to quickly sanity check, and will get back after

Copy link
Contributor

@max-moser max-moser left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for all the work!

Comment on lines 81 to 82
}
else if (settings["secret_link_expiration"] === 0 && isAccessLinksExpirationRequired) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
else if (settings["secret_link_expiration"] === 0 && isAccessLinksExpirationRequired) {
} else if (settings["secret_link_expiration"] === 0 && isAccessLinksExpirationRequired) {

looks like the linter wants it to be on the same line

@mkloeppe mkloeppe force-pushed the configure-share-link-expiration-date-required-frontend branch from 2baad3e to cabae40 Compare October 30, 2025 09:03
* the new configuration variable RDM_RECORDS_REQUIRE_SECRET_LINKS_EXPIRATION adds the option to make the expiration date required
* added error messages improve the user experience.
@mkloeppe mkloeppe force-pushed the configure-share-link-expiration-date-required-frontend branch from cabae40 to df90a74 Compare October 30, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To release 🤖

Development

Successfully merging this pull request may close these issues.

4 participants