MDL-70037 mod_forum: include post modified date in external structure.
authorPaul Holden <paulh@moodle.com>
Fri, 13 Nov 2020 09:34:45 +0000 (09:34 +0000)
committerPaul Holden <paulh@moodle.com>
Tue, 1 Dec 2020 00:04:25 +0000 (00:04 +0000)
mod/forum/classes/local/exporters/post.php
mod/forum/tests/externallib_test.php
mod/forum/upgrade.txt

index 6b361c5..e9c445e 100644 (file)
@@ -106,6 +106,7 @@ class post extends exporter {
                 'null' => NULL_ALLOWED
             ],
             'timecreated' => ['type' => PARAM_INT],
+            'timemodified' => ['type' => PARAM_INT],
             'unread' => [
                 'type' => PARAM_BOOL,
                 'optional' => true,
@@ -437,6 +438,7 @@ class post extends exporter {
             'hasparent' => $post->has_parent(),
             'parentid' => $post->has_parent() ? $post->get_parent_id() : null,
             'timecreated' => $timecreated,
+            'timemodified' => $post->get_time_modified(),
             'unread' => ($loadcontent && $readreceiptcollection) ? !$readreceiptcollection->has_user_read_post($user, $post) : null,
             'isdeleted' => $isdeleted,
             'isprivatereply' => $isprivatereply,
index 62e33a3..0e47747 100644 (file)
@@ -685,6 +685,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
             'parentid' => $discussion1reply2->parent,
             'hasparent' => true,
             'timecreated' => $discussion1reply2->created,
+            'timemodified' => $discussion1reply2->modified,
             'subject' => $discussion1reply2->subject,
             'replysubject' => get_string('re', 'mod_forum') . " {$discussion1reply2->subject}",
             'message' => $message,
@@ -742,6 +743,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
             'parentid' => $discussion1reply1->parent,
             'hasparent' => true,
             'timecreated' => $discussion1reply1->created,
+            'timemodified' => $discussion1reply1->modified,
             'subject' => $discussion1reply1->subject,
             'replysubject' => get_string('re', 'mod_forum') . " {$discussion1reply1->subject}",
             'message' => $message,
@@ -2761,6 +2763,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
                         'parentid' => $discussion1reply1->parent,
                         'hasparent' => true,
                         'timecreated' => $discussion1reply1->created,
+                        'timemodified' => $discussion1reply1->modified,
                         'subject' => $discussion1reply1->subject,
                         'replysubject' => get_string('re', 'mod_forum') . " {$discussion1reply1->subject}",
                         'message' => file_rewrite_pluginfile_urls($discussion1reply1->message, 'pluginfile.php',
@@ -2825,6 +2828,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
                         'parentid' => null,
                         'hasparent' => false,
                         'timecreated' => $discussion1firstpostobject->created,
+                        'timemodified' => $discussion1firstpostobject->modified,
                         'subject' => $discussion1firstpostobject->subject,
                         'replysubject' => get_string('re', 'mod_forum') . " {$discussion1firstpostobject->subject}",
                         'message' => file_rewrite_pluginfile_urls($discussion1firstpostobject->message, 'pluginfile.php',
@@ -2900,6 +2904,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
                         'parentid' => $discussion2reply1->parent,
                         'hasparent' => true,
                         'timecreated' => $discussion2reply1->created,
+                        'timemodified' => $discussion2reply1->modified,
                         'subject' => $discussion2reply1->subject,
                         'replysubject' => get_string('re', 'mod_forum') . " {$discussion2reply1->subject}",
                         'message' => file_rewrite_pluginfile_urls($discussion2reply1->message, 'pluginfile.php',
@@ -2964,6 +2969,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
                         'parentid' => null,
                         'hasparent' => false,
                         'timecreated' => $discussion2firstpostobject->created,
+                        'timemodified' => $discussion2firstpostobject->modified,
                         'subject' => $discussion2firstpostobject->subject,
                         'replysubject' => get_string('re', 'mod_forum') . " {$discussion2firstpostobject->subject}",
                         'message' => file_rewrite_pluginfile_urls($discussion2firstpostobject->message, 'pluginfile.php',
index 154c1f1..d990e9c 100644 (file)
@@ -1,6 +1,14 @@
 This files describes API changes in /mod/forum/*,
 information provided here is intended especially for developers.
 
+=== 3.11 ===
+
+* The forum post exporter now includes a "timemodified" field for each post, which is included in several WS methods:
+    * mod_forum_get_discussion_posts
+    * get_discussion_posts_by_userid
+    * get_discussion_post
+    * add_discussion_post
+
 === 3.10 ===
 
 * Changes in external function mod_forum_external::get_discussion_posts_by_userid