Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 104 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,31 @@ paths:
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntityList'
/announcements/facts:
get:
tags: [Announcements]
summary: List Announcement Facts
description: |
The named facts an announcement's `audience_rules` can use, such as
`distance_travelled_not_set_up` (the person's organisation hasn't set up Distance Travelled), each
with what it means and the params it takes. A fact about a person's organisations takes `across`:
for someone in several organisations, whether it must hold for any one of them
(`any_organisation`, the default), every one (`all_organisations`) or the oldest one they belong
to (`first_organisation`). Facts are written in Makerble's code, so this list only changes with a
release. System Access users only; anyone else gets 403.
operationId: listAnnouncementFacts
security: [{tokenAuth: []}]
responses:
"200":
description: Every fact, on one page
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedAnnouncementFacts'
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/ForbiddenError'
/announcements/{id}:
parameters:
- name: id
Expand Down Expand Up @@ -16301,7 +16326,36 @@ components:
description: |
`everyone`: every signed-in user. `colleagues`: everyone except Contacts with a login
(active participants). `administrators`: Organisation Admins of at least one organisation.
Ignored for a place's announcement, which is always for the colleagues there.
Ignored for a place's announcement, which is always for the colleagues there. Ignored too
when `roles` has any.
roles:
type: array
items:
type: string
enum: [organisation_admin, editor, reporter, observer, team_leader, active_participant, survey_portal_user]
description: |
Makerble's own only (System Access users). Narrows who sees it to anyone holding at least one
of these roles, in place of `audience`: `organisation_admin` (Organisation Admin), `editor`
(Workspace editor, Project Editor), `reporter`, `observer` (of an Organisation or a
Workspace), `team_leader`, `active_participant` (Contact with a login) and
`survey_portal_user`. Contacts with a login and Survey Portal users are left out unless their
own role is listed, even when they hold another. An empty list (the default) leaves it to
`audience`. Sent, it replaces the list.
audience_rules:
type: object
additionalProperties: true
description: |
Makerble's own only (System Access users). Behaviour rules: a JSON expression over the named
facts from List Announcement Facts, saying who sees it beyond its audience or roles, e.g.
only people whose organisation hasn't set up Distance Travelled. Each rule is exactly one of
`{"fact": key, "params": {...}}` (params optional), `{"all": [rules]}`, `{"any": [rules]}`
or `{"not": rule}`; at most 5 deep and 10 facts. `{}` (the default) means no rules. An
unknown fact, param or shape is refused with 422, naming the rule.
example:
all:
- fact: distance_travelled_not_set_up
params:
across: all_organisations
starts_on:
type: string
format: date
Expand All @@ -16323,6 +16377,46 @@ components:
sent are replaced. People see at most one Makerble announcement a day, so this keeps
announcements from queuing behind each other. Use it to schedule a feature's announcement
once the feature is live on production.
AnnouncementFact:
type: object
properties:
key:
type: string
description: 'What a rule names, e.g. `{"fact": "distance_travelled_not_set_up"}`'
label:
type: string
description: Completes "people ..." in Site Overview's "Who sees this"
description:
type: string
params:
type: object
description: Each param by name, with the values it accepts, its default and what it means
additionalProperties:
type: object
properties:
values:
type: array
items:
type: string
default:
type: string
description:
type: string
PaginatedAnnouncementFacts:
type: object
properties:
page:
type: integer
page_size:
type: integer
page_count:
type: integer
total_count:
type: integer
data:
type: array
items:
$ref: '#/components/schemas/AnnouncementFact'
Announcement:
type: object
properties:
Expand Down Expand Up @@ -16367,6 +16461,15 @@ components:
audience:
type: string
enum: [everyone, colleagues, administrators]
roles:
type: array
items:
type: string
description: The roles that narrow who sees it, in place of `audience`; empty for none. See Create an Announcement.
audience_rules:
type: object
additionalProperties: true
description: Behaviour rules over named facts; `{}` for none. See Create an Announcement.
starts_on:
type: string
format: date
Expand Down
8 changes: 7 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4201,6 +4201,7 @@ function buildDocsPage() {
<p>An Announcement is a popup that each signed-in user in its audience sees once, between its start and end dates. There are two kinds. Makerble's own "What's new in Makerble" popups, for example "Projects are now Workspaces", are written by Makerble staff in Site Overview › Announcements; their <code>scope_type</code> is <code>null</code>. An Organisation's, Workspace's or Team's announcements are written by the people who look after it, for the colleagues there: <code>scope_type</code> is <code>Charity</code>, <code>Project</code> or <code>Team</code>, with <code>scope_id</code>.</p>
<p>System Access users can see and change every announcement. Anyone else can see and change only those for places where they hold the role now: an Organisation Admin, for their Organisation and its Workspaces and Teams; a Workspace editor (Project Editor), for that Workspace; a Team leader, for that Team. Someone who can make announcements nowhere gets <code>403</code>.</p>
<p><code>visual_type</code> is <code>name_change</code> (an animation of 1 to 3 <code>name_changes</code>, old name → new name), <code>vimeo</code> (a Vimeo video at <code>vimeo_url</code>) or <code>none</code>. <code>audience</code> is <code>everyone</code>, <code>colleagues</code> (everyone except Contacts with a login) or <code>administrators</code> (Organisation Admins); a place's announcement is always for its colleagues (an Organisation's colleagues, a Workspace's editors, reporters and observers, or a Team's members and leaders), can't use <code>name_change</code>, and its <code>learn_more_url</code> can be any https page. <code>status</code> stores <code>draft</code> or <code>scheduled</code>; <code>current_status</code> also says whether a scheduled one is <code>live</code> or has <code>ended</code>.</p>
<p>Makerble's own can be narrowed further. <code>roles</code> shows it only to people holding at least one of the listed roles, in place of <code>audience</code>: <code>organisation_admin</code>, <code>editor</code> (Workspace editor), <code>reporter</code>, <code>observer</code>, <code>team_leader</code>, <code>active_participant</code> (Contact with a login) and <code>survey_portal_user</code>; Contacts with a login and Survey Portal users are left out unless their own role is listed. <code>audience_rules</code> targets people by behaviour, as JSON over named facts, for example <code>{"all": [{"fact": "distance_travelled_not_set_up"}]}</code> for people whose organisation hasn't set up Distance Travelled. Each rule is exactly one of <code>{fact, params}</code>, <code>{all: [rules]}</code>, <code>{any: [rules]}</code> or <code>{not: rule}</code>, at most 5 deep and 10 facts. List Announcement Facts gives the facts and their params; an unknown fact or param returns <code>422</code> naming the rule. Both are for System Access users only.</p>
</div>
<div class="callout callout-tip">
<span class="callout-icon">✓</span>
Expand All @@ -4217,6 +4218,11 @@ function buildDocsPage() {
{ code: "200", cls: "response-2xx", desc: "Paginated Announcements the user may see, newest first, each with <code>scope_type</code>, <code>scope_id</code>, <code>seen_count</code> and <code>learn_more_click_count</code>" },
{ code: "403", cls: "response-4xx", desc: "The user can make announcements nowhere" }
])}
${endpointCard("GET", "/announcements/facts", "List Announcement Facts", true, [], [
{ code: "200", cls: "response-2xx", desc: "Every fact <code>audience_rules</code> can use, on one page, each with <code>key</code>, <code>label</code>, <code>description</code> and <code>params</code> (each param's <code>values</code>, <code>default</code> and <code>description</code>)" },
{ code: "401", cls: "response-4xx", desc: "Missing or invalid token" },
{ code: "403", cls: "response-4xx", desc: "The user doesn't have System Access" }
], "A fact about a person's organisations takes <code>across</code>: for someone in several organisations, whether it must hold for any one of them (<code>any_organisation</code>, the default), every one (<code>all_organisations</code>) or the oldest one they belong to (<code>first_organisation</code>). Facts are written in Makerble's code, so this list only changes with a release.")}
${endpointCard("GET", "/announcements/{id}", "Get an Announcement", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Announcement ID" }
], [
Expand All @@ -4229,7 +4235,7 @@ function buildDocsPage() {
{ code: "403", cls: "response-4xx", desc: "The user doesn't hold the role on that place, or (with no place) doesn't have System Access" },
{ code: "404", cls: "response-4xx", desc: "The Organisation, Workspace or Team doesn't exist" },
{ code: "422", cls: "response-4xx", desc: "Validation failed, e.g. no headline, a headline over 90 characters, a Vimeo visual with a YouTube link, or the name change animation for a place" }
], "Body: <code>scope_type</code> and <code>scope_id</code> (whose announcement; leave out for one of Makerble's own), <code>title</code> (headline, up to 90), <code>body</code> (message, up to 280), <code>visual_type</code>, <code>name_changes: [{old_name, new_name}]</code> (1 to 3), <code>vimeo_url</code>, <code>learn_more_url</code> (a Makerble User Guide page for Makerble's own; any https page for a place's), <code>training_material_id</code> (a place's announcement only: one of its Organisation's Training materials, linked for the colleagues it is shared with), <code>button_label</code> (default \"Got it\"), <code>audience</code>, <code>starts_on</code>, <code>ends_on</code>, <code>status</code>.")}
], "Body: <code>scope_type</code> and <code>scope_id</code> (whose announcement; leave out for one of Makerble's own), <code>title</code> (headline, up to 90), <code>body</code> (message, up to 280), <code>visual_type</code>, <code>name_changes: [{old_name, new_name}]</code> (1 to 3), <code>vimeo_url</code>, <code>learn_more_url</code> (a Makerble User Guide page for Makerble's own; any https page for a place's), <code>training_material_id</code> (a place's announcement only: one of its Organisation's Training materials, linked for the colleagues it is shared with), <code>button_label</code> (default \"Got it\"), <code>audience</code>, <code>roles</code> and <code>audience_rules</code> (Makerble's own only; see above), <code>starts_on</code>, <code>ends_on</code>, <code>status</code>.")}
${endpointCard("PATCH", "/announcements/{id}", "Update an Announcement", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Announcement ID" }
], [
Expand Down
Loading