Skip to content

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

Merged
MorrisJobke merged 2 commits into
masterfrom
fix/noid/search-in-group-displayname-email
Aug 5, 2020
Merged

Search also the email and displayname in user mangement for groups#21138
MorrisJobke merged 2 commits into
masterfrom
fix/noid/search-in-group-displayname-email

Conversation

@MorrisJobke

@MorrisJobkeMorrisJobke commented May 28, 2020

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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
MorrisJobkeforce-pushed the fix/noid/search-in-group-displayname-email branch 2 times, most recently from a0a1a95 to 8d72bdfCompareAugust 4, 2020 15:30
@MorrisJobke

Copy link
Copy Markdown
MemberAuthor

[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
Copy Markdown
Member

@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
Copy Markdown
MemberAuthor

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

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

@nickvergessennickvergessen left a comment

Copy link
Copy Markdown
Member

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?

Comment threadlib/private/Group/Database.php Outdated
Comment threadlib/private/Group/Database.php Outdated
Comment threadlib/private/Group/Database.php Outdated
@MorrisJobke

Copy link
Copy Markdown
MemberAuthor

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.

Comment threadbuild/integration/features/provisioning-v2.feature Outdated
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
@MorrisJobke
MorrisJobkeforce-pushed the fix/noid/search-in-group-displayname-email branch from 9bf1352 to 907d354CompareAugust 5, 2020 12:14
@MorrisJobke

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

/backport to stable19

@jancborchardt

Copy link
Copy Markdown
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
Copy Markdown
MemberAuthor

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

faily-botBot commented Aug 5, 2020

Copy link
Copy Markdown

🤖 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
Copy Markdown
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
Copy Markdown
MemberAuthor

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
Copy Markdown
Member

@blizzz Does a backport make sense here?

yes (:

@blizzz

Copy link
Copy Markdown
Member

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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@MorrisJobke@blizzz@skjnldsv@jancborchardt@nickvergessen@juliusknorr