mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 13:48:55 +00:00
Merge pull request #2373 from Nicofuma/ticket/12459
[ticket/12459] Unapproved posts/topics are not correctly handled in feeds * Nicofuma/ticket/12459: [ticket/12459] Change language strings [ticket/12459] Enable related tests [ticket/12459] Fix: Differentiating unapproved and deleted posts [ticket/12459] Fix: Soft deleted topics should appear in feeds [ticket/12459] Fix: the posts were always marked as unapproved
This commit is contained in:
commit
c7d29fbdb1
9 changed files with 47 additions and 44 deletions
|
@ -555,7 +555,8 @@ $lang = array_merge($lang, array(
|
|||
'POST_BY_FOE' => '<strong>%1$s</strong>, who is currently on your ignore list, made this post.',
|
||||
'POST_DISPLAY' => '%1$sDisplay this post%2$s.',
|
||||
'POST_DAY' => '%.2f posts per day',
|
||||
'POST_DELETED' => 'Deleted post:',
|
||||
'POST_DELETED_ACTION' => 'Deleted post:',
|
||||
'POST_DELETED' => 'This post has been deleted.',
|
||||
'POST_DELETED_BY' => '<strong>%2$s</strong> deleted the post by <strong>%1$s</strong> on %3$s.',
|
||||
'POST_DELETED_BY_REASON'=> '<strong>%2$s</strong> deleted the post by <strong>%1$s</strong> on %3$s for the following reason: %4$s',
|
||||
'POST_DETAILS' => 'Post details',
|
||||
|
@ -568,7 +569,8 @@ $lang = array_merge($lang, array(
|
|||
'POST_SUBJECT' => 'Post subject',
|
||||
'POST_TIME' => 'Post time',
|
||||
'POST_TOPIC' => 'Post a new topic',
|
||||
'POST_UNAPPROVED' => 'Post awaiting approval:',
|
||||
'POST_UNAPPROVED_ACTION' => 'Post awaiting approval:',
|
||||
'POST_UNAPPROVED' => 'This post has not been approved.',
|
||||
'POWERED_BY' => 'Powered by %s',
|
||||
'PREVIEW' => 'Preview',
|
||||
'PREVIOUS' => 'Previous', // Used in pagination
|
||||
|
@ -738,7 +740,8 @@ $lang = array_merge($lang, array(
|
|||
'TOPIC_MOVED' => 'Moved topic',
|
||||
'TOPIC_REVIEW' => 'Topic review',
|
||||
'TOPIC_TITLE' => 'Topic title',
|
||||
'TOPIC_UNAPPROVED' => 'This topic has not been approved',
|
||||
'TOPIC_UNAPPROVED' => 'This topic has not been approved.',
|
||||
'TOPIC_DELETED' => 'This topic has been deleted.',
|
||||
'TOTAL_ATTACHMENTS' => 'Attachment(s)',
|
||||
'TOTAL_LOGS' => array(
|
||||
1 => '%d log',
|
||||
|
|
|
@ -64,9 +64,8 @@ class news extends \phpbb\feed\topic_base
|
|||
// We really have to get the post ids first!
|
||||
$sql = 'SELECT topic_first_post_id, topic_time
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
|
||||
AND topic_moved_id = 0
|
||||
AND topic_visibility = ' . ITEM_APPROVED . '
|
||||
WHERE topic_moved_id = 0
|
||||
AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . '
|
||||
ORDER BY topic_time DESC';
|
||||
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||
|
||||
|
@ -85,7 +84,7 @@ class news extends \phpbb\feed\topic_base
|
|||
$this->sql = array(
|
||||
'SELECT' => 'f.forum_id, f.forum_name,
|
||||
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time,
|
||||
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment',
|
||||
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, t.topic_visibility',
|
||||
'FROM' => array(
|
||||
TOPICS_TABLE => 't',
|
||||
POSTS_TABLE => 'p',
|
||||
|
|
|
@ -46,7 +46,8 @@ abstract class post_base extends \phpbb\feed\attachments_base
|
|||
{
|
||||
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
||||
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
|
||||
. (($this->is_moderator_approve_forum($row['forum_id']) && $row['post_visibility'] !== ITEM_APPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '');
|
||||
. (($this->is_moderator_approve_forum($row['forum_id']) && (int)$row['post_visibility'] === ITEM_UNAPPROVED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_UNAPPROVED'] : '')
|
||||
. (($this->is_moderator_approve_forum($row['forum_id']) && (int)$row['post_visibility'] === ITEM_DELETED) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POST_DELETED'] : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,9 +45,24 @@ abstract class topic_base extends \phpbb\feed\attachments_base
|
|||
{
|
||||
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
||||
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
|
||||
. ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . $this->content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1
|
||||
. ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views']
|
||||
. (($this->is_moderator_approve_forum($row['forum_id']) && $row['topic_posts_unapproved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : '');
|
||||
. ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . ($this->content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1)
|
||||
. ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views'];
|
||||
|
||||
if ($this->is_moderator_approve_forum($row['forum_id']))
|
||||
{
|
||||
if ( (int)$row['topic_visibility'] === ITEM_DELETED)
|
||||
{
|
||||
$item_row['statistics'] .= ' ' . $this->separator_stats . ' ' . $this->user->lang['TOPIC_DELETED'];
|
||||
}
|
||||
else if ((int)$row['topic_visibility'] === ITEM_UNAPPROVED)
|
||||
{
|
||||
$item_row['statistics'] .= ' ' . $this->separator_stats . ' ' . $this->user->lang['TOPIC_UNAPPROVED'];
|
||||
}
|
||||
else if ($row['topic_posts_unapproved'])
|
||||
{
|
||||
$item_row['statistics'] .= ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,9 +36,8 @@ class topics extends \phpbb\feed\topic_base
|
|||
// We really have to get the post ids first!
|
||||
$sql = 'SELECT topic_first_post_id, topic_time
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
|
||||
AND topic_moved_id = 0
|
||||
AND topic_visibility = ' . ITEM_APPROVED . '
|
||||
WHERE topic_moved_id = 0
|
||||
AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . '
|
||||
ORDER BY topic_time DESC';
|
||||
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||
|
||||
|
@ -57,7 +56,7 @@ class topics extends \phpbb\feed\topic_base
|
|||
$this->sql = array(
|
||||
'SELECT' => 'f.forum_id, f.forum_name,
|
||||
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time,
|
||||
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment',
|
||||
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, t.topic_visibility',
|
||||
'FROM' => array(
|
||||
TOPICS_TABLE => 't',
|
||||
POSTS_TABLE => 'p',
|
||||
|
|
|
@ -51,9 +51,8 @@ class topics_active extends \phpbb\feed\topic_base
|
|||
// We really have to get the post ids first!
|
||||
$sql = 'SELECT topic_last_post_id, topic_last_post_time
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('forum_id', $in_fid_ary) . '
|
||||
AND topic_moved_id = 0
|
||||
AND topic_visibility = ' . ITEM_APPROVED . '
|
||||
WHERE topic_moved_id = 0
|
||||
AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . '
|
||||
' . $last_post_time_sql . '
|
||||
ORDER BY topic_last_post_time DESC';
|
||||
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||
|
@ -74,7 +73,7 @@ class topics_active extends \phpbb\feed\topic_base
|
|||
'SELECT' => 'f.forum_id, f.forum_name,
|
||||
t.topic_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views,
|
||||
t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time,
|
||||
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment',
|
||||
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, t.topic_visibility',
|
||||
'FROM' => array(
|
||||
TOPICS_TABLE => 't',
|
||||
POSTS_TABLE => 'p',
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
<!-- IF postrow.S_POST_UNAPPROVED -->
|
||||
<form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}">
|
||||
<p class="post-notice unapproved">
|
||||
<strong>{L_POST_UNAPPROVED}</strong>
|
||||
<strong>{L_POST_UNAPPROVED_ACTION}</strong>
|
||||
<input class="button2" type="submit" value="{L_DISAPPROVE}" name="action[disapprove]" />
|
||||
<input class="button1" type="submit" value="{L_APPROVE}" name="action[approve]" />
|
||||
<input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
|
||||
|
@ -224,7 +224,7 @@
|
|||
<!-- ELSEIF postrow.S_POST_DELETED -->
|
||||
<form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}">
|
||||
<p class="post-notice deleted">
|
||||
<strong>{L_POST_DELETED}</strong>
|
||||
<strong>{L_POST_DELETED_ACTION}</strong>
|
||||
<input class="button2" type="submit" value="{L_DELETE}" name="action[disapprove]" />
|
||||
<input class="button1" type="submit" value="{L_RESTORE}" name="action[restore]" />
|
||||
<input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
|
||||
|
|
|
@ -480,7 +480,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_create_softdelete_post()
|
||||
{
|
||||
$this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460');
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
|
@ -504,7 +503,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_softdelete_post()
|
||||
{
|
||||
$this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460');
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
|
@ -532,7 +530,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_feeds_softdeleted_post_admin()
|
||||
{
|
||||
$this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1',
|
||||
|
@ -575,7 +572,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_feeds_softdeleted_post_guest()
|
||||
{
|
||||
$this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1',
|
||||
|
@ -609,7 +605,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_softdelete_topic()
|
||||
{
|
||||
$this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460');
|
||||
$this->login();
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
|
@ -639,7 +634,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_feeds_softdeleted_topic_admin()
|
||||
{
|
||||
$this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1',
|
||||
|
@ -709,7 +703,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_feeds_softdeleted_topic_guest()
|
||||
{
|
||||
$this->markTestIncomplete('Softdeleted posts/topics are not marked in feeds yet, see PHPBB3-12460');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1',
|
||||
|
@ -758,7 +751,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_create_unapproved_post()
|
||||
{
|
||||
$this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1.1',
|
||||
|
@ -780,7 +772,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_feeds_unapproved_post_admin()
|
||||
{
|
||||
$this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1.1',
|
||||
|
@ -823,7 +814,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_feeds_unapproved_post_disapprove_user()
|
||||
{
|
||||
$this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1.1',
|
||||
|
@ -857,7 +847,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_create_unapproved_topic()
|
||||
{
|
||||
$this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1.1',
|
||||
|
@ -877,7 +866,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_feeds_unapproved_topic_admin()
|
||||
{
|
||||
$this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1.1',
|
||||
|
@ -944,7 +932,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
|
||||
public function test_feeds_unapproved_topic_disapprove_user()
|
||||
{
|
||||
$this->markTestIncomplete('Unapproved posts/topics are not marked in feeds yet, see PHPBB3-12459');
|
||||
$this->load_ids(array(
|
||||
'forums' => array(
|
||||
'Feeds #1.1',
|
||||
|
@ -1026,7 +1013,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
$this->assert_feeds(array(
|
||||
'f' => array(
|
||||
array(
|
||||
'nb_entries' => 2,
|
||||
'nb_entries' => 4,
|
||||
'id' => $this->data['forums']['Feeds #1'],
|
||||
'attachments' => array(
|
||||
1 => array( // First entry
|
||||
|
@ -1054,7 +1041,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
),
|
||||
'overall' => array(
|
||||
array(
|
||||
'nb_entries' => 6,
|
||||
'nb_entries' => 11,
|
||||
'attachments' => array(
|
||||
1 => array( // First entry
|
||||
array( // First attachment to fetch
|
||||
|
@ -1067,7 +1054,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
),
|
||||
'topics' => array(
|
||||
array(
|
||||
'nb_entries' => 5,
|
||||
'nb_entries' => 8,
|
||||
'attachments' => array(
|
||||
1 => array( // First entry
|
||||
array( // First attachment to fetch
|
||||
|
@ -1080,7 +1067,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
),
|
||||
'topics_new' => array(
|
||||
array(
|
||||
'nb_entries' => 5,
|
||||
'nb_entries' => 8,
|
||||
'attachments' => array(
|
||||
1 => array( // First entry
|
||||
array( // First attachment to fetch
|
||||
|
@ -1093,7 +1080,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
),
|
||||
'topics_active' => array(
|
||||
array(
|
||||
'nb_entries' => 5,
|
||||
'nb_entries' => 8,
|
||||
'attachments' => array(
|
||||
1 => array( // First entry
|
||||
array( // First attachment to fetch
|
||||
|
@ -1153,7 +1140,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
),
|
||||
'overall' => array(
|
||||
array(
|
||||
'nb_entries' => 6,
|
||||
'nb_entries' => 7,
|
||||
'attachments' => array(
|
||||
1 => array( // First entry
|
||||
array( // First attachment to fetch
|
||||
|
@ -1166,7 +1153,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
),
|
||||
'topics' => array(
|
||||
array(
|
||||
'nb_entries' => 5,
|
||||
'nb_entries' => 6,
|
||||
'attachments' => array(
|
||||
1 => array( // First entry
|
||||
array( // First attachment to fetch
|
||||
|
@ -1179,7 +1166,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
),
|
||||
'topics_new' => array(
|
||||
array(
|
||||
'nb_entries' => 5,
|
||||
'nb_entries' => 6,
|
||||
'attachments' => array(
|
||||
1 => array( // First entry
|
||||
array( // First attachment to fetch
|
||||
|
@ -1192,7 +1179,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
|||
),
|
||||
'topics_active' => array(
|
||||
array(
|
||||
'nb_entries' => 5,
|
||||
'nb_entries' => 6,
|
||||
'attachments' => array(
|
||||
1 => array( // First entry
|
||||
array( // First attachment to fetch
|
||||
|
|
|
@ -608,7 +608,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
|||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
$this->assertContains('Soft Delete Topic #1', $crawler->filter('h2')->text());
|
||||
$this->assertContainsLang('POST_DELETED', $crawler->filter('body')->text());
|
||||
$this->assertContainsLang('POST_DELETED_ACTION', $crawler->filter('body')->text());
|
||||
|
||||
$this->assert_forum_details($this->data['forums']['Soft Delete #1'], array(
|
||||
'forum_posts_approved' => 1,
|
||||
|
|
Loading…
Add table
Reference in a new issue