iCal notifications

Hello all,

I recently set up Kanboard to sync the iCal calendar up with my android phone. I found that none of the tasks have notifications for their corresponding events that are created.

I did some digging and found that there is a component of the iCal spec (VALARM) that can be set for the notifications. I see that this is already included in the iCal vendor library in Kanboard (Eluceo) but is not being used.

I didn’t see any discussion or Github issue that touched on this, so I thought I’d broach the subject here. I was thinking along the lines of something like - unless it’s an all-day event (time==00:00), set a notification for the start datetime of the task (or due datetime, however that’s handled internally). The reason being I wouldn’t want alarms on all-day things, but only for specific timed reminders. I also would hope that there would be a global default to specify the notification lead time (5 mins before, 30 minutes before, time-of, etc.) I would hope that could be set globally, and then overridden on a per-task basis.

Anyways, let me know if there’s anything out there that does this that I’m missing, or if you all have any thoughts on this.

Regards,

1 Like

Hey,

it would be a nice addition, but they should be a way to turn it off (per user).

Regards

I’m thinking about looking into this. Would it be appropriate for me to set this up the same as the Web/Email notifications? I might add an override on a per-task basis, but to start off with, just a global setting would be easier.

My only hesitation is because adding iCal alarms aren’t the same as any of the “push”-type notifications, but that is the only logical place that I can see to put it.

1 Like

So I started a branch to work on this, but am not sure what I’m messing up here.

My problem is that I continue to get this error:

Internal Error: Identifier "userAlarmModel" is not defined.

I’ll admit that I’m fairly remedial in my understanding of PHP application architecture, so I’m probably just missing some sort of skeleton that needs to be put around this section.

For instance, I traced everything back to these three lines:

They are the lines that are attempting to call the new model that I wrote, but are erroring out as per the above. Is there anything in the diff (linked above) that is missing in order to get this function to use this new model?

pimple. take a look at the base.php, @property. I think you need to add it there so it loads the dependency.

right around here:

add:

 * @property \Kanboard\Model\UserAlarmModel                       $userAlarmModel

Thanks for the tip. Unfortunately, I am getting the same error.

Frustratingly, I enabled the debug output, and it doesn’t seem to be showing anything related to the error in it???

[2021-03-25 04:38:43] [debug] ###############################################
[2021-03-25 04:38:49] [debug] Kanboard\Core\Controller\Runner::executeMiddleware
[2021-03-25 04:38:49] [debug] Subscriber executed: Kanboard\Subscriber\BootstrapSubscriber::execute
[2021-03-25 04:38:49] [debug] Kanboard\Core\Controller\BaseMiddleware::next => Kanboard\Middleware\AuthenticationMiddleware
[2021-03-25 04:38:49] [debug] Kanboard\Core\Controller\BaseMiddleware::next => Kanboard\Middleware\PostAuthenticationMiddleware
[2021-03-25 04:38:49] [debug] Kanboard\Core\Controller\BaseMiddleware::next => Kanboard\Middleware\ApplicationAuthorizationMiddleware
[2021-03-25 04:38:49] [debug] Kanboard\Core\Controller\BaseMiddleware::next => Kanboard\Middleware\ProjectAuthorizationMiddleware
[2021-03-25 04:38:49] [debug] Kanboard\Core\Controller\Runner::executeController => \Kanboard\Controller\UserViewController::notifications
[2021-03-25 04:38:49] [debug] SQL: SELECT `data` FROM `sessions`   WHERE `id` = ?    LIMIT 1
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00068092346191406
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.00068092346191406
[2021-03-25 04:38:49] [debug] SQL: SELECT `option`, `value` FROM `settings`
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00028896331787109
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.00096988677978516
[2021-03-25 04:38:49] [debug] SQL: SELECT projects.id, projects.name FROM `projects` LEFT JOIN `project_has_users` ON `project_has_users`.`project_id`=`projects`.`id`  WHERE project_has_users.user_id = ? AND projects.is_active IN (?)
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00033807754516602
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0013079643249512
[2021-03-25 04:38:49] [debug] SQL: SELECT projects.id, projects.name FROM `projects` LEFT JOIN `project_has_groups` ON `project_has_groups`.`project_id`=`projects`.`id` LEFT JOIN `group_has_users` ON `group_has_users`.`group_id`=`project_has_groups`.`group_id`  WHERE group_has_users.user_id = ? AND projects.is_active IN (?)
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00023293495178223
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0015408992767334
[2021-03-25 04:38:49] [debug] SQL: SELECT * FROM `actions`   WHERE `project_id` IN (?)
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00010395050048828
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0016448497772217
[2021-03-25 04:38:49] [debug] SQL: SELECT * FROM `action_has_params`
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00016379356384277
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0018086433410645
[2021-03-25 04:38:49] [debug] SQL: SELECT 1 FROM `users`  WHERE `id` = ? AND `is_active` = ? AND `role` = ?
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00023818016052246
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0020468235015869
[2021-03-25 04:38:49] [debug] SQL: SELECT * FROM `users`   WHERE `id` = ?    LIMIT 1
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00026702880859375
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0023138523101807
[2021-03-25 04:38:49] [debug] SQL: SELECT projects.id, projects.name FROM `projects` LEFT JOIN `project_has_users` ON `project_has_users`.`project_id`=`projects`.`id`  WHERE project_has_users.user_id = ? AND projects.is_active IN (?)
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00020408630371094
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0025179386138916
[2021-03-25 04:38:49] [debug] SQL: SELECT projects.id, projects.name FROM `projects` LEFT JOIN `project_has_groups` ON `project_has_groups`.`project_id`=`projects`.`id` LEFT JOIN `group_has_users` ON `group_has_users`.`group_id`=`project_has_groups`.`group_id`  WHERE group_has_users.user_id = ? AND projects.is_active IN (?)
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00011086463928223
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0026288032531738
[2021-03-25 04:38:49] [debug] SQL: SELECT `notifications_enabled`, `notifications_filter` FROM `users`   WHERE `id` = ?    LIMIT 1
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00017094612121582
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0027997493743896
[2021-03-25 04:38:49] [debug] SQL: SELECT `notification_type` FROM `user_has_notification_types`   WHERE `user_id` = ?   ORDER BY `notification_type` ASC
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00018787384033203
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0029876232147217
[2021-03-25 04:38:49] [debug] SQL: SELECT `project_id` FROM `user_has_notifications`   WHERE `user_id` = ?
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00016593933105469
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0031535625457764
[2021-03-25 04:38:49] [debug] SQL: SELECT 1 FROM `sessions`  WHERE `id` = ?
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.00035381317138672
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0035073757171631
[2021-03-25 04:38:49] [debug] SQL: UPDATE `sessions` SET `expire_at`=?, `data`=?  WHERE `id` = ?
[2021-03-25 04:38:49] [debug] SQL: query_duration=0.0005040168762207
[2021-03-25 04:38:49] [debug] SQL: total_execution_time=0.0040113925933838
[2021-03-25 04:38:49] [debug] APP: nb_queries=15
[2021-03-25 04:38:49] [debug] APP: rendering_time=0.15697288513184
[2021-03-25 04:38:49] [debug] APP: memory_usage=2.43M
[2021-03-25 04:38:49] [debug] APP: uri=/kanboard/user/2/notifications
[2021-03-25 04:38:49] [debug] ###############################################

This is in a docker container if that makes a difference:

bash-5.0# cat /var/www/app/config.php 
<?php

defined('ENABLE_URL_REWRITE') or define('ENABLE_URL_REWRITE', true);
define('DEBUG', true);
define('LOG_DRIVER', 'file'); // Other drivers are: syslog, stdout, stderr, system or file

// By default, the log file is in data/debug.log but you can change the path:
define('LOG_FILE', '/var/www/app/data/debug.log');

I think my expectation when I enabled that was that there would be some type of a trace for me to look at if I was seeing “Internal Error” on the webpage. The output above looks like a cleanly executed debug output.

there may be more to it.

you probably did, but just to be safe, I’m going to ask, did you restart your container? php may be cached.

I did some more double-checking, and found that UserNotificationModel was also defined in app/ServiceProvider/ClassProvider.php, so I added it there and tried again. It seemed to work, and I started getting actual errors in the PHP output. That led me to find I had an extra close curly brace at the end of my model. Both of these I fixed with emove extra close brace and add UserAlarmModel to SP/CP (e2f77d8d) · Commits · andrewcz / Kanboard · GitLab.

Now I’m getting errors that I was expecting, like missing variables, etc. that should be easier to track down. Thanks for the push in the right direction!

FWIW, I’m generating a docker image based on my work here: Docker Hub. The notifications page is completely broken right now XD, but hopefully I can get it to a working state sooner or later.

1 Like