Create a reference widget AKA Smart Picker widget - #19088
Open
jospoortvliet wants to merge 3 commits into
Open
Conversation
Register a listener that calls Util::addScript() so other apps' pages (Text, Collectives, comments, etc.) load Talk's reference widget bundle whenever they render Smart Picker / link-preview references, not only when Talk itself renders the page. Assisted-by: Claude Sonnet 5:claude-sonnet-4.5
Register a 'call' Smart Picker reference widget that replaces the generic open-graph card with a Talk-shaped one: avatar, conversation type, display name and (when available) a non-expired last message. Live conversation data is fetched client-side through the existing, already-authorized room endpoint; the cached reference payload produced by TalkReferenceProvider is left untouched so no volatile data ends up in the reference cache. hasInteractiveView is explicitly false: this widget is read-only, with no composer, joining, or message history in this change. Assisted-by: Claude Sonnet 5:claude-sonnet-4.5
Assisted-by: Claude Sonnet 5:claude-sonnet-4.5
Member
|
Hi @jospoortvliet thanks for your contribution.
Regarding the actual changes:
Also there seems to be a problem with the avatars at least on Firefox: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

☑️ Resolves
AI (if applicable)
Claude Sonnet 5 to be exact.
Summary
Adds a real Talk widget for the Smart Picker (Reference Provider), replacing the generic open-graph card that a Talk conversation link now shows.
This means Talk conversation links render as a little conversation card: avatar, display name, conversation type, and the last message.
Still want to add room description too, as this got lost. And see what else we could show, making the widget a bit nicer. But first looking for some feedback.
This is read-only, and thus has no interactions like join a talk/chat. Maybe for a V2. But clicking of course opens the Talk room (link).
What changed
(Claude-generated description):
RenderReferenceEventListener(new,lib/Collaboration/Reference/, registered inApplication.php): listens forOCP\Collaboration\Reference\RenderReferenceEventand loads the newtalk-referencescript bundle wherever a reference is rendered (Text, comments, Collectives, etc.).src/reference.ts(new entry point, added torspack.config.js): registers acallwidget for the Smart Picker withhasInteractiveView: false,fullWidth: false,isResizable: false.CallReferenceWidget.vue(new): fetches the conversation via the existing authorized conversation endpoint and renders avatar/name/type/last-message. Falls back to metadata-only (title from theReferencepayload) when the room isn't accessible or the fetch fails.optionsparam onfetchConversation()inconversationsService.ts— no behavior change for existing callers.CallReferenceWidget.spec.ts, 6 cases) and a PHP test for the event listener.Why client-side fetch, not a fatter
ReferenceTalkReferenceProvidercaches resolved references by room (getCachePrefix()/getCacheKey()). Last message, participant state, etc. are volatile and have no sensible cache-invalidation story — putting them in theReferencepayload would mean the widget serves stale data forever between cache refreshes. So the widget fetches live data itself, the same way the Talk UI does;fetchReference()is untouched.Access control
No new access checks were added or changed. The existing endpoint used by the widget enforces the same authorization as the rest of Talk (lobby, federation proxy-cache, room membership); the widget just renders what it's given and shows the inaccessible/fallback state when the fetch fails or
accessible === falsecomes back from the provider.Scope
Out of scope: message history/list rendering, sending messages, reactions, polls, joining calls, live updates. None of
src/components/MessagesList/is touched.Testing done
npm run ts:check,eslint,stylelint— cleannpm run test(vitest) — new + existing suites passphp -l,composer cs:fix,composer psalm— cleannpm run build— succeedsRenderReferenceEventListenerTest.php) — not run; this checkout isn't nested under aserverinstall astests/php/bootstrap.phprequires. Needs to run in a proper dev environment before merge.Open point for review
referenceentry is ~617 KiB (JS+CSS) — smaller thandeck/maps(~840 KiB) but still over rspack's size-warning threshold, consistent with Talk's other standalone bundles. Flagging in case reviewers want theConversationIconreuse traded for a lighter custom avatar to shrink it further.🖌️ UI Checklist
🖼️ Screenshots / Screencasts
So I would like to make the widget higher - show a bit more of the image. Just not as crazy big as the original. And add a bit more info!
🚧 Tasks
🏁 Checklist
🛠️ API Checklist
🚧 Tasks
🏁 Checklist
docs/has been updated or is not requiredAssisted-by: Claude Sonnet 5:claude-sonnet-5