Skip to content

Navigation Menu

Sign in
Sign up

feat: image and video blocks - #3638

Open
global-prog wants to merge 2 commits into
nextcloud:main from
global-prog:contrib/media-blocks
Open

feat: image and video blocks #3638
global-prog wants to merge 2 commits into
nextcloud:main from
global-prog:contrib/media-blocks

Conversation

@global-prog

@global-prog global-prog commented Sep 9, 2026
edited
Loading

Copy link
Copy Markdown

Summary

Two display-only blocks, so a form can show a picture or point at a video between its questions rather than only text.

They are modelled as ordinary question types that happen to carry no answer, which keeps them inside the existing ordering and drag-and-drop with no new concepts to learn. A shared ANSWER_TYPES_DISPLAY_ONLY list marks them, so they are skipped when validating a submission and filtered out of exports — without that, each block would add an empty column to every CSV.

One deliberate choice: video is a link, not an embed

Embedding would make every respondent's browser contact the video host on page load, disclosing their IP address and usually setting cookies. On a form marked as anonymous that would quietly undermine the promise being made to respondents, so the block renders as a link they choose to follow.

Images do render inline, since that is the point of an image block, but with referrerpolicy="no-referrer" so the form's own address is not passed on. The editor also warns when the address is not on this instance:

This address is on another site. Loading it tells that site the IP address of everyone who opens the form.

I am happy to add an opt-in embed for video if you would rather have it, but I did not think it should be the default.

Scope

  • no schema change; the address and description live in the existing extraSettings
  • FormsQuestionType is left alone, matching how linearscale, ranking and color are already handled, so openapi.json is unaffected

Testing

  • npm run lint, npm run stylelint and php -l clean
  • built against current main with no errors
  • checked: a block with no address set, an image on this instance, an image elsewhere (warning shown), a video link, submitting a form containing both blocks, and confirming neither appears as a column in the CSV export

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Adds two display-only blocks so a form can show a picture or point at a video
between its questions, rather than only text.
They are modelled as ordinary question types that happen to carry no answer, which
keeps them in the existing ordering and drag-and-drop with no new concepts. A shared
ANSWER_TYPES_DISPLAY_ONLY list marks them so they are skipped when validating a
submission and filtered out of exports - without that, each block would add an empty
column to every CSV.
Video is deliberately NOT embedded in an iframe. Embedding makes every respondent's
browser contact the video host on page load, disclosing their IP address and usually
setting cookies, which would quietly undermine a form marked as anonymous. It renders
as a link the respondent chooses to follow.
Images do render inline, since that is the point of an image block, but with
referrerpolicy="no-referrer" so the form's address is not passed on, and the editor
warns when the address is not on this instance.
No schema change: the address and description live in the existing extraSettings.
FormsQuestionType is left alone, matching how linearscale, ranking and color are
already handled, so openapi.json is unaffected.
Signed-off-by: global-prog <raqeeb@uosamarra.edu.iq>

Copy link
Copy Markdown
Collaborator

@global-prog Please look at the corresponding issue at #624 to see if you covered all of what has been discussed there already. Also please add the AI declaration to your description if you used AI for this.

global-prog reacted with thumbs up emoji

@Chartman123 Chartman123 added this to the 5.5 milestone Sep 11, 2026
@Chartman123 Chartman123 linked an issue Sep 11, 2026 that may be closed by this pull request

codecov Bot commented Sep 11, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

A display-only block was skipped during validation whether or not an answer came with it,
so a hand-made request could store an answer against a block that has nowhere to show
it. An absent answer is still expected -- and still must not count as a missing required
one -- but a present answer is now refused.
The submit view never sends one for these blocks, since they emit no value, so this
changes nothing for a form filled in normally.
Adds tests for both halves, and for the image and video settings accepted by
areExtraSettingsValid, which were not exercised before.
Signed-off-by: global-prog <raqeeb@uosamarra.edu.iq>

Copy link
Copy Markdown
Author

Thanks, I read through #624.

It is mostly about section headings and descriptions to break up a long form, which this PR does not do: it only adds image and video blocks. So I don't think it should close #624 on its own. Section headings are what #2913 is working on.

One thing that may help there: this PR adds a shared ANSWER_TYPES_DISPLAY_ONLY list in Constants, which SubmissionService checks during validation and when building the export. I've also added the backend check you asked for on #2913: an answer submitted to a display-only block is now refused rather than skipped, with tests. If sections land as a question type they could go on the same list and get that behaviour without a second mechanism.

If you decide display content shouldn't be a question type, which is the open question on #2913, I'll follow that decision here too.

The AI declaration is added to the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

2. developing Work in progress enhancement New feature or request feature: 📑 form creation

Projects

None yet

Milestone

5.5

Development

Successfully merging this pull request may close these issues.

Add sections or multiple descriptions

AltStyle によって変換されたページ (->オリジナル) /