feat(PageReference): Preview "Page not found" if page is not accessible#2343
feat(PageReference): Preview "Page not found" if page is not accessible#2343
Conversation
1b8a148 to b9e1846 Compare b9e1846 to 70409ac Compare | Psalm error looks unrelated to me, I did not touch the dependencies.. |
| 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? |
70409ac to e400b96 Compare e400b96 to afd85ef Compare | 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. |
| 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? |
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 😉 |
afd85ef to 97a63c1 Compare 06d84b6 to afec771 Compare src/views/PageReferenceWidget.vue Outdated
| // Only consider rerouting if we're inside the collectives app excluding public shares) and for links to | ||
| // collectives app. | ||
| if (window.OCA.Collectives?.vueRouter | ||
| && !this.isPublic |
There was a problem hiding this comment.
I don't understand the rationale behind this change. In public shares I still want links to other pages in this collectives to be opened by re-routing them, not in a new tab, no?
There was a problem hiding this comment.
Maybe I misunderstand the the rerouting logic here. What I wanted to achieve here was to not reroute within the collectives page if I am an unauthenticated user accessing a public share, since I would be prompted with a useless left sidebar and a greyed out settings button in the left corner.
There was a problem hiding this comment.
Duh, now I get it! 🤦♀️ Of course, you are right! Simply removing the link handler is the correct way.
src/views/PageReferenceWidget.vue Outdated
| :href="richObject.link" | ||
| target="_blank" | ||
| class="collective-page not-found" | ||
| @click="clickLink"> |
There was a problem hiding this comment.
I'd remove the click handler here as I'd expected links to unknown pages to be opened in a new tab, instead of trying to reroute them via vue-router.
There was a problem hiding this comment.
I'll go ahead and push the to changes I suggested to still get this into the next release. I hope that's ok for you.
Sure thing!
I'd remove the click handler here as I'd expected links to unknown pages to be opened in a new tab, instead of trying to reroute them via vue-router.
See my other comment
…ssible Signed-off-by: Peymaneh <peymaneh@posteo.net>
afec771 to 04a391f Compare * Don't try to re-route not found pages via vue-router, open them as normal link (in new tab) instead. * Keep the re-routing via vue-router for resolved page links in public shares. Signed-off-by: Jonas <jonas@freesources.org>
04a391f to 1fbf129 Compare 

📝 Summary
Change
accessible = falseif current user cannot resolveaccessible = 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 linkReasoning:
🖼️ Screenshots
🏚️ Before
🏡 After
🚧 TODO
accessibleproperty is the right place to indicate that a "resource not found" message should be displayed🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)