mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-12 03:34:04 +02:00
[ticket/13713] Fix priorities
PHPBB3-13713
This commit is contained in:
@@ -15,18 +15,38 @@ namespace phpbb\mention\source;
|
||||
|
||||
class topic extends base_user
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_priority($row)
|
||||
{
|
||||
/*
|
||||
* Topic's open poster is probably the most mentionable user in the topic
|
||||
* so we give him a significant priority
|
||||
*/
|
||||
if ($row['user_id'] === $row['topic_poster'])
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function query($keyword, $topic_id)
|
||||
{
|
||||
/*
|
||||
* Select poster's username together with topic author's ID
|
||||
* that will be later used for priotirisation
|
||||
*
|
||||
* For optimization purposes all users are returned regardless of the keyword
|
||||
* Names filtering is done on the frontend
|
||||
* Results will be cached on a per-topic basis
|
||||
*/
|
||||
$query = $this->db->sql_build_query('SELECT', [
|
||||
'SELECT' => 'u.username, u.user_id',
|
||||
'SELECT' => 'u.username, u.user_id, t.topic_poster',
|
||||
'FROM' => [
|
||||
USERS_TABLE => 'u',
|
||||
],
|
||||
@@ -34,7 +54,11 @@ class topic extends base_user
|
||||
[
|
||||
'FROM' => [POSTS_TABLE => 'p'],
|
||||
'ON' => 'u.user_id = p.poster_id'
|
||||
]
|
||||
],
|
||||
[
|
||||
'FROM' => [TOPICS_TABLE => 't'],
|
||||
'ON' => 't.topic_id = p.topic_id'
|
||||
],
|
||||
],
|
||||
'WHERE' => 'p.topic_id = ' . $topic_id . '
|
||||
AND ' . $this->db->sql_in_set('u.user_type', [USER_NORMAL, USER_FOUNDER]),
|
||||
|
Reference in New Issue
Block a user