Bugfix on member search page

This commit is contained in:
Noah Petherbridge 2024-08-23 23:34:12 -07:00
parent 36e48f6ce0
commit def9f6ddcf
2 changed files with 6 additions and 4 deletions

View File

@ -66,8 +66,10 @@ func Forum() http.HandlerFunc {
return return
} }
// Inject pinned threads on top. // Inject pinned threads on top of the first page.
threads = append(pinned, threads...) if pager.Page == 1 {
threads = append(pinned, threads...)
}
// Map the statistics (replies, views) of these threads. // Map the statistics (replies, views) of these threads.
threadMap := models.MapThreadStatistics(threads) threadMap := models.MapThreadStatistics(threads)

View File

@ -343,13 +343,13 @@ func SearchUsers(user *User, search *UserSearch, pager *Pagination) ([]*User, er
} }
if len(blockedUserIDs) > 0 { if len(blockedUserIDs) > 0 {
wheres = append(wheres, "id NOT IN ?") wheres = append(wheres, "users.id NOT IN ?")
placeholders = append(placeholders, blockedUserIDs) placeholders = append(placeholders, blockedUserIDs)
} }
if search.Username != "" { if search.Username != "" {
ilike := "%" + strings.TrimSpace(strings.ToLower(search.Username)) + "%" ilike := "%" + strings.TrimSpace(strings.ToLower(search.Username)) + "%"
wheres = append(wheres, "(username LIKE ? OR name ILIKE ?)") wheres = append(wheres, "(users.username LIKE ? OR users.name ILIKE ?)")
placeholders = append(placeholders, ilike, ilike) placeholders = append(placeholders, ilike, ilike)
} }