mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-69577 forum: Add courseid, forumid on get_discussion_posts response
This commit is contained in:
parent
38abfb6a01
commit
150913d3e1
2 changed files with 6 additions and 0 deletions
|
@ -226,6 +226,8 @@ class mod_forum_external extends external_api {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'posts' => $postbuilder->build($USER, [$forum], [$discussion], $posts),
|
'posts' => $postbuilder->build($USER, [$forum], [$discussion], $posts),
|
||||||
|
'forumid' => $discussion->get_forum_id(),
|
||||||
|
'courseid' => $discussion->get_course_id(),
|
||||||
'ratinginfo' => \core_rating\external\util::get_rating_info(
|
'ratinginfo' => \core_rating\external\util::get_rating_info(
|
||||||
$legacydatamapper->get_forum_data_mapper()->to_legacy_object($forum),
|
$legacydatamapper->get_forum_data_mapper()->to_legacy_object($forum),
|
||||||
$forum->get_context(),
|
$forum->get_context(),
|
||||||
|
@ -258,6 +260,8 @@ class mod_forum_external extends external_api {
|
||||||
public static function get_discussion_posts_returns() {
|
public static function get_discussion_posts_returns() {
|
||||||
return new external_single_structure([
|
return new external_single_structure([
|
||||||
'posts' => new external_multiple_structure(\mod_forum\local\exporters\post::get_read_structure()),
|
'posts' => new external_multiple_structure(\mod_forum\local\exporters\post::get_read_structure()),
|
||||||
|
'forumid' => new external_value(PARAM_INT, 'The forum id'),
|
||||||
|
'courseid' => new external_value(PARAM_INT, 'The forum course id'),
|
||||||
'ratinginfo' => \core_rating\external\util::external_ratings_structure(),
|
'ratinginfo' => \core_rating\external\util::external_ratings_structure(),
|
||||||
'warnings' => new external_warnings()
|
'warnings' => new external_warnings()
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -660,6 +660,8 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
|
||||||
// Create what we expect to be returned when querying the discussion.
|
// Create what we expect to be returned when querying the discussion.
|
||||||
$expectedposts = array(
|
$expectedposts = array(
|
||||||
'posts' => array(),
|
'posts' => array(),
|
||||||
|
'courseid' => $course1->id,
|
||||||
|
'forumid' => $forum1->id,
|
||||||
'ratinginfo' => array(
|
'ratinginfo' => array(
|
||||||
'contextid' => $forum1context->id,
|
'contextid' => $forum1context->id,
|
||||||
'component' => 'mod_forum',
|
'component' => 'mod_forum',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue