Skip to content

Commit 52fe004

Browse files
committed
remove redundant post call
1 parent 0899c9e commit 52fe004

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

classes/post/post_control.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -681,16 +681,14 @@ public function build_postform(array $pageparams): mod_moodleoverflow_post_form
681681
* @throws moodle_exception|dml_exception
682682
*/
683683
public function display_original_post(): string {
684-
global $PAGE, $DB;
684+
global $PAGE;
685685
if ($this->interaction == 'reply') {
686686
$PAGE->requires->js_call_amd('mod_moodleoverflow/show_post', 'init');
687-
$post = post::from_record($DB->get_record('moodleoverflow_posts', ['id' => $this->info->relatedpost->get_id()]));
688687
$data = (object) [
689-
'postid' => $post->get_id(),
690-
'postcontent' => $post->get_message_formatted(),
691-
'attachments' => $post->moodleoverflow_get_attachments(),
692-
'byname' => $post->get_userlink(),
693-
'byshortdate' => userdate($post->modified, get_string('strftimedatetimeshort', 'core_langconfig')),
688+
'postid' => $this->info->relatedpost->get_id(),
689+
'postcontent' => $this->info->relatedpost->get_message_formatted(),
690+
'attachments' => $this->info->relatedpost->moodleoverflow_get_attachments(),
691+
'byname' => $this->info->relatedpost->get_userlink(),
694692
];
695693
return $PAGE->get_renderer('mod_moodleoverflow')->render_post_original($data);
696694
}

0 commit comments

Comments
 (0)