Skip to content

Restore Next to being the useful primary development branch#226

Open
jkrrv wants to merge 139 commits intoblocksfrom
next
Open

Restore Next to being the useful primary development branch#226
jkrrv wants to merge 139 commits intoblocksfrom
next

Conversation

@jkrrv
Copy link
Copy Markdown
Member

@jkrrv jkrrv commented Apr 8, 2025

No description provided.

jkrrv added 30 commits February 8, 2024 21:22
…situations (closes #179).  Also, improve error handling for script updates.
Copilot AI review requested due to automatic review settings April 9, 2026 02:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR bumps the plugin to 0.0.97 and introduces a set of changes aimed at making the “Next” branch a viable primary development line by adding Gutenberg block support, expanding/adjusting API & lookup behavior, and refactoring UI rendering for notable attributes and action buttons.

Changes:

  • Adds a BlocksController plus new People List and Involvement List Gutenberg blocks and supporting build pipeline updates.
  • Introduces/adjusts lookup + admin endpoints, caching behavior, and settings initialization/translation timing.
  • Refactors notable-attributes rendering and action button interfaces across content types; multiple template/CSS/JS updates.

Reviewed changes

Copilot reviewed 71 out of 83 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
wpml-config.xml WPML config additions (types/fields/shortcodes).
touchpoint-wp.php Version bump + new requires (Lookup/Blocks/Stats/etc).
src/TouchPoint-WP/Utilities/Translation.php Adds helper to set WPML language by campus.
src/TouchPoint-WP/Utilities/StringableArray.php Refactors join behavior; adds helpers.
src/TouchPoint-WP/Utilities/NotableAttributes.php New string-join wrapper for meta badges.
src/TouchPoint-WP/Utilities/ImageConversions.php Adds IDE inspection suppression.
src/TouchPoint-WP/Utilities/DateTimeExtended.php Adds i18n-friendly formatting helper.
src/TouchPoint-WP/Utilities/DateFormats.php Fixes signature typo (trailing comma).
src/TouchPoint-WP/Utilities/Cleanup.php Adjusts cache TTL semantics to seconds.
src/TouchPoint-WP/Utilities.php Misc fixes: time parsing, GUID seeding, slug constant.
src/TouchPoint-WP/TouchPointWP.php Core: version bump, blocks, lookup, caching tweaks, plugin meta.
src/TouchPoint-WP/TouchPointWP_Exception.php Adds dev detail plumbing + trace escaping (but currently broken).
src/TouchPoint-WP/TouchPointWP_AdminAPI.php Expands admin endpoints; adds devDetail console logging.
src/TouchPoint-WP/Taxonomies.php Uses imported divisions helper; restricts taxonomy term editing.
src/TouchPoint-WP/StatusWidget.php Improves dashboard widget output/i18n.
src/TouchPoint-WP/Stats.php Adds involvement counts; modifies telemetry submission flow.
src/TouchPoint-WP/Settings.php Refactors settings init to defer translations until ready.
src/TouchPoint-WP/Report.php Fixes global $post handling during shortcode indexing.
src/TouchPoint-WP/PostTypeCapable.php Introduces actionButtons interface; notableAttributes now returns NotableAttributes.
src/TouchPoint-WP/Person.php Adds people list filters + AJAX endpoint + gender meta + action buttons changes.
src/TouchPoint-WP/Partner.php REST visibility change + notable attributes/action buttons updates.
src/TouchPoint-WP/MeetingArray.php Clarifies involvement backing type; imports stdClass.
src/TouchPoint-WP/Meeting.php Consolidates interfaces; notableAttributes changes; RSVP button element change.
src/TouchPoint-WP/Lookup.php New lookup API + transient caching.
src/TouchPoint-WP/Location.php Fixes nullable parameter typing.
src/TouchPoint-WP/Interfaces/updatesViaCron.php Adds explicit void return types.
src/TouchPoint-WP/Interfaces/involvementMeetingCommon.php New shared interface for meeting/involvement.
src/TouchPoint-WP/Interfaces/apiMeeting.php Adds involvementId property annotation.
src/TouchPoint-WP/Interfaces/actionButtons.php New action buttons interface.
src/TouchPoint-WP/EventsCalendar.php iOS deeplink handling adjustments.
src/TouchPoint-WP/CalendarGrid.php Fixes nullable month/year typing.
src/TouchPoint-WP/Blocks/BlocksController.php New block registration + CSS endpoint (manifest-based).
src/TouchPoint-WP/Auth.php Adds styling/icon + changes admin redirect checks + endpoint path fix.
src/TouchPoint-WP/Api.php Adds basic-auth GET; changes PAT GET signature; error-handling updates.
src/templates/parts/person-list.php Uses injected list class + fallback empty content.
src/templates/parts/person-list-item.php Computes actions once; adds CSS state class.
src/templates/parts/partner-list-item.php Uses NotableAttributes stringification.
src/templates/parts/meeting-list-item.php Uses NotableAttributes + adds child queries (involvements/meetings).
src/templates/parts/involvement-nearby-list.php Uses wp.i18n.sprintf in KO binding.
src/templates/parts/involvement-list-item.php Uses NotableAttributes stringification.
src/templates/partner-single.php Adds enqueuePartialsStyle context.
src/templates/partner-archive.php Adds enqueuePartialsStyle context.
src/templates/meeting-archive.php Adds enqueuePartialsStyle context.
src/templates/involvement-single.php Adds past/cancel alert + NotableAttributes join + style context.
src/templates/involvement-archive.php Adds enqueuePartialsStyle context.
src/templates/admin/invKoForm.php Uses short-cache meta fetch; tweaks copy; fixes default grouping value type.
src/python/WebApi.py Backend changes: meeting status, meeting series, memtype filters, version bump.
src/js-partials/partner-map-inline.js Switches to tpvm-scoped class access.
src/js-partials/involvement-nearby-inline.js Switches to tpvm-scoped class access.
src/js-partials/involvement-map-inline.js Switches to tpvm-scoped class access.
README.md Removes FontAwesome mention; formatting tweak.
package.json Version bump + adds WP block build deps/scripts.
composer.json Version bump.
buildPipeline/versionUpdate.js New script to sync versions across files.
build.sh Updates build flow; adds block build + timing output.
blocks/people-list/index.js New Gutenberg People List block with live preview.
blocks/people-list/block.json Block metadata for People List.
blocks/inv-list/index.js New Gutenberg Involvement List block with live preview.
blocks/inv-list/block.json Block metadata for Involvement List.
blocks/common.js Shared unique ID generator for blocks.
assets/template/partials-template-style.css Person-list layout tweaks + marker animation + hover logic.
assets/template/calendar-grid-style.css Grid styling improvements + responsive tweaks.
assets/template/block-preview-style.css New editor preview overlay styling.
assets/template/actions-style.css Adds mask-based icon system for actions.
assets/js/partner-defer.js Refactors to tpvm namespace + marker/icon changes.
assets/js/meeting-defer.js Refactors to tpvm namespace + wp.i18n helpers.
assets/icons/touchpoint.svg New icon asset.
assets/icons/map-marker.svg New icon asset.
assets/icons/lock.svg New icon asset.
assets/branding/icon-curcolor.svg Removes old inline SVG asset.
.idea/watcherTasks.xml IDE watcher addition (project config).
.idea/phpunit.xml IDE PHPUnit config (project config).
.idea/php.xml IDE PHP include paths (project config).
.idea/misc.xml IDE SDK metadata update (project config).
.idea/libraries/Generated_files.xml IDE generated files list update (project config).
.gitignore Ignores additional IDE/copilot files; removes package-lock ignore.
Files not reviewed (5)
  • .idea/libraries/Generated_files.xml: Language not supported
  • .idea/misc.xml: Language not supported
  • .idea/php.xml: Language not supported
  • .idea/phpunit.xml: Language not supported
  • .idea/watcherTasks.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 37 to 41
$message .= "<br />" . $this->getFile() . " @ " . $this->getLine() . "<br />";
$message .= str_replace("\n", "<br />", $this->getTraceAsString());
$message .= str_replace("\n", "<br />", esc_html($this->getTraceAsString()));
}
self::showAdminError($message);
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

$devDetail is accepted by the constructor but never forwarded to the admin notice. As a result, any developer detail intended for TouchPointWP_AdminAPI::showError() is dropped and showAdminError() later references an undefined $devDetail variable. Pass $devDetail into showAdminError() and add a parameter to showAdminError() so it can forward it safely.

Copilot uses AI. Check for mistakes.
Comment on lines 56 to 61
if ( ! TOUCHPOINT_COMPOSER_ENABLED) {
require_once 'TouchPointWP_AdminAPI.php';
}

TouchPointWP_AdminAPI::showError($message);
TouchPointWP_AdminAPI::showError($message, $devDetail);
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

$devDetail is not defined in this scope, so this call will raise a PHP notice and always pass null. showAdminError() should accept $devDetail as an argument (default null) and the constructor should pass it through.

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +59
$manifest_data = require $blocksRoot . '/blocks-manifest.php';
foreach ($manifest_data as $block_type) {
register_block_type($block_type['name'], $block_type);
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

BlocksController::init() unconditionally requires blocks-manifest.php, but the repo currently has no blocks/blocks-manifest.php (only block source folders). This will fatal when the plugin is run from source (non-built) or if the manifest is missing. Add a file_exists guard with a fallback to registering blocks from block.json files, or ensure the manifest is committed/generated in-place.

Copilot uses AI. Check for mistakes.
Comment on lines 222 to +226
'public' => true,
'hierarchical' => false,
'show_ui' => false,
'show_in_nav_menus' => true,
'show_in_rest' => false, // For the benefit of secure partners
'show_in_rest' => true, // For the benefit of secure partners
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This post type is public and is explicitly used for "secure partners"; switching show_in_rest to true makes partner content accessible via the REST API to anonymous users (unless additional REST restrictions exist). If secure partner data must not be exposed, keep show_in_rest disabled or add a REST permission_callback/rest_controller that enforces access rules.

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +39
public static function api(array $uri): bool
{
try {
header('Content-Type: application/json');
header('Cache-Control: public, max-age=60'); // 1 minute, to allow duplicates to be cached easily.
echo json_encode(self::getLookup($uri['path'][2]));
exit;
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

Lookup::api() reads $uri['path'][2] without validating the path length. Requests to /touchpoint-api/lookup (no trailing segment) will trigger an undefined offset notice. Add a count($uri['path']) < 3 guard similar to BlocksController::api().

Copilot uses AI. Check for mistakes.
additionalClasses = additionalClasses.replace('is-selected', '').replace(/\s+/g, ' ').trim();

const genderClause = gender === 0 ? "" : ` gender="${gender}"`
const memTypesClause = memTypes !== [0] && memTypes.length > 0 ? ` memTypes="${memTypes.join(',')}"` : "";
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This comparison is always true because arrays are compared by reference in JS (memTypes !== [0]). As written, the saved shortcode will always include a memTypes attribute whenever memTypes.length > 0, even when the default is [0]. Compare by value (e.g., memTypes.length === 1 && memTypes[0] === 0).

Suggested change
const memTypesClause = memTypes !== [0] && memTypes.length > 0 ? ` memTypes="${memTypes.join(',')}"` : "";
const memTypesClause = memTypes.length > 0 && !(memTypes.length === 1 && memTypes[0] === 0) ? ` memTypes="${memTypes.join(',')}"` : "";

Copilot uses AI. Check for mistakes.
const { attributes, setAttributes } = props;
const { postType, division } = attributes;
const blockProps = wp.blockEditor.useBlockProps();
const placeholderId = `tp-inv-list-${generateUniqueId()}`;
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

placeholderId changes on every render because generateUniqueId() is called during render. That can break refs/effects and cause extra fetches or stale DOM updates. Use useRef(generateUniqueId()) (like the People List block) so the ID is stable for the block instance.

Suggested change
const placeholderId = `tp-inv-list-${generateUniqueId()}`;
const placeholderIdRef = wp.element.useRef(`tp-inv-list-${generateUniqueId()}`);
const placeholderId = placeholderIdRef.current;

Copilot uses AI. Check for mistakes.
Comment on lines +10 to 13
if (count($people) > 0) { ?>

<div <?php post_class("person-list"); ?>>
<div class="<?php echo $listClass; ?>" >
<?php
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

$listClass is output into an HTML attribute without escaping/sanitization. Since it comes from shortcode/GET parameters, this is an XSS vector. Use esc_attr() and ideally sanitize the classes (e.g., split and run through sanitize_html_class).

Copilot uses AI. Check for mistakes.
Comment on lines +91 to +97
'meta_query' => [
[
'key' => Meeting::MEETING_META_KEY,
'value' => 0,
'compare' => '!='
],
]
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

This meta query uses compare != 0, which in WP meta queries can also match posts where the meta key is missing, potentially pulling unrelated children and doing extra work. If the intent is “only children with this meta key set”, use compare => 'EXISTS' (and then filter by value) or a stricter numeric comparison.

Copilot uses AI. Check for mistakes.
Comment on lines +103 to +107

if (!Meeting::postIsType($child)) {
// This is just a precaution; it shouldn't happen because the query above only includes involvements.
continue;
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The comment says the query “only includes involvements”, but this block is querying by Meeting::MEETING_META_KEY and then instantiating Meeting objects. This looks like a copy/paste mismatch that makes the template harder to maintain (and the wrapper class name child-involvements is also reused for meeting children).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants