Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Make audio/image pages without ids show a 404 #768

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

sarayourfriend
Copy link
Contributor

Fixes

Fixes #496 by @obulat

Description

Adds an index.vue to the image and audio page directories so that we can render a 404 page when a single result route without an id is hit.

I'm not sure if this is really the right way to do this... I couldn't find any solid evidence about this and redirecting to /404 seems incorrect for some reason. If we prefer that though, we can do that instead of this. I do like that this is a little more on the "declarative" side of things rather than programatically testing the route.

Testing Instructions

Checkout the branch and run pnpm dev. Visit /image/ without an id and /audio/ without an id and verify that they show the 404 page.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@sarayourfriend sarayourfriend added 🟨 priority: medium Not blocking but should be addressed soon 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository labels Feb 1, 2022
@sarayourfriend sarayourfriend requested a review from a team as a code owner February 1, 2022 13:39
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quite like this approach, as it also allows us to more easily make our error page support different error types, not just 404s. Something like:

 <VFourOhFour v-if="error.code === '404'" :error="error" />

@sarayourfriend sarayourfriend enabled auto-merge (squash) February 1, 2022 14:39
Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the name VFourOhFour. @panchovm what are your thoughts on i18n-ifying the "Oops" in the future?

@sarayourfriend sarayourfriend merged commit fc28dd0 into main Feb 2, 2022
@sarayourfriend sarayourfriend deleted the fix/idless-single-result-page branch February 2, 2022 11:50
@zackkrida
Copy link
Member

My instinct would be to keep "Oops" as an sr-only decorative choice. I think it'd be really difficult to style with different string lengths.

@fcoveram
Copy link

fcoveram commented Feb 2, 2022

Agree with @zackkrida. Besides, the design intends to be use across the WP site. Although I like the idea and worth raising it once people start redesigning other site sections.

rbadillap added a commit that referenced this pull request Feb 2, 2022
* main: (73 commits)
  Make audio/image pages without ids show a 404 (#768)
  Fix logo button paddings and simplify implementation (#767)
  Fix global audio rtl close placement (#780)
  Check for `null` localStorage explicitly (#763)
  Truncate global audio text to two lines (#773)
  New image details page (#682)
  Switch to path-based i18n routing (#701)
  Enable source maps in production (#755)
  Remove Jamendo and Wikimedia Commons from audio meta sources (#747)
  Use jed1x json format to correctly handle pluralization (#753)
  Fix logo color on error page layout (#752)
  Add homepage content switcher for mobile screens (#716)
  Add inline-start border to filters on desktop (#748)
  Fix header items not fitting in (#718)
  Expose `close` to popover content via slot props (#736)
  Truncate row layout audio titles (#735)
  Stop blocking on analytics requests (#715)
  Style links globally (#727)
  Refactor the usage of i18n result count computation (#707)
  Use `VPopover` for the content report form (#719)
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Going to /photos/ without an id should not fetch
4 participants