diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 05960a0..4a9c46a 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -1231,7 +1231,7 @@ function template_preprocess_forum_topic_list(&$variables) { $variables['topics'][$id]->new_text = ''; $variables['topics'][$id]->new_url = ''; if ($topic->new_replies) { - $variables['topics'][$id]->new_text = format_plural($topic->new_replies, '1 new post in topic %title', '@count new posts in topic %title', array('%title' => $original_title)); + $variables['topics'][$id]->new_text = format_plural($topic->new_replies, '1 new post in topic %title', '@count new posts in topic %title', array('%title' => $variables['topics'][$id]->title)); $variables['topics'][$id]->new_url = url("node/$topic->nid", array('query' => comment_new_page_count($topic->comment_count, $topic->new_replies, $topic), 'fragment' => 'new')); } diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index f56cfbb..997117a 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -82,6 +82,7 @@ function setUp() { 'administer menu', 'administer taxonomy', 'create forum content', + 'access comments', )); $this->edit_any_topics_user = $this->drupalCreateUser(array( 'access administration pages', @@ -95,6 +96,13 @@ function setUp() { 'delete own forum content', )); $this->web_user = $this->drupalCreateUser(); + $this->post_comment_user = $this->drupalCreateUser(array( + 'administer content types', + 'create forum content', + 'post comments', + 'skip comment approval', + 'access comments', + )); } /** @@ -443,6 +451,35 @@ private function doBasicTests($user, $admin) { } /** + * Tests for notices on a rendered page. + */ + function testUndefinedVars() { + // Login as the first user. + $this->drupalLogin($this->admin_user); + // Create a forum container. + $this->container = $this->createForum('container'); + // Create a forum. + $this->forum = $this->createForum('forum'); + // Create a topic. + $node = $this->createForumTopic($this->forum, FALSE); + + // Login as a second user. + $this->drupalLogin($this->post_comment_user); + // Post a reply to the topic. + $edit = array(); + $edit['subject'] = $this->randomName(); + $edit['comment_body[' . LANGUAGE_NOT_SPECIFIED . '][0][value]'] = $this->randomName(); + $this->drupalPost("node/$node->nid", $edit, t('Save')); + $this->assertResponse(200); + + // Login as the first user. + $this->drupalLogin($this->admin_user); + // Check that forum renders properly. + $this->drupalGet("forum/{$this->forum['tid']}"); + $this->assertResponse(200); + } + + /** * Creates a forum topic. * * @param array $forum