Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sundry fixes #865

Merged
merged 4 commits into from
Dec 9, 2024
Merged

Sundry fixes #865

merged 4 commits into from
Dec 9, 2024

Conversation

mruwnik
Copy link
Collaborator

@mruwnik mruwnik commented Dec 8, 2024

  • fix the subcategories bug
  • don't show deleted articles
  • allow /question/<pageid> redirects

image

@@ -21,6 +26,17 @@ import {ArticlesNavManualList} from '~/components/ArticlesNav/ArticleNavManualLi
export const LINK_WITHOUT_DETAILS_CLS = 'link-without-details'

export const loader = async ({request, params}: LoaderFunctionArgs) => {
const {data: redirects} = await loadRedirects(request)

// Check if we need to redirect to a new path
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

/questions/<page id> redirects weren't working, because they were being caught by this route and rendered as normal questions

Copy link
Collaborator

Choose a reason for hiding this comment

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

https://aisafety.info/questions/8TJV/How-can-I-help
now renders as "deleted", but the redirection is not working (see https://coda.io/d/AI-Safety-Info_dfau7sl2hmG/Redirects_suCc9XjM#Redirects_tuDQLOm3)
This is a local improvement over the previous situation, but I'd still rather redirections take priority over deleted articles

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like all redirections now fail, https://aisafety.info/help won't resolve either

@@ -163,6 +179,8 @@ export default function RenderArticle() {
return (
<Error error={{statusText: 'Could not fetch question', status: 'emptyArticle'}} />
)
} else if (resolvedQuestion.data.status === QuestionStatus.TO_DELETE) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

any other states that should display errors?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Duplicate
They are used essentially in the same way, they can both have the same error msg.

({tags, status}) =>
tags?.includes(INTRODUCTORY) ||
tags?.includes(ADVANCED) ||
status === QuestionStatus.SUBSECTION
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this could mess up things - if a subsection isn't tagged as introductory or advanced then it may show up somewhere it shouldn't. This seemed like the simplest way to do it, though

Copy link
Collaborator

Choose a reason for hiding this comment

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

Subsections are actually never tagged as either introductory or advanced, only sections are tagged as such. Still, I think the code makes sense. Did you mean that weird things will happen if a subsection is tagged as introductory or advanced?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know if they will happen, but I'm not certain that they won't...

@mruwnik
Copy link
Collaborator Author

mruwnik commented Dec 8, 2024

why are the tests failing... :/

@mruwnik
Copy link
Collaborator Author

mruwnik commented Dec 8, 2024

aha. Npm is having problems...
image

Aprillion
Aprillion previously approved these changes Dec 9, 2024
@mruwnik mruwnik merged commit 11c406a into master Dec 9, 2024
1 check passed
@mruwnik mruwnik deleted the sundry-fixes branch December 9, 2024 11:44
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.

3 participants