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: should use apiTitle and language code when updating bookmark status #1703

Merged
merged 1 commit into from Oct 14, 2020

Conversation

cooltey
Copy link
Collaborator

@cooltey cooltey commented Oct 13, 2020

Related to #1695

When adding an article that the getDisplayText() is not the same as the getPrefixedText(), the bookmark icon will not change its status correctly.

e.g.
https://zh.wikipedia.org/wiki/核武器 in zh-hant

apiTitle => 核武器
displayTitle => 核子武器

@@ -855,7 +855,8 @@ public void accept(Object event) {
return;
}
for (ReadingListPage page : ((ArticleSavedOrDeletedEvent) event).getPages()) {
if (page.title().equals(pageFragment.getTitleOriginal().getDisplayText())) {
if (page.apiTitle().equals(pageFragment.getTitleOriginal().getPrefixedText())
&& page.wiki().languageCode().equals(pageFragment.getTitleOriginal().getWikiSite().languageCode())) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't the language code check unnecessary, since it will not meet the title condition if the languages are different?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is necessary if the article has different language variants. They will use the same apiTitle with different language code to request the endpoints. e.g. zh-hant vs zh-hans

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah! ok.. makes sense..

@sharvaniharan sharvaniharan merged commit 56b821d into master Oct 14, 2020
@sharvaniharan sharvaniharan deleted the fix-bookmark branch October 14, 2020 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants