#2788 - Expiring Magic Links#2894
Conversation
kodinkat
commented
Feb 19, 2026
- fixes: Expiring Magic Links #2788
- Added functionality to manage expiration settings for magic URLs, including enabling/disabling expiration controls based on user input.
- Implemented logic to clear expiration data when links are reset, ensuring accurate link management.
- Introduced initialization for expiration controls on page load to improve user experience.
- Refactored app link reset logic to accommodate new expiration handling.
…adability
- Cleaned up unnecessary whitespace and adjusted formatting for consistency throughout the magic URL setup file.
- Enhanced clarity in the code structure, ensuring better alignment of comments with the corresponding code sections.
|
@corsacca @cairocoder01 review ready.... |
…ools-theme into 2788-expiring-magic-links
- Removed outdated expiration control functions and initialization code to streamline the handling of expiration settings.
- Updated validation logic to require both expiration amount and time unit, enhancing user input requirements.
- Improved expiration display updates and data attribute management for better clarity and functionality.
- Ensured consistent handling of expiration data when links are reset, enhancing overall user experience.
PR Review: #2894 – Expiring Magic LinksNice feature addition! The implementation structure is solid and the Bugs1. Unused variable
const oldHash = url ? url.replace(appAccordion.dataset.urlBase, '') : '';Either use it or remove it. 2. "Reset link (also clears expiration)" label always shown <span class="app-link-label"><?php esc_html_e( 'Reset link (also clears expiration)', 'disciple_tools' ) ?></span>This is rendered unconditionally, even when <?php if ( class_exists( 'Disciple_Tools_Bulk_Magic_Link_Sender_API' ) ): ?>
<span class="app-link-label"><?php esc_html_e( 'Reset link (also clears expiration)', 'disciple_tools' ) ?></span>
<?php else: ?>
<span class="app-link-label"><?php esc_html_e( 'Reset link', 'disciple_tools' ) ?></span>
<?php endif; ?>Performance3.
Code Quality4. Fragile REST URL construction const endpointUrl = window.wpApiShare.site_url + '/wp-json/disciple_tools_magic_links/v1/...';This hardcodes const endpointUrl = window.wpApiShare.root + 'disciple_tools_magic_links/v1/clear_link_expiration';This applies to both AJAX calls in the new code. 5. Inconsistent error handling UX
6. Inline styles should move to SCSS There are ~8 instances of inline 7. PHP:
$link_obj_id = null;
if ( class_exists( 'Disciple_Tools_Bulk_Magic_Link_Sender_API' ) ) {
// ...
}8. Duplicate short date computation in PHP The short date format is computed twice: once for 9. Indentation inconsistency in badge creation block In Minor NoteThe |
|
@cairocoder01 see latest updates..... Also, good spot re "Never expires"; which, on further reflection, is actually redundant; whilst the "Reset Link" functionality is present - Therefore, I've decided to remove it.
|
|
Looks good to me. I wonder about the verbiage of the Reset label. The use of "also" for some reason feels somewhat unprofessional or something. Should it be something like "Reset link (clears expiration)" or "Reset link (and clear expiration"? And should that verbiage only show if there is a current expiration (I haven't tested myself to know if this is already the case)? So if there's no expiration set, it just says "Reset link." If there is an expiration date set, it shows the extra info about clearing expiration. I'm unsure the best route and these are just thoughts. Regardless of that, I'm happy with this however that verbiage ends up. So on to @corsacca to review. |
Hey @cairocoder01 yep, I'll also tweak verbiage and have its display made conditional based on any existing expiration dates. :) |
- Updated reset link label to reflect its action of clearing expiration, improving user clarity.
- Added logic to reset label text when expiration is cleared, ensuring consistent user feedback.
- Refactored badge display logic for better handling of expiration states, enhancing overall user experience.
Follow-up ReviewThanks for the updates @kodinkat — the conditional label text for "Reset link (clears expiration)" is now handled correctly based on Still Outstanding1. Unused variable This variable is computed but never read anywhere: const oldHash = url ? url.replace(appAccordion.dataset.urlBase, '') : '';Remove it to keep the code clean. 2. Hardcoded REST URL path Both AJAX calls still construct the endpoint URL by concatenating const endpointUrl = window.wpApiShare.site_url + '/wp-json/disciple_tools_magic_links/v1/clear_link_expiration';If a site has customized the REST API base path via const endpointUrl = window.wpApiShare.root + 'disciple_tools_magic_links/v1/clear_link_expiration';This applies to both 3.
$link_obj_id = null;
if ( class_exists( 'Disciple_Tools_Bulk_Magic_Link_Sender_API' ) ) {
// ...assign $link_obj_id inside...
}Nice to Have (non-blocking)
The feature itself looks solid and the UX improvements are good. The REST URL issue (#2) is the only one I'd consider a functional correctness concern worth fixing before merge. |
- Changed endpoint URLs to use the root property instead of site_url, ensuring uniformity in API calls.
- This adjustment enhances the reliability of the API interactions within the magic URL setup functionality.
PR Review: #2788 - Expiring Magic LinksOverall this is a well-structured feature addition. The conditional Bug: Dead code –
|
…ools-theme into 2788-expiring-magic-links
- Added logic to check if the active magic link plugin version supports expiration helpers, improving compatibility and functionality.
- Updated conditions for displaying expiration-related UI elements based on the new support check, enhancing user experience and clarity.
PR Review: #2788 - Expiring Magic LinksGood feature addition! The approach of feature-detecting the plugin API before enabling expiration UI is solid. Here are my findings: Bug:
|
…ion formatting
- Cached link objects to improve performance and reduce redundant API calls.
- Simplified expiration date formatting logic for better readability and maintainability.
- Removed unused variable for link object ID, streamlining the code.
- Enhanced data attributes for expiration display, ensuring accurate and user-friendly output.
PR Review: Expiring Magic Links (#2788)Thanks for the implementation! The feature concept is solid and the plugin capability check is a nice touch. A few issues worth addressing: Bug: Incorrect
|
|
@kodinkat, please display the date in the user's time (pass epoch and let js in the bowser display it). |



