-
Notifications
You must be signed in to change notification settings - Fork 10
Compatibility with the DisplayLastPost extension by Aurelienazerty #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| use phpbb\template\template; | ||
| use phpbb\user; | ||
| use rxu\FirstPostOnEveryPage\event\listener as FirstPostOnEveryPage; | ||
| use Aurelienazerty\DisplayLastPost\event\listener as DisplayLastPost; | ||
| use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
|
||
| class listener implements EventSubscriberInterface | ||
|
|
@@ -42,6 +43,9 @@ class listener implements EventSubscriberInterface | |
|
|
||
| /** @var FirstPostOnEveryPage */ | ||
| protected $firstPostOnEveryPage; | ||
|
|
||
| /** @var DisplayLastPost */ | ||
| protected $displayLastPost; | ||
|
|
||
| /** @var boolean */ | ||
| protected $is_active = false; | ||
|
|
@@ -67,14 +71,16 @@ class listener implements EventSubscriberInterface | |
| * @param template $template | ||
| * @param db_interface $db | ||
| * @param FirstPostOnEveryPage $firstPostOnEveryPage | ||
| * @param DisplayLastPost $displayLastPost | ||
| */ | ||
| public function __construct( | ||
| user $user, | ||
| config $config, | ||
| request_interface $request, | ||
| template $template, | ||
| db_interface $db, | ||
| FirstPostOnEveryPage $firstPostOnEveryPage = null | ||
| FirstPostOnEveryPage $firstPostOnEveryPage = null, | ||
| DisplayLastPost $displayLastPost = null | ||
| ) | ||
| { | ||
| $this->user = $user; | ||
|
|
@@ -83,6 +89,7 @@ public function __construct( | |
| $this->template = $template; | ||
| $this->db = $db; | ||
| $this->firstPostOnEveryPage = $firstPostOnEveryPage; | ||
| $this->displayLastPost = $displayLastPost; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a tab here to fix alignment. |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -319,7 +326,13 @@ protected function get_post_number($default_sort_by, $default_sort_dir, $default | |
| $this->offset = $is_ascending ? 1 : 0; | ||
| } | ||
|
|
||
| return $this->first_post_num + ($is_ascending ? +$this->offset++ : -$this->offset++); | ||
| $return = $this->first_post_num + ($is_ascending ? +$this->offset++ : -$this->offset++); | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove the tabs on this empty line, same on line 334. |
||
| if ($this->displayLastPost !== null && $start) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move the |
||
| $return = $is_ascending ? $return - 1 : $return + 1; | ||
| } | ||
|
|
||
| return $return; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use tabs here to fix alignment.