From ba1e1ccf869b818f7a7a897264dfea05563a7796 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 07 Jun 2026 20:10:20 +0000
Subject: [PATCH] =Major overhaul of Integrations. Playing around with adding fields to post types through Registrar from an integrations' class file.
---
inc/managers/Notifications/Notifications.php | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/inc/managers/Notifications/Notifications.php b/inc/managers/Notifications/Notifications.php
index 8e83c41..61ee88c 100644
--- a/inc/managers/Notifications/Notifications.php
+++ b/inc/managers/Notifications/Notifications.php
@@ -46,8 +46,8 @@
]
]);
}
- $contentTax = Registrar::getFeatured('is_content', 'term');
- $verifyEntry = Registrar::getFeatured('verify_entry', 'term');
+ $contentTax = Registrar::withFeature('is_content', 'term');
+ $verifyEntry = Registrar::withFeature('verify_entry', 'term');
if (!empty(array_intersect($contentTax, $verifyEntry))) {
$types = array_merge($types, [
'entry_requested' => [
@@ -69,7 +69,7 @@
]
]);
}
- $invitable = Registrar::getFeatured('invitable');
+ $invitable = Registrar::withFeature('invitable');
if (!empty($invitable)) {
$types = array_merge($types, [
'invitation_requested' => [
@@ -97,12 +97,12 @@
]);
}
- $approvals = Registrar::getFeatured('approve_new');
+ $approvals = Registrar::withFeature('approve_new');
if (!empty($approvals)) {
$tmp = ['user', 'term', 'post'];
$app = [];
foreach ($tmp as $t) {
- $approvals = Registrar::getFeatured('approve_new', $t);
+ $approvals = Registrar::withFeature('approve_new', $t);
if (!empty($approvals)) {
$app = array_merge($app, [
$t.'_new' => [
@@ -130,11 +130,16 @@
$this->types = $types;
}
+ public function getNotificationTypes(bool $all = false):array
+ {
+ return ($all) ? $this->types : array_keys($this->types);
+ }
+
private function defineTable():void
{
$table = CustomTable::for('notifications_main');
- $typeEnum = implode(',',array_map(function($type) { return '`'.$type.'`';}, array_keys($this->types)));
+ $typeEnum = implode(',',array_map(function($type) { return "'{$type}'";}, array_keys($this->types)));
$table->setColumns([
'id' => 'bigint(20) unsigned NOT NULL AUTO_INCREMENT',
@@ -159,7 +164,7 @@
'`user_status` (`for_user`, `status`)',
'`target_lookup` (`target_id`, `target_type`)',
'`unread_notifications` (`for_user`, `status`, `created_at`)',
- '`requires_action` (`for_user`, `requires_action`, `action_taken`)',
+ '`requires_action` (`for_user`, `action_taken`)',
'`from_user_lookup` (`for_user`, `from_user`, `target_id`, `target_type`, `type`)'
]);
--
Gitblit v1.10.0