Skip to content

Commit

Permalink
MDL-70037 mod_forum: include post modified date in external structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Dec 1, 2020
1 parent f34b446 commit 356b4f9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mod/forum/classes/local/exporters/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ protected static function define_other_properties() {
'null' => NULL_ALLOWED
],
'timecreated' => ['type' => PARAM_INT],
'timemodified' => ['type' => PARAM_INT],
'unread' => [
'type' => PARAM_BOOL,
'optional' => true,
Expand Down Expand Up @@ -437,6 +438,7 @@ protected function get_other_values(renderer_base $output) {
'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,
Expand Down
6 changes: 6 additions & 0 deletions mod/forum/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ public function test_mod_forum_get_discussion_posts() {
'parentid' => $discussion1reply2->parent,
'hasparent' => true,
'timecreated' => $discussion1reply2->created,
'timemodified' => $discussion1reply2->modified,
'subject' => $discussion1reply2->subject,
'replysubject' => get_string('re', 'mod_forum') . " {$discussion1reply2->subject}",
'message' => $message,
Expand Down Expand Up @@ -742,6 +743,7 @@ public function test_mod_forum_get_discussion_posts() {
'parentid' => $discussion1reply1->parent,
'hasparent' => true,
'timecreated' => $discussion1reply1->created,
'timemodified' => $discussion1reply1->modified,
'subject' => $discussion1reply1->subject,
'replysubject' => get_string('re', 'mod_forum') . " {$discussion1reply1->subject}",
'message' => $message,
Expand Down Expand Up @@ -2761,6 +2763,7 @@ public function test_mod_forum_get_discussion_posts_by_userid() {
'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',
Expand Down Expand Up @@ -2825,6 +2828,7 @@ public function test_mod_forum_get_discussion_posts_by_userid() {
'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',
Expand Down Expand Up @@ -2900,6 +2904,7 @@ public function test_mod_forum_get_discussion_posts_by_userid() {
'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',
Expand Down Expand Up @@ -2964,6 +2969,7 @@ public function test_mod_forum_get_discussion_posts_by_userid() {
'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',
Expand Down
8 changes: 8 additions & 0 deletions mod/forum/upgrade.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 356b4f9

Please sign in to comment.