Skip to content

Commit

Permalink
codeclean
Browse files Browse the repository at this point in the history
  • Loading branch information
TamaroWalter committed Apr 15, 2024
1 parent 9588bbd commit 5774bd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions classes/post_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public function definition() {
$modform->addRule('subject', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');

// The message.
$modform->addElement('editor', 'message', get_string('message', 'moodleoverflow'), null, self::editor_options($modcontext, (empty($post->id) ? null : $post->id)));
$modform->addElement('editor', 'message', get_string('message', 'moodleoverflow'), null,
self::editor_options($modcontext, (empty($post->id) ? null : $post->id)));
$modform->setType('message', PARAM_RAW);
$modform->addRule('message', get_string('required'), 'required', null, 'client');

Expand Down Expand Up @@ -152,13 +153,13 @@ public static function attachment_options($moodleoverflow) {
public static function editor_options(context_module $context, $postid) {
global $COURSE, $PAGE, $CFG;
$maxbytes = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $COURSE->maxbytes);
return array(
return [
'maxfiles' => EDITOR_UNLIMITED_FILES,
'maxbytes' => $maxbytes,
'trusttext'=> true,
'return_types'=> FILE_INTERNAL | FILE_EXTERNAL,
'subdirs' => file_area_contains_subdirs($context, 'mod_forum', 'post', $postid)
);
'trusttext' => true,
'return_types' => FILE_INTERNAL | FILE_EXTERNAL,
'subdirs' => file_area_contains_subdirs($context, 'mod_forum', 'post', $postid),
];
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/review_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,17 @@ private function check_mail_records($teacherpost, $studentpost, $review1, $revie
global $DB;

$this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING,
'reviewed' => $review1, 'timereviewed' => null],
'reviewed' => $review1, 'timereviewed' => null, ],
$DB->get_record('moodleoverflow_posts', ['id' => $teacherpost->id]));
$this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING,
'reviewed' => $review2, 'timereviewed' => null],
'reviewed' => $review2, 'timereviewed' => null, ],
$DB->get_record('moodleoverflow_posts', ['id' => $studentpost->id]));

$this->run_send_mails();
$this->run_send_mails(); // Execute twice to ensure no duplicate mails.

$this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_SUCCESS,
'reviewed' => $review1, 'timereviewed' => null],
'reviewed' => $review1, 'timereviewed' => null, ],
$DB->get_record('moodleoverflow_posts', ['id' => $teacherpost->id]));
$this->assert_matches_properties(['mailed' => $mailed, 'reviewed' => $review2, 'timereviewed' => null],
$DB->get_record('moodleoverflow_posts', ['id' => $studentpost->id]));
Expand Down

0 comments on commit 5774bd1

Please sign in to comment.