Skip to content

feat(PageReference): Preview "Page not found" if page is not accessible#2343

Open
pymnh wants to merge 1 commit intomainfrom
feat/page-not-found-reference-widget
Open

feat(PageReference): Preview "Page not found" if page is not accessible#2343
pymnh wants to merge 1 commit intomainfrom
feat/page-not-found-reference-widget

Conversation

@pymnh
Copy link
Contributor

@pymnh pymnh commented Mar 15, 2026

📝 Summary

Change

  • Let the backend return empty Reference with accessible = false if current user cannot resolve
  • In the refernce widget: If accessible = false, show an informative "Page not found" preview and explain that the page does not seem to exist or that the permissions are missing to view it.
  • On click: open a popover to confirm if user really wants to follow the link

Reasoning:

  • Currently if I have not the permission to view a collectives page, the ReferenceProvider just falls back to opengraph, even if the URL matches a collective page.
  • This is IMO not correct: The collectives preview widget should still be responsible, even if it does not preview the content
  • One consideration: The way I did it, neither the name of the collective nor the title of the page are shown to the user. Technically these are not secret information, as they are included in the link. IMO one could also just render the title and change the description to include that the page was not found. I have no strong opinion on this.

🖼️ Screenshots

🏚️ Before
image
🏡 After
image

🚧 TODO

  • A fallback preview might also make sense for other reference providers and there should be a common way of doing this, so it would be nice to gather consensus if...
    • The accessible property is the right place to indicate that a "resource not found" message should be displayed
    • If the Reference provider should return a link or a completely empty richObject or can sometimes carry some more information? (-> Decks have only numeric ids in their URL, while collectives include Collective name and Page name in the URL, so for collectives, passing on these infos might not be a privacy issue?)
  • Add some unit tests

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

@pymnh pymnh force-pushed the feat/page-not-found-reference-widget branch from 1b8a148 to b9e1846 Compare March 19, 2026 22:48
@pymnh pymnh changed the title WIP: Render empty reference widget if page is not accessible feat(PageReference): Preview "Page not found" if page is not accessible Mar 19, 2026
@pymnh pymnh force-pushed the feat/page-not-found-reference-widget branch from b9e1846 to 70409ac Compare March 19, 2026 23:31
@pymnh
Copy link
Contributor Author

pymnh commented Mar 19, 2026

Psalm error looks unrelated to me, I did not touch the dependencies..

@pymnh pymnh marked this pull request as ready for review March 19, 2026 23:36
@pymnh
Copy link
Contributor Author

pymnh commented Mar 20, 2026

I just noticed that there is a vue component that might be good to use:

https://nextcloud-vue-components.netlify.app/#/Components/NcEmptyContent

What do you think?

@pymnh pymnh force-pushed the feat/page-not-found-reference-widget branch from 70409ac to e400b96 Compare March 21, 2026 08:45
@pymnh
Copy link
Contributor Author

pymnh commented Mar 21, 2026

I removed the Popover confirmation dialog and used NcEmptyContent:

image

@pymnh pymnh force-pushed the feat/page-not-found-reference-widget branch from e400b96 to afd85ef Compare March 21, 2026 09:19
@mejo-
Copy link
Member

mejo- commented Mar 21, 2026

Thanks @pymnh! Without looking at the code yet, from the screenshots it looks like the not found preview is much larger than the normal preview. I'd expect them to have the same height.

@pymnh
Copy link
Contributor Author

pymnh commented Mar 21, 2026

I am not sure if one can squeeze the NcEmptyContent to the same size as the regular preview.

Should I then rather just revert NcEmptyContent and manually set title, description and icon with fallbacks with same alignment and font size like the regular preview?

@mejo-
Copy link
Member

mejo- commented Mar 21, 2026

Should I then rather just revert NcEmptyContent and manually set title, description and icon with fallbacks with same alignment and font size like the regular preview?

I would say so, yes. NcEmptyContent has a rather strict structure with everything (icon, title, description) below each other. So I think we're better with not using it here 😉

@pymnh pymnh force-pushed the feat/page-not-found-reference-widget branch from afd85ef to 97a63c1 Compare March 23, 2026 16:43
@pymnh
Copy link
Contributor Author

pymnh commented Mar 23, 2026

The "not found" preview now has the same size as regular page previews

image

…ssible

Signed-off-by: Peymaneh <peymaneh@posteo.net>
@pymnh pymnh force-pushed the feat/page-not-found-reference-widget branch from 06d84b6 to afec771 Compare March 23, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants