Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-43295 mod_assign: Removed wrongly used format_text call in online…

… text submission.
  • Loading branch information...
commit d868e5331c1ffa162ef6ad5092ad8a149274ba39 1 parent 8703e65
Adrian Greeve abgreeve authored
12 mod/assign/submission/onlinetext/locallib.php
View
@@ -140,10 +140,6 @@ public function save(stdClass $submission, stdClass $data) {
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
- $text = format_text($data->onlinetext,
- $data->onlinetext_editor['format'],
- array('context'=>$this->assignment->get_context()));
-
$fs = get_file_storage();
$files = $fs->get_area_files($this->assignment->get_context()->id,
@@ -158,7 +154,8 @@ public function save(stdClass $submission, stdClass $data) {
'objectid' => $submission->id,
'other' => array(
'pathnamehashes' => array_keys($files),
- 'content' => trim($text)
+ 'content' => trim($data->onlinetext),
+ 'format' => $data->onlinetext_editor['format']
)
);
$event = \assignsubmission_onlinetext\event\assessable_uploaded::create($params);
@@ -424,12 +421,9 @@ public function format_for_log(stdClass $submission) {
// Format the info for each submission plugin (will be logged).
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
$onlinetextloginfo = '';
- $text = format_text($onlinetextsubmission->onlinetext,
- $onlinetextsubmission->onlineformat,
- array('context'=>$this->assignment->get_context()));
$onlinetextloginfo .= get_string('numwordsforlog',
'assignsubmission_onlinetext',
- count_words($text));
+ count_words($onlinetextsubmission->onlinetext));
return $onlinetextloginfo;
}
1  mod/assign/submission/onlinetext/tests/events_test.php
View
@@ -60,6 +60,7 @@ public function test_assessable_uploaded() {
$this->assertEquals($context->id, $event->contextid);
$this->assertEquals($submission->id, $event->objectid);
$this->assertEquals(array(), $event->other['pathnamehashes']);
+ $this->assertEquals(FORMAT_PLAIN, $event->other['format']);
$this->assertEquals('Submission text', $event->other['content']);
$expected = new stdClass();
$expected->modulename = 'assign';
7 mod/assign/upgrade.txt
View
@@ -1,5 +1,12 @@
This files describes API changes in the assign code.
+=== 2.6.1 ===
+
+* format_text() is no longer used for formating assignment content to be used in events (assign_submission_onlinetext::save()) or
+ the word count (assign_submission_onlinetext::format_for_log()) in mod/assign/submission/onlinetext/locallib.php. format_text()
+ should only be used when displaying information to the screen. It was being used incorrectly before in these areas. Plugins using
+ the event assessable_uploaded() should use file_rewrite_pluginfile_urls() to translate the text back to the desired output.
+
=== 2.6 ===
* To see submission/grades of inactive users, user should have moodle/course:viewsuspendedusers capability.
* count_* functions will return only active participants.
Please sign in to comment.
Something went wrong with that request. Please try again.