Implement co-maintainer search

Add an option to filter package search results by co-maintainer.

Partly fixes FS#45591.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2017-01-26 09:02:46 +01:00
parent 33095b3292
commit 6cb8c041bc
2 changed files with 9 additions and 0 deletions

View file

@ -670,6 +670,7 @@ function pkg_display_details($id=0, $row, $SID="") {
* B - package base name (exact match) * B - package base name (exact match)
* k - package keyword(s) * k - package keyword(s)
* m - package maintainer's username * m - package maintainer's username
* c - package co-maintainer's username
* s - package submitter's username * s - package submitter's username
* do_Orphans - boolean. whether to search packages * do_Orphans - boolean. whether to search packages
* without a maintainer * without a maintainer
@ -746,6 +747,13 @@ function pkg_search_page($SID="") {
/* Search by maintainer. */ /* Search by maintainer. */
$q_where .= "AND Users.Username = " . $dbh->quote($_GET['K']) . " "; $q_where .= "AND Users.Username = " . $dbh->quote($_GET['K']) . " ";
} }
elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "c") {
/* Search by co-maintainer. */
$q_where .= "AND EXISTS (SELECT * FROM PackageComaintainers ";
$q_where .= "INNER JOIN Users ON Users.ID = PackageComaintainers.UsersID ";
$q_where .= "WHERE PackageComaintainers.PackageBaseID = PackageBases.ID ";
$q_where .= "AND Users.Username = " . $dbh->quote($_GET['K']) . ")";
}
elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "s") { elseif (isset($_GET["SeB"]) && $_GET["SeB"] == "s") {
/* Search by submitter. */ /* Search by submitter. */
$q_where .= "AND SubmitterUID = " . intval(uid_from_username($_GET['K'])) . " "; $q_where .= "AND SubmitterUID = " . intval(uid_from_username($_GET['K'])) . " ";

View file

@ -9,6 +9,7 @@ $searchby = array(
'B' => __('Exact Package Base'), 'B' => __('Exact Package Base'),
'k' => __('Keywords'), 'k' => __('Keywords'),
'm' => __('Maintainer'), 'm' => __('Maintainer'),
'c' => __('Co-maintainer'),
's' => __('Submitter') 's' => __('Submitter')
); );