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

Edits should never create an empty page #2412

Closed
ragesoss opened this issue Jan 23, 2019 · 13 comments · Fixed by #5518
Closed

Edits should never create an empty page #2412

ragesoss opened this issue Jan 23, 2019 · 13 comments · Fixed by #5518

Comments

@ragesoss
Copy link
Member

In some cases, such as an assignment being added and then removed again before the edit job is run, the dashboard may create a page that doesn't exist already, but make it empty. Ideally, this should not happen; in such cases, it should just leave the page as a redlink.

@mcastorena0316
Copy link

@ragesoss hi Sage, Oureachy applicant here, can I work on this? Thanks and have wonderful weekend.

@ragesoss
Copy link
Member Author

ragesoss commented Mar 6, 2020

@mcastorena0316 go for it!

@mcastorena0316
Copy link

Hi @ragesoss I am writing cause I have a few questions and I want to understand more about this bug you are having.

I already clone and run in my local environment the application and do a little tryouts by myself.

When I create a program, a page link appears so everyone can enroll in it. If I tried to delete it directly from the program's page, it appears that I need to erase the campaign first, but when I enter directly to the campaign, I am able to remove it.

I realize that when I remove it, I still am able to enter the course's link, even though it's already deleted. It this the bug you want me to work on? If not, can you please give me a little more info about it? I'm adding some pictures of it. Thanks!

Default Campaign Programs — Programs and Events Dashboard - Mozilla Firefox_008
Default Campaign Programs — Programs and Events Dashboard - Mozilla Firefox_007
Test Program — Programs and Events Dashboard - Mozilla Firefox_006
Test Program — Programs and Events Dashboard - Mozilla Firefox_005

@ragesoss
Copy link
Member Author

ragesoss commented Mar 7, 2020

Hi @mcastorena0316 !

This bug is referring to the edits to Wikipedia that the Dashboard makes. In particular, WikiCourseEdits makes edits on the wiki to reflect actions users take on the Dashboard, including the update_assignments method that posts templates to article talk pages when a student adds an article as their assignment. See the recent edits to this talk page for example: https://en.wikipedia.org/w/index.php?title=Talk:Education_in_Ontario&action=history

If a student adds an assignment, and then later removes it, the Dashboard will first make an edit adding a template to the talk page, and then later will make an edit removing that template. These edits are done through background jobs via Sidekiq.

The bug in this case is when a student adds an assignment, but then immediately removes it again, and the article they assigned doesn't even have a talk page yet (so adding the assignment should have started that talk page via the update_assignments action). If they remove the assignment before the job gets run in the sidekiq queue, then no template will be added via update_assignments. But the remove_assignment job (if it already started) may still execute, and since there's no template to remove, it will simply post an empty talk page... but that's different from a nonexistent page. So the talk page will exist on Wikipedia, but with no content and a useless edit in the history.

@Gaurav453
Copy link

Hey @ragesoss , Is this bug is still open and if yes should I try to fix this ?

@ragesoss
Copy link
Member Author

ragesoss commented Feb 8, 2021

@Gaurav453 go for it. It's still open.

@vaidehi44
Copy link
Contributor

@ragesoss, seems like to reproduce this bug, I will have to first find an article which doesn't have a talk page. How can I find such an article?

@ragesoss
Copy link
Member Author

I don't think it's necessary to have a live page without a talk page on Wikipedia production in order to fix this bug. While you won't be able to reproduce it in terms of configuring your dev environment to make live edits on Wikipedia — which you probably should not do anyway — you can still write a test for it by mocking the Wikipedia response for a non-existent page.

@ragesoss
Copy link
Member Author

I think WikiAssignmentOutput is the place to start.

@vaidehi44
Copy link
Contributor

vaidehi44 commented Apr 18, 2022

def build_talk_page_update
# If a course changed state so that it has no on-wiki course page, don't post.
return nil if @course_page.nil?
initial_page_content = WikiApi.new(@wiki).get_page_content(@talk_title)
# This indicates an API failure, which may happen because of rate-limiting.
# A nonexistent page will return empty string instead of nil.
return nil if initial_page_content.nil?

@ragesoss, is this existing part of code related to this issue in some way? I mean, from the comment it seems that this piece of code handles the same case as mentioned in the issue.

@ragesoss
Copy link
Member Author

Yes, this is closely related. There are a number of other situations where we already return nil from this method (which means, don't make an edit) because of the guard statements around here, but we don't handle the specific situation of trying to remove a template from a page that doesn't exist.

@gabina
Copy link
Member

gabina commented Oct 20, 2023

I'm working on this!

@gabina
Copy link
Member

gabina commented Oct 23, 2023

@ragesoss I opened a PR for this issue but have some concerns as I'm not entirely sure the PR addresses all the necessary changes. Appreciate your feedback whenever you have the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants