Adding notifications hooks for plugins

Bug #1837194 reported by Peter Spicer on 2019-07-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Wishlist
Unassigned

Bug Description

At Moodlemoot UK 2019, I demoed a piece of work we'd done for QMUL to better integrate their Moodle and Mahara - https://www.youtube.com/watch?v=Ixy4Ah9webQ for the presentation - and said I'd talk to the Mahara team about getting it into core so I could then release the rest of it as plugins.

Essentially we made a few core hacks to 18.04 to support some additional behaviours around notifications sent to a user:

* ability to add extra parameters in the inbox URL to open a specific message
* call out to plugin functions if defined when a new notification is issued
* call out to plugin functions if defined when a notification is read
* call out to plugin functions if defined when a notification is deleted

These hook points would allow a plugin to optionally do something with these notifications, such as sending the notifications out to a Moodle webservice, or updating the Moodle when a notification is read in Mahara, and with a view to being as efficient as possible to avoid affecting those who don't have the integration set up.

I'll review the patches ASAP that I did for 18.04 to see what needs changing for 19.10 but I'd appreciate it if we could look at getting them in for that release and adding Behat tests for the first item, I don't think I can do anything for the others.

The functionality I'm looking at adding is explicitly giving options to plugin authors, not changing core Mahara behaviour in case that's a concern.

Peter Spicer (peter.spicer) wrote :

Here's the first bunch of patches, these represent the core functionality of letting notifications be passed to a plugin to do something additional with them.

Peter Spicer (peter.spicer) wrote :
Peter Spicer (peter.spicer) wrote :
Peter Spicer (peter.spicer) wrote :
Peter Spicer (peter.spicer) wrote :
Peter Spicer (peter.spicer) wrote :

Here's also the patch for the inbox.

Note the change to the JS, I don't remember exactly why that was there but from my notes, it seems that if you came to the message directly (e.g. from Moodle's notifications, which is what this patch was for), the act of opening it directly would break the ability to delete things.

This is everything I've got for the core integration here, please let me know your thoughts on merging - I'd appreciate a hand with the Behat since I'm not familiar with Mahara's Behat setup and I don't know how best to trigger a notification, while knowing its ID, so it's possible to go direct to the notification by URL.

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/10209

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/10210

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/10208

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/10212

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/10246

Reviewed: https://reviews.mahara.org/10211
Committed: https://git.mahara.org/mahara/mahara/commit/4665dd4b58cdd9b82f2504d1e50ed6b6e9c34218
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 4665dd4b58cdd9b82f2504d1e50ed6b6e9c34218
Author: Peter Spicer <email address hidden>
Date: Tue Jun 26 14:27:15 2018 +0100

Bug 1837194: Notify plugins when a notification is deleted

behatnotneeded

Change-Id: Ife0d0351e012fc9eef5bc3c3fc535e64a628e96a

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10208
Committed: https://git.mahara.org/mahara/mahara/commit/3477c53be0748b4c6c222725f4514bd63514bc8b
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 3477c53be0748b4c6c222725f4514bd63514bc8b
Author: Peter Spicer <email address hidden>
Date: Tue Jun 26 14:23:15 2018 +0100

Bug 1837194: Make newly created internal notifications available to plugins.

behatnotneeded

Change-Id: I305bf79c289ccd0325b290c6ae42fb996951709e

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10212
Committed: https://git.mahara.org/mahara/mahara/commit/29091c94922a4b2c146614c60ed3c25e837b03ca
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 29091c94922a4b2c146614c60ed3c25e837b03ca
Author: Peter Spicer <email address hidden>
Date: Tue Jun 26 14:28:14 2018 +0100

Bug 1837194: Notify plugins when all notifications are deleted.

behatnotneeded

Change-Id: I15b94e78e52b2f1abc7942ab341ae1b3a4960398

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10210
Committed: https://git.mahara.org/mahara/mahara/commit/76aea3bf96ee61bcf73fa93501b0fb57c68a2603
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 76aea3bf96ee61bcf73fa93501b0fb57c68a2603
Author: Peter Spicer <email address hidden>
Date: Tue Jun 26 14:26:05 2018 +0100

Bug 1837194: Notify plugins when a notification is marked read.

behatnotneeded

Change-Id: I5a24e9340db26774ce27691745c627824e8bb17c

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10246
Committed: https://git.mahara.org/mahara/mahara/commit/ab0a0975896c3b6135356bab0a08508e40a6d8be
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit ab0a0975896c3b6135356bab0a08508e40a6d8be
Author: Peter Spicer <email address hidden>
Date: Tue Aug 6 18:28:52 2019 +0100

Bug 1837194: Allow going directly to a message from a URL

For normal messages, going to the inbox and unhiding a message is fine,
but if the message is one that will have been synced to an LMS, the user
is quite likely to come from the LMS via a direct link to the message itself.

This allows us to expand a message - albeit on the proviso that it is on
the first page of results, though this is a scenario that never came up in
a year of user testing.

I did include a Behat test, though I had to write a new step to cover the
specifics of 'going directly to a message'.

Change-Id: I0e68fcc37f1ed453b6c43ce939d8c2a3a60b292e

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10209
Committed: https://git.mahara.org/mahara/mahara/commit/dad3c57b87cb97fcaece2e0ba8c252289ed00d00
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit dad3c57b87cb97fcaece2e0ba8c252289ed00d00
Author: Peter Spicer <email address hidden>
Date: Tue Jun 26 14:24:24 2018 +0100

Bug 1837194: Make user-to-user notifications available to plugins.

behatnotneeded

Change-Id: I314750c475a793b42ed6777739c73db7e6dae676

Robert Lyon (robertl-9) on 2019-08-19
Changed in mahara:
status: New → Fix Committed
importance: Undecided → Wishlist
milestone: none → 19.10.0
tags: added: nominatedfeature
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers