Browse Source

FIX add nickname lastname query conditions for list users api

tags/v3.0.4(standalone)
jasder 5 years ago
parent
commit
2f9d583fac
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      app/models/user.rb

+ 2
- 1
app/models/user.rb View File

@@ -168,7 +168,8 @@ class User < Owner
# Groups and active users
scope :active, lambda { where(status: STATUS_ACTIVE) }
scope :like, lambda { |keywords|
where("LOWER(concat(lastname, firstname, login, mail)) LIKE ?", "%#{keywords.split(" ").join('|')}%") unless keywords.blank?
sql = "CONCAT(lastname, firstname) LIKE :keyword OR login LIKE :keyword OR mail LIKE :keyword OR nickname LIKE :keyword"
where(sql, :search => "%#{keywords.split(" ").join('|')}%") unless keywords.blank?
}

scope :simple_select, -> {select(:id, :login, :lastname,:firstname, :nickname, :gitea_uid, :type)}


Loading…
Cancel
Save