Hide unactive on explore users and some refactors (#2741)
* hide unactive on explore users and some refactors * fix test for removed Organizations * fix test for removed Organizations * fix imports * fix logic bug * refactor the toConds * Rename TestOrganizations to TestSearchUsers and add tests for users * fix other tests * fix other tests * fix watchers tests * fix comments and remove unused code
This commit is contained in:
parent
03900303a9
commit
6eeadb2082
15 changed files with 143 additions and 151 deletions
|
@ -201,23 +201,6 @@ func CountOrganizations() int64 {
|
|||
return count
|
||||
}
|
||||
|
||||
// Organizations returns number of organizations in given page.
|
||||
func Organizations(opts *SearchUserOptions) ([]*User, error) {
|
||||
orgs := make([]*User, 0, opts.PageSize)
|
||||
|
||||
if len(opts.OrderBy) == 0 {
|
||||
opts.OrderBy = "name ASC"
|
||||
}
|
||||
|
||||
sess := x.
|
||||
Limit(opts.PageSize, (opts.Page-1)*opts.PageSize).
|
||||
Where("type=1")
|
||||
|
||||
return orgs, sess.
|
||||
OrderBy(opts.OrderBy).
|
||||
Find(&orgs)
|
||||
}
|
||||
|
||||
// DeleteOrganization completely and permanently deletes everything of organization.
|
||||
func DeleteOrganization(org *User) (err error) {
|
||||
sess := x.NewSession()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue