Discussion and object history
Work on a shipment, a batch or an aircraft often needs a word with someone. Every object and every proposal has a thread for that, next to the data it is about, with mentions of people and of other objects. Watching a thread keeps people told of new comments and of actions on the object, through their inbox or email as each person prefers. The object's history lists every change made to it, by an action, an undo or a sync, with who and when
@id, objects as @[type:key]In the platform today
- Discussion, watching, notification preferences and object history run in the platform service with tests
- Threads are at
/api/v2/types/{type}/objects/{key}/discussionand/api/v2/proposals/{id}/discussion, comments are plain text up todiscussion.maxLengthcharacters, and edits and deletes keep the earlier text inops.comment_edits - Watchers get inbox notices of kind
comment,mentionandwatched, and email by their own choice per category at/api/v2/notification-preferences GET /api/v2/types/{type}/objects/{key}/historylists every change to an object, andGET /api/v2/action-log?objectType=&objectKey=finds every action that edited it- The Operations side panel and the Simple view's object sheet show the thread and the history when the app is connected to the platform service
Configure
Both blocks are optional; these are the defaults
discussion:
maxLength: 4000
# or skip: the comment is saved and that person is not told
mentionsWithoutAccess: refuse
notificationPreferences:
defaults: { comments: app, mentions: email, watched: app, proposals: email, alerts: email }
Threads
{
"body": "@qa.martin can you check the swab result on @[lot:L-24-0912] before we release?"
}
A comment is plain text with no markup. It comes back with parts, the text split into text, person and object pieces, so a screen draws mentions without parsing them. A thread is read oldest first, with whether the caller watches it
- Who sees a thread. Only people who may read its object: the object type's access label and its row policies on the object as it is now. For a proposal, the same check as reading the proposal, including its action type's label. Anyone else gets 404, worded as for an object that doesn't exist
- Object mentions.
@[type:key]must name an object the author may read, or the comment is refused (MENTION_NOT_FOUND). A reader who may not read a mentioned object sees it as hidden, never by its key or title - People mentions.
@<user id>names one of the ontology's users. A person who may not read the thread can't be mentioned: by default the comment is refused (MENTION_LACKS_ACCESS, the people inparams.users); withmentionsWithoutAccess: skipit is saved, that person is neither told nor subscribed, and the answer lists them inskipped.…/discussion/people?q=lists the people who may be mentioned - Edits and deletes. Only the author edits a comment (
POST /api/v2/comments/{id}:edit), and only the author or an administrator deletes one (:delete). Nothing is erased: an edit keeps the earlier text inops.comment_editsand marks the comment edited, and a deleted comment shows without its text, with who deleted it and when. New mentions added by an edit are told; watchers are not told again - Audit. Every change is in the audit log as
comment.created,comment.edited,comment.deleted,discussion.watchedordiscussion.unwatched
Watching
Writing a comment subscribes you to its thread. Being mentioned subscribes you too, unless you unwatched it yourself. POST …/discussion:watch with {"watching": false} stops it, and GET /api/v2/watches lists what you watch. Watchers are told
- of new comments, as kind
comment, ormentionfor the person mentioned - of actions applied to a watched object, any object the action edited and not only its main one, and of undos, as kind
watchedwith the action log id, unless the action's ownnotify:entries already reached them
Each notice is a row of ops.notifications for one person, written only when they may read the object, and the action type's label, at that moment. The inbox and the email dispatcher check access again when it is read and sent. The author or actor is never told about their own doing
Notification preferences
Each person chooses, per category, app (in the app only), email (in the app and by email) or none
| Category | Covers | Default |
|---|---|---|
comments | New comments on things you watch | app |
mentions | Someone mentions you in a comment | email |
watched | Actions applied to things you watch | app |
proposals | Proposals waiting for you, and expired ones | email |
alerts | Alerts | email |
POST /api/v2/notification-preferences
{ "category": "comments", "channel": "email" }
- Comment, mention and watched notices chosen as
emailgo to the person's ownattributes.emailthroughnotifications.smtp, as a delivery to the destinationperson:<user id>, with the same retries, dead letters, access check and mutes as other email - Proposals and alerts reach email only through the routes an administrator set up.
appandnonemute those routes for the person, except arequiredroute, andnonealso leaves them out of the inbox - A change applies to what has not gone yet: the dispatcher checks the preference again when it sends, and the inbox when it is read
- Choices are kept in
ops.notification_preferencesand audited asnotification.preferences. An administrator can read or set anyone's withuser
Object history
History lists every change to one object, newest first
| Kind | From | Carries |
|---|---|---|
action | Action log entries that edited the object, as their main object or any other | Who (person, agent or automation), when, the action, its reason, its proposal and approver, the main object when it is another one, and before and after per property |
undo | Entries that revert another | The same, with reverts; the reverted entry has revertedBy |
sync | Commits to the object table from a sync, read from its change feed | Created, modified or deleted, the sync run, who ran the build behind it when known, else service:sync, and before and after per property |
change | Any other commit, such as a table rewrite when sealed properties change | Shown only when a property the caller may see changed, with actor service:objects |
- The caller must hold the type's access label, and the object, as it is now or as it was last seen when it has been deleted, must be inside their row policies, else 404
- Hidden properties, and sealed ones whose label the caller doesn't hold, are left out of every entry; sealed values are opened for holders. An entry for an action type whose label they don't hold is left out
- History goes back as far as the object table's kept versions.
pageSizeis at most 500, andbeforepages back - Comments are not entries; they are in the thread
To go the other way, from an object to the actions behind it, GET /api/v2/action-log?objectType=aircraft&objectKey=407 finds every entry whose main object it is or that edited it, as described on the action log
API
| Endpoint | Does |
|---|---|
GET, POST /api/v2/types/{type}/objects/{key}/discussion | Read the thread, or add a comment with {"body"} |
POST …/discussion:watch | Watch or stop watching, with {"watching"} |
GET …/discussion/people?q= | People who may be mentioned |
/api/v2/proposals/{id}/discussion | The same four for a proposal |
POST /api/v2/comments/{id}:edit, :delete | Edit your comment, or delete it |
GET /api/v2/watches | What the caller watches |
GET, POST /api/v2/notification-preferences | Read or set preferences |
GET /api/v2/types/{type}/objects/{key}/history | Every change to an object |
GET /api/v2/action-log?objectType=&objectKey= | Actions by any object they edited |
Limitations
- Replies within a thread, reactions, rich text, read receipts and attachments in comments are delivered on request
- Mentioning a group is delivered on request; mention the people instead
- Comments on a link or on a whole object type are delivered on request
- Personal email for proposals and alerts is delivered on request; today they reach email through routes
- History reaches back only as far as the object table's kept versions, so a retention cut shortens it