1
0

Implemented search for everything (#17)

This commit is contained in:
konrad
2018-11-09 17:33:06 +00:00
committed by Gitea
parent ad74d24ee2
commit d3de658882
18 changed files with 49 additions and 32 deletions

View File

@ -53,7 +53,7 @@ func (n *Namespace) ReadOne() (err error) {
}
// ReadAll gets all namespaces a user has access to
func (n *Namespace) ReadAll(doer *User, page int) (interface{}, error) {
func (n *Namespace) ReadAll(search string, doer *User, page int) (interface{}, error) {
type namespaceWithLists struct {
Namespace `xorm:"extends"`
@ -72,6 +72,7 @@ func (n *Namespace) ReadAll(doer *User, page int) (interface{}, error) {
Or("users_namespace.user_id = ?", doer.ID).
GroupBy("namespaces.id").
Limit(getLimitFromPageIndex(page)).
Where("namespaces.name LIKE ?", "%"+search+"%").
Find(&all)
if err != nil {