aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/feed.php4
-rw-r--r--phpBB/phpbb/feed/forum.php1
-rw-r--r--phpBB/phpbb/feed/topic.php7
-rw-r--r--tests/functional/feed_test.php21
4 files changed, 20 insertions, 13 deletions
diff --git a/phpBB/feed.php b/phpBB/feed.php
index 0c4cc32fdb..db0ed5364e 100644
--- a/phpBB/feed.php
+++ b/phpBB/feed.php
@@ -100,6 +100,8 @@ while ($row = $feed->get_item())
$published = ($feed->get('published') !== NULL) ? (int) $row[$feed->get('published')] : 0;
$updated = ($feed->get('updated') !== NULL) ? (int) $row[$feed->get('updated')] : 0;
+ $display_attachments = ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && isset($row['post_attachment']) && $row['post_attachment']) ? true : false;
+
$item_row = array(
'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '',
'published' => ($published > 0) ? $phpbb_feed_helper->format_date($published) : '',
@@ -108,7 +110,7 @@ while ($row = $feed->get_item())
'title' => censor_text($title),
'category' => ($config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '',
'category_name' => ($config['feed_item_statistics'] && isset($row['forum_name'])) ? $row['forum_name'] : '',
- 'description' => censor_text($phpbb_feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], ((isset($row['post_attachment']) && $row['post_attachment']) ? $feed->get_attachments($row['post_id']) : array()))),
+ 'description' => censor_text($phpbb_feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], ($display_attachments ? $feed->get_attachments($row['post_id']) : array()))),
'statistics' => '',
);
diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php
index 8e6490923d..e35ec4baa4 100644
--- a/phpBB/phpbb/feed/forum.php
+++ b/phpBB/phpbb/feed/forum.php
@@ -132,6 +132,7 @@ class forum extends \phpbb\feed\post_base
parent::adjust_item($item_row, $row);
$item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title'];
+ $item_row['forum_id'] = $this->forum_id;
}
function get_item()
diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php
index fb49aa65cc..10b0f4f645 100644
--- a/phpBB/phpbb/feed/topic.php
+++ b/phpBB/phpbb/feed/topic.php
@@ -105,6 +105,13 @@ class topic extends \phpbb\feed\post_base
return true;
}
+ function adjust_item(&$item_row, &$row)
+ {
+ parent::adjust_item($item_row, $row);
+
+ $item_row['forum_id'] = $this->forum_id;
+ }
+
function get_item()
{
return ($row = parent::get_item()) ? array_merge($this->topic_data, $row) : $row;
diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php
index b6287bf10f..86d3930a7b 100644
--- a/tests/functional/feed_test.php
+++ b/tests/functional/feed_test.php
@@ -1195,7 +1195,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
public function test_create_missing_attachment_post()
{
- $this->markTestIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418');
$this->login();
$this->load_ids(array(
'forums' => array(
@@ -1216,7 +1215,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
public function test_feeds_missing_attachment_admin()
{
- $this->markTestIncomplete('Missing attachments in posts/topics are not marked in feeds yet, see PHPBB3-12418');
$this->load_ids(array(
'forums' => array(
'Feeds #1',
@@ -1252,7 +1250,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
),
'overall' => array(
array(
- 'nb_entries' => 13,
+ 'nb_entries' => 12,
'contents' => array(
1 => 'Attachment #0',
),
@@ -1260,12 +1258,12 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
),
'topics' => array(
array(
- 'nb_entries' => 9,
+ 'nb_entries' => 8,
'attachments' => array(
1 => array( // First entry
array( // First attachment to fetch
'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0],
- 'displayed' => false,
+ 'displayed' => true,
),
),
),
@@ -1273,12 +1271,12 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
),
'topics_new' => array(
array(
- 'nb_entries' => 9,
+ 'nb_entries' => 8,
'attachments' => array(
1 => array( // First entry
array( // First attachment to fetch
'id' => $this->data['attachments'][$this->data['posts']['Feeds #1 - Topic #3']][0],
- 'displayed' => false,
+ 'displayed' => true,
),
),
),
@@ -1286,7 +1284,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
),
'topics_active' => array(
array(
- 'nb_entries' => 9,
+ 'nb_entries' => 8,
'contents' => array(
1 => 'Attachment #0',
),
@@ -1396,13 +1394,12 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
if ($attachment['displayed'])
{
$this->assertContains($url, $content, "Tested feed : 'feed.php{$params}'");
- // $this->assertNotContains($string, $content, "Tested feed : 'feed.php{$params}'");
+ $this->assertNotContains($string, $content, "Tested feed : 'feed.php{$params}'");
}
else
{
- // Disabled until PHPBB3-12421 is fixed and merged
- // $this->assertContains($string, $content, "Tested feed : 'feed.php{$params}'");
- // $this->assertNotContains($url, $content, "Tested feed : 'feed.php{$params}'");
+ $this->assertContains($string, $content, "Tested feed : 'feed.php{$params}'");
+ $this->assertNotContains($url, $content, "Tested feed : 'feed.php{$params}'");
}
}
}