mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-55728-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
917a59a1a0
6 changed files with 71 additions and 0 deletions
|
@ -286,6 +286,10 @@ class mod_forum_external extends external_api {
|
|||
if (!empty($post->attachment)) {
|
||||
$post->attachments = external_util::get_area_files($modcontext->id, 'mod_forum', 'attachment', $post->id);
|
||||
}
|
||||
$messageinlinefiles = external_util::get_area_files($modcontext->id, 'mod_forum', 'post', $post->id);
|
||||
if (!empty($messageinlinefiles)) {
|
||||
$post->messageinlinefiles = $messageinlinefiles;
|
||||
}
|
||||
|
||||
$posts[] = $post;
|
||||
}
|
||||
|
@ -319,6 +323,7 @@ class mod_forum_external extends external_api {
|
|||
'message' => new external_value(PARAM_RAW, 'The post message'),
|
||||
'messageformat' => new external_format_value('message'),
|
||||
'messagetrust' => new external_value(PARAM_INT, 'Can we trust?'),
|
||||
'messageinlinefiles' => new external_files('post message inline files', VALUE_OPTIONAL),
|
||||
'attachment' => new external_value(PARAM_RAW, 'Has attachments?'),
|
||||
'attachments' => new external_files('attachments', VALUE_OPTIONAL),
|
||||
'totalscore' => new external_value(PARAM_INT, 'The post message total score'),
|
||||
|
@ -499,6 +504,10 @@ class mod_forum_external extends external_api {
|
|||
$discussion->attachments = external_util::get_area_files($modcontext->id, 'mod_forum', 'attachment',
|
||||
$discussion->id);
|
||||
}
|
||||
$messageinlinefiles = external_util::get_area_files($modcontext->id, 'mod_forum', 'post', $discussion->id);
|
||||
if (!empty($messageinlinefiles)) {
|
||||
$discussion->messageinlinefiles = $messageinlinefiles;
|
||||
}
|
||||
|
||||
$discussion->locked = forum_discussion_is_locked($forum, $discussion);
|
||||
$discussion->canreply = forum_user_can_post($forum, $discussion, $USER, $cm, $course, $modcontext);
|
||||
|
@ -543,6 +552,7 @@ class mod_forum_external extends external_api {
|
|||
'message' => new external_value(PARAM_RAW, 'The post message'),
|
||||
'messageformat' => new external_format_value('message'),
|
||||
'messagetrust' => new external_value(PARAM_INT, 'Can we trust?'),
|
||||
'messageinlinefiles' => new external_files('post message inline files', VALUE_OPTIONAL),
|
||||
'attachment' => new external_value(PARAM_RAW, 'Has attachments?'),
|
||||
'attachments' => new external_files('attachments', VALUE_OPTIONAL),
|
||||
'totalscore' => new external_value(PARAM_INT, 'The post message total score'),
|
||||
|
|
|
@ -225,6 +225,19 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
|
|||
$record->parent = $discussion1->firstpost;
|
||||
$record->userid = $user2->id;
|
||||
$discussion1reply1 = self::getDataGenerator()->get_plugin_generator('mod_forum')->create_post($record);
|
||||
$filename = 'shouldbeanimage.jpg';
|
||||
// Add a fake inline image to the post.
|
||||
$filerecordinline = array(
|
||||
'contextid' => $forum1context->id,
|
||||
'component' => 'mod_forum',
|
||||
'filearea' => 'post',
|
||||
'itemid' => $discussion1reply1->id,
|
||||
'filepath' => '/',
|
||||
'filename' => $filename,
|
||||
);
|
||||
$fs = get_file_storage();
|
||||
$timepost = time();
|
||||
$fs->create_file_from_string($filerecordinline, 'image contents (not really)');
|
||||
|
||||
$record->parent = $discussion1reply1->id;
|
||||
$record->userid = $user3->id;
|
||||
|
@ -284,6 +297,17 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
|
|||
'messageformat' => 1, // This value is usually changed by external_format_text() function.
|
||||
'messagetrust' => $discussion1reply1->messagetrust,
|
||||
'attachment' => $discussion1reply1->attachment,
|
||||
'messageinlinefiles' => array(
|
||||
array(
|
||||
'filename' => $filename,
|
||||
'filepath' => '/',
|
||||
'filesize' => '27',
|
||||
'fileurl' => moodle_url::make_webservice_pluginfile_url($forum1context->id, 'mod_forum', 'post',
|
||||
$discussion1reply1->id, '/', $filename),
|
||||
'timemodified' => $timepost,
|
||||
'mimetype' => 'image/jpeg',
|
||||
)
|
||||
),
|
||||
'totalscore' => $discussion1reply1->totalscore,
|
||||
'mailnow' => $discussion1reply1->mailnow,
|
||||
'children' => array($discussion1reply2->id),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue