Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search also the email and displayname in user mangement for groups #21138

Merged
merged 2 commits into from
Aug 5, 2020

Conversation

MorrisJobke
Copy link
Member

@MorrisJobke MorrisJobke commented May 28, 2020

Similar to #17800 but also searches the email address.

This streamlines the search in groups with the one in users:

$query->select('uid', 'displayname')
->from($this->table, 'u')
->leftJoin('u', 'preferences', 'p', $query->expr()->andX(
$query->expr()->eq('userid', 'uid'),
$query->expr()->eq('appid', $query->expr()->literal('settings')),
$query->expr()->eq('configkey', $query->expr()->literal('email')))
)
// sqlite doesn't like re-using a single named parameter here
->where($query->expr()->iLike('uid', $query->createPositionalParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')))
->orWhere($query->expr()->iLike('displayname', $query->createPositionalParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')))
->orWhere($query->expr()->iLike('configvalue', $query->createPositionalParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')))
->orderBy($query->func()->lower('displayname'), 'ASC')
->orderBy('uid_lower', 'ASC')

See #13951

  • when testing this it doesn't show the results - but executing the query by hand finds the correct users. Any idea what causes the trouble here?

@blizzz
Copy link
Member

blizzz commented Aug 3, 2020

when testing this it doesn't show the results - but executing the query by hand finds the correct users. Any idea what causes the trouble here?

WFM ™️

@MorrisJobke MorrisJobke force-pushed the fix/noid/search-in-group-displayname-email branch 2 times, most recently from a0a1a95 to 8d72bdf Compare August 4, 2020 15:30
@MorrisJobke
Copy link
Member Author

[x] when testing this it doesn't show the results - but executing the query by hand finds the correct users. Any idea what causes the trouble here?

Works for me now.

Unfortunately the unified search made the search field unavailable for the user management. Thus I based this on commit 7b91cb5 which is the one right before the unified search got merged. Then we can still test this and work on a solution for this in 20.

@skjnldsv Is this the wanted behavior of the unified search? Because some apps (like the user management here or the app management) use this for filtering the current view.

@juliushaertl @nickvergessen @kesselb Mind to review this?

@blizzz Does a backport make sense here?

@skjnldsv
Copy link
Member

skjnldsv commented Aug 4, 2020

@skjnldsv Is this the wanted behavior of the unified search? Because some apps (like the user management here or the app management) use this for filtering the current view.

We're discussing this.
The apps are going to appear in the unified search #22102
For the users it's up to @jancborchardt

@MorrisJobke
Copy link
Member Author

For the users it's up to @jancborchardt

Same for app management, right? Because it's an admin task vs an normal use case. But up to @jancborchardt

@MorrisJobke MorrisJobke added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 5, 2020
Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a dedicated test added?

lib/private/Group/Database.php Outdated Show resolved Hide resolved
lib/private/Group/Database.php Outdated Show resolved Hide resolved
lib/private/Group/Database.php Outdated Show resolved Hide resolved
@MorrisJobke
Copy link
Member Author

Can we have a dedicated test added?

I added some integration tests to verify the outside view of this. Otherwise I need to have mocked so much, that it barely is useful in the future.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
@MorrisJobke MorrisJobke force-pushed the fix/noid/search-in-group-displayname-email branch from 9bf1352 to 907d354 Compare August 5, 2020 12:14
@MorrisJobke
Copy link
Member Author

I added some integration tests to verify the outside view of this. Otherwise I need to have mocked so much, that it barely is useful in the future.

I refined them a bit and they work locally. Also did some negative testing locally so that they actually indicate when something breaks and it is the case.

Ready for a final review :)

@MorrisJobke
Copy link
Member Author

/backport to stable19

@jancborchardt
Copy link
Member

Yep, so there we hit the other part of what we discussed – unified search works great overall, but it does have drawbacks when you are inside an app itself. There e.g. in Talk, Users and Apps, direct filtering of the content is nicer.

This is why in the spec we discussed that the apps which already have in-app search which do proper filtering:

  • Can move their in-app search/filter to the top of the navigation, just like Talk – this would work nicely here for User management as well as App management
  • Still get the benefit of the unified search in the top right.

Makes sense?

@MorrisJobke
Copy link
Member Author

This is why in the spec we discussed that the apps which already have in-app search which do proper filtering:

  • Can move their in-app search/filter to the top of the navigation, just like Talk – this would work nicely here for User management as well as App management
  • Still get the benefit of the unified search in the top right.

Makes sense?

How to differentiate then between the filter and the unified search? Or should we maybe move the filtering from the header into the actual app content?

@faily-bot
Copy link

faily-bot bot commented Aug 5, 2020

🤖 beep boop beep 🤖

Here are the logs for the failed build:

Status of 31405: failure

carddavtester-new-endpoint

  • clone failure

samba

  • clone failure

mysql5.6-php7.2

Show full log
There were 2 warnings:

1) Test\Files\ViewTest::testRenameFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static

2) Test\Files\ViewTest::testCopyFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static

--

There were 2 failures:

1) Test\Files\Storage\Wrapper\QuotaTest::testFWriteNotEnoughSpace
Failed asserting that 6 matches expected 3.

/drone/src/tests/lib/Files/Storage/Wrapper/QuotaTest.php:107

2) OCA\Files_Sharing\Tests\SharedMountTest::testPermissionMovedGroupShare with data set #110 ('folder', 21, 11)
Failed asserting that false is true.

/drone/src/apps/files_sharing/tests/SharedMountTest.php:367

postgres11-php7.2

Show full log
There were 2 warnings:

1) Test\Files\ViewTest::testRenameFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static

2) Test\Files\ViewTest::testCopyFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static

--

There was 1 failure:

1) OCA\Files_Versions\Tests\VersioningTest::testRestoreMovedShare
File content has not changed
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'version 2'
+'version 1'

/drone/src/apps/files_versions/tests/VersioningTest.php:729

@jancborchardt
Copy link
Member

How to differentiate then between the filter and the unified search? Or should we maybe move the filtering from the header into the actual app content?

Yep, as said:

Can move their in-app search/filter to the top of the navigation, just like Talk

;)

@MorrisJobke
Copy link
Member Author

Can move their in-app search/filter to the top of the navigation, just like Talk

Ah - I thought adding it to the "top navigation" (aka header) 🙈

@blizzz
Copy link
Member

blizzz commented Aug 5, 2020

@blizzz Does a backport make sense here?

yes (:

@blizzz
Copy link
Member

blizzz commented Aug 5, 2020

in Talk, Users and Apps, direct filtering of the content is nicer.

at least in Users search has to go via the server. Just too much to pull all of them into the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants