users / notifications : temporary disabled notifications system

This commit is contained in:
isUnknown 2024-11-21 19:43:49 +01:00
parent 9167519388
commit ef6375f4cc
15 changed files with 302 additions and 113 deletions

View file

@ -51,9 +51,9 @@ return [
echo json_encode(getFileData($newFile));
try {
$user->sendNotification($page->parent()->uri(), $newComment->toArray());
$user->sendNotification($page->parent(), $newComment->toArray());
} catch (\Throwable $th) {
throw new Exception($th->getMessage(), 1);
return $th->getMessage() . " in " . $th->getFile() . " line " . $th->getLine();
}
exit;

View file

@ -42,7 +42,7 @@ return [
'comments' => $comments
]);
$user->sendNotification($page->parent()->uri(), $newReply->toArray());
$user->sendNotification($page->parent(), $newReply->toArray());
return getFileData($newFile);
}

View file

@ -13,8 +13,23 @@
* @throws Exception If an error occurs while updating a user's notifications.
*/
return function ($projectUri, $notificationData) {
$recipients = page($projectUri)->managers()->toUsers()->not($this);
return function ($project, $notificationData) {
$recipients = kirby()->users()->filter(function($user) use ($project) {
if ($user === $this || $user->projects()->isEmpty()) {
return false;
}
throw new Exception(json_encode($user->name()), 1);
$projects = $user->projects();
if ($projects && ($user->role() == 'admin' || $projects->has($project))) {
return false;
}
return false;
});
// $recipients = page($projectUri)->managers()->toUsers()->not($this);
if (!$recipients) return;

View file

@ -1,15 +1,5 @@
<?php
Kirby::plugin('adrienpayet/pdc-your-projects', [
'userMethods' => [
'projects' => function() {
$allProjects = page('projects')->children();
$managedProjects = $allProjects->filter(
fn ($project) => $project->managers()->toUsers()->has($this)
);
return $managedProjects;
}
]
'userMethods' => []
]);