Skip to main content

Module pagecontext

Module pagecontext 

Source
Expand description

The page the user is on, as the assistant sidebar reports it.

Every page of the web UI and every tab of the desktop app declares a small context: the kind of page, the identifiers of the objects on it and the visible state that matters (the section, the revision rule, a search query, the selected row, the rows shown). The client sends it with each question.

A context is a hint, never a fact. PageContext::parse only checks the shape (lengths, characters, caps) and drops what does not fit; it never fails and never trusts a value. The server then resolves every identifier with the rights of the asking user (services::assistant::resolve_context) and keeps only what that user may read; an identifier of a restricted group answers exactly like one that does not exist. Only the resolved context reaches the model, the thread and the audit record.

Structs§

PageContext
What a page declares (see the module documentation).

Constants§

KINDS
The kinds of pages. Unknown kinds (a newer client) become other.
MAX_FILTERS
Most filters kept.
MAX_FILTER_CHARS
Longest filter value kept (characters).
MAX_QUERY_CHARS
Longest search query kept (characters).
MAX_REFERENCE
Longest reference (item number, revision code, change number …).
MAX_SHOWN
Most row identifiers kept from the rows a page shows.

Functions§

is_reference
Whether s is a plausible item number, revision code, change number …: short, no spaces.
kind_label
A readable name of a page kind.