feat: show recent people on contact icon - #62930
Conversation
|
Any chance we can get a couple of screen captures for the visual changes? |
| $entries = $this->store->getContacts($user, '', $limit); | ||
| return array_slice($this->sortEntries($entries), 0, $limit); |
There was a problem hiding this comment.
Is the idea to get any 3 contacts? Or just the last 3 recent contacts?
There was a problem hiding this comment.
It is to get last 3 recent contacts.
kra-mo
left a comment
There was a problem hiding this comment.
The border should be consistent with that of the user's avatar. The rest seems good from the screenshot.
kra-mo
left a comment
There was a problem hiding this comment.
Oops, meant to do "Request changes".
Signed-off-by: root <root@srv1582549.hstgr.cloud>
1381d2c to
dd93bda
Compare
|
@kra-mo I updated the UI. Please check the screenshot from the description above. |
| #[NoAdminRequired] | ||
| #[FrontpageRoute(verb: 'GET', url: '/contactsmenu/preview-avatars')] | ||
| public function previewAvatars(?string $teamId = null): array { |
There was a problem hiding this comment.
Please add rate limiting
There was a problem hiding this comment.
UserRateLimit(limit: 60, period: 120) would be enough for it?
There was a problem hiding this comment.
Tbh, I don't know what a reasonable threshold might be... I can't see a regular user reloading the page every 2s?
Make the span 5min, and the limit 30 times... even that is over kill i think
| $cache = $this->cacheFactory->createDistributed('contactsmenu-preview'); | ||
| $cacheKey = $user->getUID(); | ||
| $cached = $cache->get($cacheKey); | ||
| if (!is_array($cached)) { |
There was a problem hiding this comment.
I am not sure if the caching is worth it here. The cache TTL is 5min, which means most likely the cache will never get utilized that much.
Most users will not flip between the apps that frequently, they will click on mail work there for 10min then maybe change over the calendar extra. Power users will just open each app in a separate window, so not sure this will really help any.
@kesselb @DerDreschner what do you think?
| interface IPreviewUser { | ||
| uid: string | ||
| fullName: string | ||
| isUser: boolean | ||
| } | ||
|
|
There was a problem hiding this comment.
Interfaces should be extracted in to a separate types file "src/types"
Summary
Makes the People (contacts) header menu more inviting by showing a stack of up to 3 overlapping avatars of recent contacts on the menu trigger, instead of only the contacts icon.
GET /contactsmenu/preview-avatarswhich returns the first 3 entries from the same unfiltered contacts list as the menu (Manager::getEntrieswith an empty filter), with optional team filtering matching the existing index endpoint.NcAvatarstack when at least 2 are available; otherwise keeps the existing contacts icon.width: fit-content) so the stack does not overlap notifications/profile and remains fully clickable.Screenshot
🏚️ Before
🏡 After
Checklist
3. to review, feature component)stable32)AI (if applicable)