MDL-53562 forum: Fixed missing forum subject Re: prefix
This commit is contained in:
+2
-2
@@ -826,8 +826,8 @@ function forum_cron() {
|
||||
// MS Outlook / Office uses poorly documented and non standard headers, including
|
||||
// Thread-Topic which overrides the Subject and shouldn't contain Re: or Fwd: etc.
|
||||
$a->subject = $discussion->name;
|
||||
$postsubject = html_to_text(get_string('postmailsubject', 'forum', $a), 0);
|
||||
$userfrom->customheaders[] = "Thread-Topic: $postsubject";
|
||||
$threadtopic = html_to_text(get_string('postmailsubject', 'forum', $a), 0);
|
||||
$userfrom->customheaders[] = "Thread-Topic: $threadtopic";
|
||||
$userfrom->customheaders[] = "Thread-Index: " . substr($rootid, 1, 28);
|
||||
|
||||
// Send the post now!
|
||||
|
||||
@@ -184,6 +184,8 @@ class mod_forum_mail_testcase extends advanced_testcase {
|
||||
// Add a post to the discussion.
|
||||
$record = new stdClass();
|
||||
$record->course = $forum->course;
|
||||
$strre = get_string('re', 'forum');
|
||||
$record->subject = $strre . ' ' . $discussion->subject;
|
||||
$record->userid = $author->id;
|
||||
$record->forum = $forum->id;
|
||||
$record->discussion = $discussion->id;
|
||||
@@ -834,6 +836,33 @@ class mod_forum_mail_testcase extends advanced_testcase {
|
||||
$this->assertEquals($expectedsubject, $message->subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test inital email and reply email subjects
|
||||
*/
|
||||
public function test_subjects() {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
|
||||
$options = array('course' => $course->id, 'forcesubscribe' => FORUM_FORCESUBSCRIBE);
|
||||
$forum = $this->getDataGenerator()->create_module('forum', $options);
|
||||
|
||||
list($author) = $this->helper_create_users($course, 1);
|
||||
list($commenter) = $this->helper_create_users($course, 1);
|
||||
|
||||
$strre = get_string('re', 'forum');
|
||||
|
||||
// New posts should not have Re: in the subject.
|
||||
list($discussion, $post) = $this->helper_post_to_forum($forum, $author);
|
||||
$messages = $this->helper_run_cron_check_count($post, 2);
|
||||
$this->assertNotContains($strre, $messages[0]->subject);
|
||||
|
||||
// Replies should have Re: in the subject.
|
||||
$reply = $this->helper_post_to_discussion($forum, $discussion, $commenter);
|
||||
$messages = $this->helper_run_cron_check_count($reply, 2);
|
||||
$this->assertContains($strre, $messages[0]->subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* dataProvider for test_forum_post_email_templates().
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user