Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Added User Search Functionality

Cette révision appartient à :
akuma06 2017-05-09 04:30:21 +02:00
Parent e845009057
révision c15ec0c551

Voir le fichier

@ -37,6 +37,7 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
search_param.Status = r.URL.Query().Get("s")
search_param.Sort = r.URL.Query().Get("sort")
search_param.Order = r.URL.Query().Get("order")
userId := r.URL.Query().Get("userId")
catsSplit := strings.Split(search_param.Category, "_")
// need this to prevent out of index panics
@ -85,6 +86,10 @@ func SearchByQuery(r *http.Request, pagenum int) (SearchParam, []model.Torrents,
conditions = append(conditions, "sub_category = ?")
parameters.Params = append(parameters.Params, searchSubCatId)
}
if userId != "" {
conditions = append(conditions, "uploader = ?")
parameters.Params = append(parameters.Params, userId)
}
if search_param.Status != "" {
if search_param.Status == "2" {
conditions = append(conditions, "status != ?")