Fix healthcheck when no supported event plugin is installed (#88)
All checks were successful
PHP Code Checker / PHP Code Checker (push) Successful in 52s
PHPUnit / PHPUnit – PHP 7.4 (push) Successful in 1m7s
PHPUnit / PHPUnit – PHP 8.0 (push) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.1 (push) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.2 (push) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.3 (push) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.4 (push) Successful in 1m9s

Reviewed-on: #88
Co-authored-by: André Menrath <andre.menrath@posteo.de>
Co-committed-by: André Menrath <andre.menrath@posteo.de>
This commit is contained in:
André Menrath 2024-12-19 16:06:25 +01:00 committed by André Menrath
parent 16b3c1402e
commit cc78b216a2
8 changed files with 25 additions and 20 deletions

View file

@ -5,13 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
* Add custom summary via shortcodes
## [0.3.2] - 2024-12-12
## [0.3.3] - 2024-12-19
* Initial release on WordPress.org

View file

@ -3,7 +3,7 @@
**Tags:** events, fediverse, activitypub, calendar
**Requires at least:** 6.5
**Tested up to:** 6.7
**Stable tag:** 0.3.2
**Stable tag:** 0.3.3
**Requires PHP:** 7.4
**License:** AGPL-3.0-or-later
**License URI:** https://www.gnu.org/licenses/agpl-3.0.html
@ -102,7 +102,7 @@ We're always interested in your feedback. Feel free to reach out to us via [E-Ma
## Changelog ##
### [0.3.2] 2024-12-12 ###
### [0.3.3] 2024-12-19 ###
* Initial release on https://wordpress.org/

View file

@ -3,7 +3,7 @@
* Plugin Name: Event Bridge for ActivityPub
* Description: Integrating popular event plugins with the ActivityPub plugin.
* Plugin URI: https://event-federation.eu/
* Version: 0.3.2
* Version: 0.3.3
* Author: André Menrath
* Author URI: https://graz.social/@linos
* Text Domain: event-bridge-for-activitypub

View file

@ -29,7 +29,7 @@ class General_Admin_Notices {
*/
const ACTIVITYPUB_PLUGIN_URL = 'https://wordpress.org/plugins/activitypub';
const EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL = 'https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub#events-plugin-that-will-be-supported-at-first';
const EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL = 'https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub#supported-event-plugins';
/**
* Allowed HTML for admin notices.
@ -38,8 +38,9 @@ class General_Admin_Notices {
*/
const ALLOWED_HTML = array(
'a' => array(
'href' => true,
'title' => true,
'href' => true,
'title' => true,
'target' => true,
),
'br',
'i',
@ -90,11 +91,11 @@ class General_Admin_Notices {
/* translators: 1: An URL to the list of supported event plugins. */
_x(
'The Plugin <i>Event Bridge for ActivityPub</i> is of no use, because you do not have installed and activated a supported Event Plugin.
<br> For a list of supported Event Plugins see <a href="%1$s">here</a>.',
<br> For a list of supported Event Plugins see <a href="%1$s" target="_blank">here</a>.',
'admin notice',
'event-bridge-for-activitypub'
),
esc_html( self::EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL )
esc_url( self::EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL )
);
}

View file

@ -116,7 +116,10 @@ class Health_Check {
if ( ! $event_post_type ) {
$active_event_plugins = Setup::get_instance()->get_active_event_plugins();
$active_event_plugin = reset( $active_event_plugins );
$event_post_type = $active_event_plugin->get_post_type();
if ( ! $active_event_plugin ) {
return false;
}
$event_post_type = $active_event_plugin->get_post_type();
}
$args = array(

View file

@ -3,7 +3,7 @@ Contributors: andremenrath
Tags: events, fediverse, activitypub, calendar
Requires at least: 6.5
Tested up to: 6.7
Stable tag: 0.3.2
Stable tag: 0.3.3
Requires PHP: 7.4
License: AGPL-3.0-or-later
License URI: https://www.gnu.org/licenses/agpl-3.0.html
@ -96,6 +96,6 @@ We're always interested in your feedback. Feel free to reach out to us via [E-Ma
== Changelog ==
= [0.3.2] 2024-12-12 =
= [0.3.3] 2024-12-19 =
* Initial release on https://wordpress.org/

View file

@ -9,6 +9,7 @@
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
use Event_Bridge_For_ActivityPub\Setup;
use Event_Bridge_For_ActivityPub\Admin\General_Admin_Notices;
use Event_Bridge_For_ActivityPub\Admin\Settings_Page;
use Event_Bridge_For_ActivityPub\Admin\Health_Check;
@ -41,6 +42,12 @@ WP_Filesystem();
<div class="box">
<h2><?php \esc_html_e( 'Status', 'event-bridge-for-activitypub' ); ?></h2>
<p><?php \esc_html_e( 'The Event Bridge for ActivityPub detected the following (activated) event plugins:', 'event-bridge-for-activitypub' ); ?></p>
<?php
if ( empty( $active_event_plugins ) ) {
$notice = General_Admin_Notices::get_admin_notice_no_supported_event_plugin_active();
}
echo '<p>⚠' . \wp_kses( $notice, General_Admin_Notices::ALLOWED_HTML ) . '</p>';
?>
<?php foreach ( $active_event_plugins as $active_event_plugin ) { ?>
<h3><?php echo esc_html( $active_event_plugin->get_plugin_name() ); ?>:</h3>
<ul class="event-bridge-for-activitypub-list">

View file

@ -56,7 +56,7 @@ class Test_GatherPress extends WP_UnitTestCase {
$params = array(
'datetime_start' => '+10 days 15:00:00',
'datetime_end' => '+10 days 16:00:00',
'timezone' => 'America/New_York',
'timezone' => \wp_timezone_string(),
);
$event->save_datetimes( $params );
@ -85,7 +85,7 @@ class Test_GatherPress extends WP_UnitTestCase {
$params = array(
'datetime_start' => '+10 days 15:00:00',
'datetime_end' => '+10 days 16:00:00',
'timezone' => 'America/New_York',
'timezone' => \wp_timezone_string(),
);
$event->save_datetimes( $params );