-
Notifications
You must be signed in to change notification settings - Fork 198
Move users_picker profile custom picker to contacts #4231
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
base: main
Are you sure you want to change the base?
Conversation
|
Hi @julien-nc How do I test? What am I looking for. |
|
@SebastianKrupinski This adds a "profile picker" entry in the smart picker and a reference widget (link preview) for |
9090d67 to
4fb561f
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
@SebastianKrupinski I made a few more adjustments. CI is green. It is now ready to be tested. |
|
Dear @julien-nc, Thank you for your contribution!
That is correct for the part of searching. But once a reference is selected, there is no more check in ProfilePickerReferenceProvider. I suggest we test this specific scenario and see how the code behaves. I just want to have clarity on this point before the code goes into the main branch. |
|
@julien-nc on a higher level, what do you think about moving the app/code into server instead? The picker picks users, not contacts. There is nothing specific to contacts (or event teams) in the code. |
a8bdf1e to
686282e
Compare
|
@ChristophWurst Yes we can move it to server. I'd still like to have your opinion on the last changes. We now check the visibility of the profile fields with the ProfileManager. This respects the scopes and the visibility settings.
Now the preview can't display any information that would not be visible by clicking the link to browse the profile page. |
cbc1051 to
a7cc035
Compare
| $userDisplayName = $user->getDisplayName(); | ||
| $userEmail = $user->getEMailAddress(); | ||
| $userAvatarUrl = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $userId, 'size' => '64']); | ||
|
|
||
| $bioProperty = $account->getProperty(IAccountManager::PROPERTY_BIOGRAPHY); | ||
| $bio = null; | ||
| $fullBio = null; | ||
| if ($this->profileManager->isProfileFieldVisible(IAccountManager::PROPERTY_BIOGRAPHY, $user, $currentUser)) { | ||
| $fullBio = $bioProperty->getValue(); | ||
| $bio = $fullBio !== '' | ||
| ? (mb_strlen($fullBio) > 80 | ||
| ? (mb_substr($fullBio, 0, 80) . '...') | ||
| : $fullBio) | ||
| : null; | ||
| } | ||
| $headline = $account->getProperty(IAccountManager::PROPERTY_HEADLINE); | ||
| $location = $account->getProperty(IAccountManager::PROPERTY_ADDRESS); | ||
| $website = $account->getProperty(IAccountManager::PROPERTY_WEBSITE); | ||
| $organisation = $account->getProperty(IAccountManager::PROPERTY_ORGANISATION); | ||
| $role = $account->getProperty(IAccountManager::PROPERTY_ROLE); | ||
|
|
||
| // for clients who can't render the reference widgets | ||
| $reference->setTitle($userDisplayName); | ||
| $reference->setDescription($userEmail ?? $userDisplayName); | ||
| $reference->setImageUrl($userAvatarUrl); | ||
|
|
||
| $isLocationVisible = $this->profileManager->isProfileFieldVisible(IAccountManager::PROPERTY_ADDRESS, $user, $currentUser); | ||
|
|
||
| // for the Vue reference widget | ||
| $reference->setRichObject( | ||
| self::RICH_OBJECT_TYPE, | ||
| [ | ||
| 'user_id' => $userId, | ||
| 'title' => $userDisplayName, | ||
| 'subline' => $userEmail ?? $userDisplayName, | ||
| 'email' => $userEmail, | ||
| 'bio' => $bio, | ||
| 'full_bio' => $fullBio, | ||
| 'headline' => $this->profileManager->isProfileFieldVisible(IAccountManager::PROPERTY_HEADLINE, $user, $currentUser) ? $headline->getValue() : null, | ||
| 'location' => $isLocationVisible ? $location->getValue() : null, | ||
| 'location_url' => $isLocationVisible ? $this->getOpenStreetLocationUrl($location->getValue()) : null, | ||
| 'website' => $this->profileManager->isProfileFieldVisible(IAccountManager::PROPERTY_WEBSITE, $user, $currentUser) ? $website->getValue() : null, | ||
| 'organisation' => $this->profileManager->isProfileFieldVisible(IAccountManager::PROPERTY_ORGANISATION, $user, $currentUser) ? $organisation->getValue() : null, | ||
| 'role' => $this->profileManager->isProfileFieldVisible(IAccountManager::PROPERTY_ROLE, $user, $currentUser) ? $role->getValue() : null, | ||
| 'url' => $referenceText, | ||
| ] | ||
| ); | ||
| return $reference; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With these new checks it looks like we are only exposing data that should be visible to the active user 👍
Looks good
chore: bump app version, NC30-31 chore: update changelog enh: migrate adjustments from (nextcloud/contacts#4231) chore: update npm packages Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
chore: bump app version, NC30-31 chore: update changelog enh: migrate adjustments from (nextcloud/contacts#4231) chore: update npm packages Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
a7cc035 to
d0bc3c1
Compare
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
da271f4 to
98d8e16
Compare
|
Is the plan to move the user picker into the Contacts app still? |
|
No. Let's decide how to move it to server. Should it be a shipped app or in the core? I leaning towards a shipped app to isolate it (and make the move simpler 😁 ). |
|
I'm fine with either. Shipped app is easy to set up, but cumbersome to maintain. Moving to server is more work now but easier to keep alive in the long run because it will live in a very active repository. |
This replaces #3487. I can't push in the branch there.
@ChristophWurst
About #3487 (review) I'm not sure I see the issue. The frontend is using the
ocs/v2.php/core/autocomplete/getendpoint which should respect the sharing settings.The reference provider now checks if the profile is enabled or not with the
IAccountManager::PROPERTY_PROFILE_ENABLEDaccount property.It seems fine to resolve any
/u/USER_IDlink as long as the profile is enabled.