mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-65665 forum: WS does not respect subscribe on reply user preference
This commit is contained in:
parent
e321b28236
commit
d411a1c10e
@ -1257,9 +1257,13 @@ class mod_forum_external extends external_api {
|
||||
$context = context_module::instance($cm->id);
|
||||
self::validate_context($context);
|
||||
|
||||
$coursecontext = \context_course::instance($forum->get_course_id());
|
||||
$discussionsubscribe = \mod_forum\subscriptions::get_user_default_subscription($forumrecord, $coursecontext,
|
||||
$cm, null);
|
||||
|
||||
// Validate options.
|
||||
$options = array(
|
||||
'discussionsubscribe' => true,
|
||||
'discussionsubscribe' => $discussionsubscribe,
|
||||
'private' => false,
|
||||
'inlineattachmentsid' => 0,
|
||||
'attachmentsid' => null,
|
||||
@ -1350,9 +1354,11 @@ class mod_forum_external extends external_api {
|
||||
$completion->update_state($cm, COMPLETION_COMPLETE);
|
||||
}
|
||||
|
||||
$settings = new stdClass();
|
||||
$settings->discussionsubscribe = $options['discussionsubscribe'];
|
||||
forum_post_subscription($settings, $forumrecord, $discussionrecord);
|
||||
if ($options['discussionsubscribe']) {
|
||||
$settings = new stdClass();
|
||||
$settings->discussionsubscribe = $options['discussionsubscribe'];
|
||||
forum_post_subscription($settings, $forumrecord, $discussionrecord);
|
||||
}
|
||||
} else {
|
||||
throw new moodle_exception('couldnotadd', 'forum');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user