Package su.onno.ui.comments
Class MentionController
java.lang.Object
su.onno.ui.comments.MentionController
The comment mention/reference typeahead source:
GET /api/mentions?q=…&kind=… fans the query
across readable catalogs and/or documents and returns a unified, ranked suggestion list. It is the
cross-entity sibling of the per-entity /api/list/{kind}/{name}?q= ref picker — the same
case-insensitive search, just spread over all readable entities with a per-entity and a total cap
so one keystroke can never fan into an unbounded scan.
Read access is the existing per-entity gate (UiAccessService); deny-by-default means a
caller only ever sees suggestions from entities they could already open, so the typeahead can't be
used to enumerate hidden records. The optional kind=people|catalogs|documents filter lets
the UI use @ for people mentions and # for document references: people
narrows to the identity catalog (the one Layout.identity(...) links a login to — the same
catalog whose mentions raise notifications), falling back to all catalogs when no identity link is
configured. Gated on onno.comments.mentions.enabled.
-
Constructor Summary
ConstructorsConstructorDescriptionMentionController(MetadataRegistry registry, CatalogQueryService catalogQuery, DocumentQueryService documentQuery, UiAccessService access, CommentProperties properties, UiLayout layout, MentionResolver resolver) -
Method Summary
Modifier and TypeMethodDescriptionResolve one(kind, name, id)triple to its live display — what the compose box calls when an internal record URL is pasted, to swap the link for a mention chip.
-
Constructor Details
-
MentionController
public MentionController(MetadataRegistry registry, CatalogQueryService catalogQuery, DocumentQueryService documentQuery, UiAccessService access, CommentProperties properties, UiLayout layout, MentionResolver resolver)
-
-
Method Details
-
search
-
resolve
@GetMapping("/api/mentions/resolve") public Map<String,Object> resolve(@RequestParam("kind") String kind, @RequestParam("name") String name, @RequestParam("id") String id, Principal principal) Resolve one(kind, name, id)triple to its live display — what the compose box calls when an internal record URL is pasted, to swap the link for a mention chip. The same per-viewer read gate as thread rendering applies (MentionResolver): an unreadable or unknown record comes backreadable=falsewith no display, and the client leaves the pasted text alone.personmarks records of the identity catalog, so the client can pick the@marker for people and#for everything else.
-