MDL-27520 assignfeedback_comments: is_feedback_modified considers files
authorMark Nelson <markn@moodle.com>
Tue, 16 Oct 2018 08:49:42 +0000 (16:49 +0800)
committerMark Nelson <markn@moodle.com>
Wed, 17 Oct 2018 07:57:27 +0000 (15:57 +0800)
mod/assign/feedback/comments/locallib.php

index d931386..4940063 100644 (file)
@@ -122,7 +122,15 @@ class assign_feedback_comments extends assign_feedback_plugin {
             }
         }
 
-        if ($commenttext == $data->assignfeedbackcomments_editor['text']) {
+        $formtext = $data->assignfeedbackcomments_editor['text'];
+
+        // Need to convert the form text to use @@PLUGINFILE@@ and format it so we can compare it with what is stored in the DB.
+        if (isset($data->assignfeedbackcomments_editor['itemid'])) {
+            $formtext = file_rewrite_urls_to_pluginfile($formtext, $data->assignfeedbackcomments_editor['itemid']);
+            $formtext = format_text($formtext, FORMAT_HTML);
+        }
+
+        if ($commenttext == $formtext) {
             return false;
         } else {
             return true;