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

fix(DiffViewer & ArticleViewer): handle moved articles using MediaWik… #6072

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Abishekcs
Copy link
Contributor

closes #6056

What this PR does

This PR addresses an issue where the DiffViewer and ArticleViewer components did not handle moved articles correctly, resulting in errors for DiffViewer and Could not fetch authorship data: Requested page not found. [404] for ArticleViewer.

Fix

Check the current article title by fetching it from the Wikipedia API using the article's page ID. If it matches, do not update the Redux store; otherwise, update the title and URL for the respective article.

NOTE: The article title will only be cross-checked for articles when the user wants to view the "Current Version w/ Authorship Highlighting" or "Show Cumulative Changes."

Screenshots

Before:

Before.mp4

After:

After.mp4

…i page ID

- Added "crossCheckArticleTitle" function to verify and update article titles and URLs using the MediaWiki API based on the page ID.
- Introduced "UPDATE_ARTICLE_TITLE_AND_URL" action in the reducer to update article titles and URLs in the Redux store when article title is
  changed.
- Modified "fetchMissingArticleDetails" of Article used by DiffViewer & ArticleViewer to pass article.title and article.mw_page_id for title
  verification.
- Updated "fetchArticleDetails" to integrate "crossCheckArticleTitle" for dynamic title validation and updates before fetching article details.
- Enhanced handling of moved articles by verifying and updating titles via MediaWiki API by using "crossCheckArticleTitle" in ArticleViewer.
@Abishekcs Abishekcs marked this pull request as draft December 20, 2024 14:16
@Abishekcs Abishekcs force-pushed the fix/diffviewer-handle-moved-articles branch from 3a99736 to f4a8315 Compare December 22, 2024 10:25
@Abishekcs
Copy link
Contributor Author

I don't know why the build is failing for the test article_viewer_spec.rb. It’s passing for me locally.😅

2024-12-22.18-19-58.mp4

@Abishekcs Abishekcs marked this pull request as ready for review December 22, 2024 13:28
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.

DiffViewer breaks if article has been moved
1 participant