Forum: add instant push notifications - #12042
Open
iszmais wants to merge 1 commit into
Open
Conversation
Comment on lines
+549
to
+551
| $pushProvider = new ilForumPushProvider(); | ||
| $recipients = $pushProvider->filterMailRecipients($recipients, $provider, $notificationTypes, $logger); | ||
|
|
Contributor
There was a problem hiding this comment.
Can we please move this step to the bottom of the method, after the notification delivery?
Update: Ah okay, you are filtering the recipients, and therefore cannot change the order.
mjansenDatabay
requested changes
Sep 8, 2026
mjansenDatabay
left a comment
Contributor
There was a problem hiding this comment.
Hi @iszmais
Thank you for wiring Forum into the new push provider mechanism.
Please answer the following questions:
- How should
PushQueueResult::UNKNOWNbe treated?NotificationsPushProvider::push()only returns true forPushQueueResult::SUCCEEDED. Unknown is treated as failure, so mail is sent as well. That can duplicate a notification that the endpoint already accepted.
Please consider the following suggestions. You do not need to follow those, but please indicate shortly why you prefer to do otherwise:
- Cache user objects / languages or load users in bulk.
ilObjectFactory::getInstanceByObjId()plusilLanguageFactory::_getLanguageOfUser()per recipient, then a synchronous Web Push request, will sit on the poster’s HTTP request. On forums with many subscribers this can make posting and instant notification slow enough that installations will leave the feature off. - Log push failures the same way you log success. Failures currently disappear into the mail fallback.
- The new language key
forums_forum_push_notification_descfollows the oldforums_*pattern. Current language rules prefer module prefixfrm_and_infofor setting bylines. Of course, existing Forum keys are inconsistent, so this is optional. - If
forum_notificationis disabled,filterMailRecipients()returns[]. That is redundant with the mail sender, but it is also easy to misread as "suppress all mail". Please prefer returning the original$recipientsand skipping push.
Please implement the following changes:
- Rename
$pushProviderto$push_providerinilForumAppEventListener. - Fix the action title on
ilNotificationLink.ilNotificationLinkstoresilNotificationParameter::getName()as title, andilNotificationPushHandler::buildContent()puts that string into the payloadactions[].title. You passforums_notification_show_postwith no parameters. The English translation is "Show post: %s" (the %s is the URL in mail). - If somehow possible, please do not construct
NotificationsPushProvider(ilNotificationPushHandler) unless push can actually run.getPushProvider()always doesnew NotificationsPushProvider($this), and the handler constructor doesfile_get_contents($settings->get('private_key_path')).ilSetting::get()declares?string, sofile_get_contents(null)results in a type error if no private key path can be found. That runs for every immediate Forum notification with recipients, even whenenable_pushis off or keys were never configured. The handler returns early innotify()when disabled, but the constructor already ran. A failed constructor would abortsendNotification()before mail is sent. Please guard onenable_push(and a usable key path), or make the handler construction null-safe, before this is merged.
Best regards,
Michael
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://docu.ilias.de/go/wiki/wpage_9000_1357