Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
dad3c57b
Commit
dad3c57b
authored
Jun 26, 2018
by
Peter Spicer
Committed by
Robert Lyon
Aug 18, 2019
Browse files
Bug 1837194: Make user-to-user notifications available to plugins.
behatnotneeded Change-Id: I314750c475a793b42ed6777739c73db7e6dae676
parent
3477c53b
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/module/multirecipientnotification/notification/ActivityTypeMultirecipientmessage.php
View file @
dad3c57b
...
...
@@ -76,6 +76,8 @@ class ActivityTypeMultirecipientmessage extends ActivityTypeUsermessage {
* @param type $user
*/
public
function
notify_user
(
$user
)
{
static
$pluginlist
=
null
;
$userdata
=
$this
->
to_stdclass
();
$changes
=
new
stdClass
();
$userdata
->
usr
=
$user
->
id
;
...
...
@@ -111,6 +113,25 @@ class ActivityTypeMultirecipientmessage extends ActivityTypeUsermessage {
update_record
(
'module_multirecipient_userrelation'
,
$changes
);
}
// If unread, check if any plugins want to do anything with this. (Handled this way as cheaper than using events.)
if
(
empty
(
$userdata
->
read
))
{
// Only do the include process once - don't even try to do inclusion if we know we already have.
if
(
$pluginlist
===
null
)
{
$pluginlist
=
plugin_all_installed
();
foreach
(
$pluginlist
as
$plugin
)
{
safe_require
(
$plugin
->
plugintype
,
$plugin
->
name
);
}
}
foreach
(
$pluginlist
as
$key
=>
$plugin
)
{
$classname
=
generate_class_name
(
$plugin
->
plugintype
,
$plugin
->
name
);
if
(
!
is_callable
(
array
(
$classname
,
'notification_created'
)))
{
unset
(
$pluginlist
[
$key
]);
continue
;
}
call_static_method
(
$classname
,
'notification_created'
,
$userdata
->
notification
,
$userdata
,
'module_multirecipient_notification'
);
}
}
if
((
$user
->
method
!=
'internal'
)
&&
(
'sender'
!==
$userdata
->
role
))
{
$method
=
$user
->
method
;
safe_require
(
'notification'
,
$method
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment