diff --git a/openapi.yaml b/openapi.yaml index 368e336..71e3318 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -951,6 +951,9 @@ paths: application/json: schema: $ref: '#/components/schemas/AnnouncementInput' + multipart/form-data: + schema: + $ref: '#/components/schemas/AnnouncementInput' examples: makerble: summary: One of Makerble's own (System Access users) @@ -980,6 +983,18 @@ paths: starts_on: "2026-12-01" ends_on: "2026-12-08" status: scheduled + image: + summary: With an image, sent as base64 + value: + title: Surveys now have a Duplicate button + body: Copy a Survey, with its questions, in one click. + visual_type: image + image: + filename: duplicate-survey.png + data: iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg== + image_alt: The Duplicate button at the top of a Survey + learn_more_url: https://makerble.atlassian.net/wiki/spaces/MCPD/pages/123/Surveys + status: draft responses: "201": description: The created Announcement @@ -1068,6 +1083,9 @@ paths: application/json: schema: $ref: '#/components/schemas/AnnouncementInput' + multipart/form-data: + schema: + $ref: '#/components/schemas/AnnouncementInput' example: ends_on: "2026-12-15" responses: @@ -18078,6 +18096,17 @@ components: type: string maxLength: 40 example: Workspaces + AnnouncementImageUpload: + type: object + required: [filename, data] + properties: + filename: + type: string + example: workspaces.png + data: + type: string + format: byte + description: The file's contents in base64. AnnouncementInput: type: object properties: @@ -18113,8 +18142,10 @@ components: description: The message. Required. visual_type: type: string - enum: [name_change, vimeo, none] - description: The name-change animation (Makerble's own only), a Vimeo video, or nothing. + enum: [name_change, vimeo, image, none] + description: >- + The name-change animation (Makerble's own only), a Vimeo video, an uploaded image (with `image` and + `image_alt`), or nothing. Changing it from `image` removes the image and its alt text. name_changes: type: array minItems: 1 @@ -18125,6 +18156,20 @@ components: vimeo_url: type: string description: For `vimeo`, https://vimeo.com/, https://vimeo.com// or https://player.vimeo.com/video/?h=. Ignored for the other visuals. + image: + description: | + For `image`: a screenshot or illustration shown whole (never cropped) in the popup. A PNG, JPG, GIF or + WebP file of up to 5 MB; the type is read from the file itself. Send it as a file in a + `multipart/form-data` request, or in JSON as `{ "filename": "workspaces.png", "data": "" }`. + Required when creating an `image` announcement; leave it out on update to keep the saved image. + oneOf: + - type: string + format: binary + - $ref: '#/components/schemas/AnnouncementImageUpload' + image_alt: + type: string + maxLength: 250 + description: For `image`, required. What the image shows, read out by screen readers. learn_more_url: type: string nullable: true @@ -18279,7 +18324,7 @@ components: type: string visual_type: type: string - enum: [name_change, vimeo, none] + enum: [name_change, vimeo, image, none] name_changes: type: array items: @@ -18309,6 +18354,14 @@ components: items: type: string description: The guidance panel keys of the pages it shows on; empty for any page. See Create an Announcement. + image_url: + type: string + nullable: true + description: For the `image` visual, a link to the uploaded image; null otherwise. + image_alt: + type: string + nullable: true + description: For the `image` visual, the image's alt text; null otherwise. starts_on: type: string format: date diff --git a/server.js b/server.js index bb5db84..7fa09be 100644 --- a/server.js +++ b/server.js @@ -4507,7 +4507,7 @@ function buildDocsPage() {

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 scope_type is null. An Organisation's, Workspace's or Team's announcements are written by the people who look after it, for the colleagues there: scope_type is Charity, Project or Team, with scope_id.

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 403.

-

visual_type is name_change (an animation of 1 to 3 name_changes, old name → new name), vimeo (a Vimeo video at vimeo_url) or none. audience is everyone, colleagues (everyone except Contacts with a login) or administrators (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 name_change, and its learn_more_url can be any https page. status stores draft or scheduled; current_status also says whether a scheduled one is live or has ended.

+

visual_type is name_change (an animation of 1 to 3 name_changes, old name → new name), vimeo (a Vimeo video at vimeo_url), image (an uploaded picture, such as a screenshot, shown whole with its image_alt for screen readers; returned as image_url) or none. audience is everyone, colleagues (everyone except Contacts with a login) or administrators (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 name_change, and its learn_more_url can be any https page. status stores draft or scheduled; current_status also says whether a scheduled one is live or has ended.

Makerble's own can be narrowed further. roles shows it only to people holding at least one of the listed roles, in place of audience: organisation_admin, editor (Workspace editor), reporter, observer, 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. audience_rules targets people by behaviour, as JSON over named facts, for example {"all": [{"fact": "distance_travelled_not_set_up"}]} for people whose organisation hasn't set up Distance Travelled. Each rule is exactly one of {fact, params}, {all: [rules]}, {any: [rules]} or {not: rule}, at most 5 deep and 10 facts. List Announcement Facts gives the facts and their params; an unknown fact or param returns 422 naming the rule. Both are for System Access users only.

Makerble's own can also be limited to some pages with page_keys, so a feature is announced where it lives: ["contacts"] shows it only when someone opens Manage Contacts, including when they move there from another page without reloading. A page key is the key of the page's Intro (its Show/Hide Guidance panel), such as contacts, events, checklists, surveys or tasks; pages without an Intro can't be chosen. An empty list (the default) means any page. An unknown key returns 422 listing the keys available. System Access users only.

@@ -4542,8 +4542,8 @@ function buildDocsPage() { { code: "201", cls: "response-2xx", desc: "Announcement created (a draft unless status is scheduled)" }, { 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: scope_type and scope_id (whose announcement; leave out for one of Makerble's own), title (headline, up to 90), body (message, up to 280), visual_type, name_changes: [{old_name, new_name}] (1 to 3), vimeo_url, learn_more_url (a Makerble User Guide page for Makerble's own; any https page for a place's), training_material_id (a place's announcement only: one of its Organisation's Training materials, linked for the colleagues it is shared with), button_label (default \"Got it\"), feature_tour_id (Makerble's own only: a feature tour; while it is live the button says \"Take the tour\" and starts it), audience, roles, audience_rules and page_keys (Makerble's own only; see above), starts_on, ends_on, status.")} + { code: "422", cls: "response-4xx", desc: "Validation failed, e.g. no headline, a headline over 90 characters, a Vimeo visual with a YouTube link, an image without alt text, a file that isn't a PNG, JPG, GIF or WebP image or is over 5 MB, or the name change animation for a place" } + ], "Body: scope_type and scope_id (whose announcement; leave out for one of Makerble's own), title (headline, up to 90), body (message, up to 280), visual_type, name_changes: [{old_name, new_name}] (1 to 3), vimeo_url, image and image_alt (for image: a PNG, JPG, GIF or WebP file of up to 5 MB, sent as a file in a multipart/form-data request or in JSON as {filename, data} with the data in base64, and its alt text, up to 250 characters, both required), learn_more_url (a Makerble User Guide page for Makerble's own; any https page for a place's), training_material_id (a place's announcement only: one of its Organisation's Training materials, linked for the colleagues it is shared with), button_label (default \"Got it\"), feature_tour_id (Makerble's own only: a feature tour; while it is live the button says \"Take the tour\" and starts it), audience, roles, audience_rules and page_keys (Makerble's own only; see above), starts_on, ends_on, status.")} ${endpointCard("PATCH", "/announcements/{id}", "Update an Announcement", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "Announcement ID" } ], [ @@ -4551,7 +4551,7 @@ function buildDocsPage() { { code: "403", cls: "response-4xx", desc: "Not one the user may change" }, { code: "404", cls: "response-4xx", desc: "Not found" }, { code: "422", cls: "response-4xx", desc: "Validation failed, e.g. 4 name changes" } - ], "Same body as create; only the fields sent change. Without status, a draft stays a draft and a scheduled announcement stays scheduled. Editing a live announcement doesn't show it again to people who have already seen it. An announcement never moves to another place, so scope_type and scope_id are ignored. For one of Makerble's own, send schedule_on_next_free_days: true to schedule it from the first day, from today, on which no other Makerble announcement starts, keeping its own length (14 days if it has no dates yet); any status, starts_on and ends_on sent are replaced. People see at most one Makerble announcement a day, so overlapping ones take turns. For a place's announcement this returns 422.")} + ], "Same body as create; only the fields sent change. Leave image out to keep the saved image; changing visual_type away from image removes it and its alt text. Without status, a draft stays a draft and a scheduled announcement stays scheduled. Editing a live announcement doesn't show it again to people who have already seen it. An announcement never moves to another place, so scope_type and scope_id are ignored. For one of Makerble's own, send schedule_on_next_free_days: true to schedule it from the first day, from today, on which no other Makerble announcement starts, keeping its own length (14 days if it has no dates yet); any status, starts_on and ends_on sent are replaced. People see at most one Makerble announcement a day, so overlapping ones take turns. For a place's announcement this returns 422.")}