Class MentionController

java.lang.Object
su.onno.ui.comments.MentionController

@RestController public class MentionController extends Object
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 Details

  • Method Details

    • search

      @GetMapping("/api/mentions") public List<Map<String,Object>> search(@RequestParam(name="q",required=false) String q, @RequestParam(name="kind",required=false) String kind, Principal principal)
    • 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 back readable=false with no display, and the client leaves the pasted text alone. person marks records of the identity catalog, so the client can pick the @ marker for people and # for everything else.