From 9f09dec049a0600a7b7ca38651c42983bb1e5895 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 22 Jan 2022 22:23:17 +0100 Subject: [PATCH 1/2] [ticket/13821] Support displaying ignored posts on post review page PHPBB3-13821 --- phpBB/includes/functions_posting.php | 10 +++++----- phpBB/language/en/common.php | 1 + phpBB/styles/prosilver/template/ajax.js | 11 +++++++++++ phpBB/styles/prosilver/template/posting_review.html | 3 ++- .../prosilver/template/posting_topic_review.html | 6 ++++-- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 971bdfe475..df5de6230a 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1253,11 +1253,11 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), - 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, - 'S_FRIEND' => ($row['friend']) ? true : false, - 'S_IGNORE_POST' => ($row['foe']) ? true : false, - 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "", '') : '', - 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false, + 'S_HAS_ATTACHMENTS' => !empty($attachments[$row['post_id']]), + 'S_FRIEND' => (bool) $row['friend'], + 'S_IGNORE_POST' => (bool) $row['foe'], + 'L_IGNORE_POST' => $row['foe'] ? $user->lang('POST_BY_FOE', get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "", '') : '', + 'S_POST_DELETED' => $row['post_visibility'] == ITEM_DELETED, 'L_DELETE_POST' => $l_deleted_message, 'POST_SUBJECT' => $post_subject, diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 7443f27be3..a01ae3328f 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -604,6 +604,7 @@ $lang = array_merge($lang, array( 'POST_BY_AUTHOR' => 'by', 'POST_BY_FOE' => '%1$s, who is currently on your ignore list, made this post.', 'POST_DISPLAY' => '%1$sDisplay this post%2$s.', + 'POST_DISPLAY_TEXT' => 'Display this post', 'POST_DAY' => '%.2f posts per day', 'POST_DELETED_ACTION' => 'Deleted post:', 'POST_DELETED' => 'This post has been deleted.', diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 5e66e5cda1..db2a5732f7 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -361,6 +361,17 @@ $('.display_post').click(function(e) { $('#post_hidden' + postId).hide(); }); +/** + * Display hidden post on post review page + */ +$('.display_post_review').on('click', function(e) { + e.preventDefault(); + + let $displayPostLink = $(this); + $displayPostLink.closest('.post-ignore').removeClass('post-ignore'); + $displayPostLink.hide(); +}); + /** * Toggle the member search panel in memberlist.php. * diff --git a/phpBB/styles/prosilver/template/posting_review.html b/phpBB/styles/prosilver/template/posting_review.html index e5d285e7bf..eb724d766f 100644 --- a/phpBB/styles/prosilver/template/posting_review.html +++ b/phpBB/styles/prosilver/template/posting_review.html @@ -6,7 +6,8 @@
- {post_review_row.L_IGNORE_POST} + {post_review_row.L_IGNORE_POST}
+ {{ lang('POST_DISPLAY_TEXT') }}
diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 209dadf327..57c430d191 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -13,11 +13,13 @@
- {topic_review_row.L_IGNORE_POST} + {topic_review_row.L_IGNORE_POST}
+ {{ lang('POST_DISPLAY_TEXT') }}
- {topic_review_row.L_DELETE_POST} + {topic_review_row.L_DELETE_POST}
+ {{ lang('POST_DISPLAY_TEXT') }}
From 97356d9879f24e8edbc707fc9acb4644273dfe39 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 22 Jan 2022 23:50:33 +0100 Subject: [PATCH 2/2] [ticket/13821] Remove HTML from PHP files and deduplicate lang variable PHPBB3-13821 --- phpBB/language/en/common.php | 3 +-- phpBB/styles/prosilver/template/posting_review.html | 2 +- phpBB/styles/prosilver/template/posting_topic_review.html | 4 ++-- phpBB/styles/prosilver/template/viewtopic_body.html | 8 ++++---- phpBB/viewtopic.php | 2 +- tests/functional/download_test.php | 2 +- tests/functional/feed_test.php | 2 +- tests/functional/visibility_softdelete_test.php | 4 ++-- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a01ae3328f..4dc3f3f531 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -603,8 +603,7 @@ $lang = array_merge($lang, array( 'POSTS_UNAPPROVED_FORUM'=> 'At least one post in this forum has not been approved.', 'POST_BY_AUTHOR' => 'by', 'POST_BY_FOE' => '%1$s, who is currently on your ignore list, made this post.', - 'POST_DISPLAY' => '%1$sDisplay this post%2$s.', - 'POST_DISPLAY_TEXT' => 'Display this post', + 'POST_DISPLAY' => 'Display this post', 'POST_DAY' => '%.2f posts per day', 'POST_DELETED_ACTION' => 'Deleted post:', 'POST_DELETED' => 'This post has been deleted.', diff --git a/phpBB/styles/prosilver/template/posting_review.html b/phpBB/styles/prosilver/template/posting_review.html index eb724d766f..1355bd32b8 100644 --- a/phpBB/styles/prosilver/template/posting_review.html +++ b/phpBB/styles/prosilver/template/posting_review.html @@ -7,7 +7,7 @@
{post_review_row.L_IGNORE_POST}
- {{ lang('POST_DISPLAY_TEXT') }} + {{ lang('POST_DISPLAY') }}
diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 57c430d191..e6692b1729 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -14,12 +14,12 @@
{topic_review_row.L_IGNORE_POST}
- {{ lang('POST_DISPLAY_TEXT') }} + {{ lang('POST_DISPLAY') }}
{topic_review_row.L_DELETE_POST}
- {{ lang('POST_DISPLAY_TEXT') }} + {{ lang('POST_DISPLAY') }}
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index e4d7ff2705..198304e293 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -211,13 +211,13 @@
- {postrow.L_POST_DELETED_MESSAGE}
- {postrow.L_POST_DISPLAY} + {postrow.L_POST_DELETED_MESSAGE}
+ {{ lang('POST_DISPLAY') }}
- {postrow.L_IGNORE_POST}
- {postrow.L_POST_DISPLAY} + {postrow.L_IGNORE_POST}
+ {{ lang('POST_DISPLAY') }}
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 5ad75d6170..bdc28731d7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -2077,6 +2077,7 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i) 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&p=' . $row['post_id'], true, $user->session_id) : '', 'U_MCP_RESTORE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_data['topic_visibility'] != ITEM_DELETED) ? 'deleted_posts' : 'deleted_topics') . '&p=' . $row['post_id'], true, $user->session_id) : '', 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'], + 'U_MINI_POST_VIEW' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '&view=show#p' . $row['post_id'], 'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '', 'U_PREV_POST_ID' => $prev_post_id, 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '', @@ -2106,7 +2107,6 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i) 'S_IGNORE_POST' => ($row['foe']) ? true : false, 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '', 'S_POST_HIDDEN' => $row['hide_post'], - 'L_POST_DISPLAY' => ($row['hide_post']) ? $user->lang('POST_DISPLAY', '', '') : '', 'S_DELETE_PERMANENT' => $permanent_delete_allowed, ); diff --git a/tests/functional/download_test.php b/tests/functional/download_test.php index f7b85c5dcd..89652fd875 100644 --- a/tests/functional/download_test.php +++ b/tests/functional/download_test.php @@ -115,7 +115,7 @@ class phpbb_functional_download_test extends phpbb_functional_test_case $this->assertContainsLang('POST_DELETED', $crawler->text()); $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Download Topic #1']}&sid={$this->sid}"); - $this->assertStringContainsString($this->lang('POST_DISPLAY', '', ''), $crawler->text()); + $this->assertStringContainsString($this->lang('POST_DISPLAY'), $crawler->text()); } public function test_download_softdeleted_post() diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 5a603d3175..157aaae9e8 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -532,7 +532,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case self::assertContainsLang('POST_DELETED', $crawler->text()); $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1 - Topic #2']}&sid={$this->sid}"); - self::assertStringContainsString($this->lang('POST_DISPLAY', '', ''), $crawler->text()); + self::assertStringContainsString($this->lang('POST_DISPLAY'), $crawler->text()); } public function test_feeds_softdeleted_post_admin() diff --git a/tests/functional/visibility_softdelete_test.php b/tests/functional/visibility_softdelete_test.php index 4eba77ba1b..5128bb6005 100644 --- a/tests/functional/visibility_softdelete_test.php +++ b/tests/functional/visibility_softdelete_test.php @@ -177,7 +177,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ ), 'after softdelete'); $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - $this->assertStringContainsString($this->lang('POST_DISPLAY', '', ''), $crawler->text()); + $this->assertStringContainsString($this->lang('POST_DISPLAY'), $crawler->text()); } public function test_softdelete_post_no_m_delete() @@ -227,7 +227,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ ), 'after softdelete without m_delete'); $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}"); - $this->assertStringContainsString($this->lang('POST_DISPLAY', '', ''), $crawler->text()); + $this->assertStringContainsString($this->lang('POST_DISPLAY'), $crawler->text()); } public function test_move_softdeleted_post()