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

Fixed 500 link limit for loading training slides (ISSUE: #5588) #5596

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

thekavikumar
Copy link
Contributor

What this PR does

This pull request adds the ability to load links from the wiki without limiting them to 500.

Screenshots

Before:
image

After:
image

@thekavikumar
Copy link
Contributor Author

@ragesoss please have a look at my PR

@ragesoss
Copy link
Member

Are the changes to the Gemfile necessary as part of this PR?

@ragesoss
Copy link
Member

I tried this locally and got the following error:

NoMethodError: undefined method `dig' for #<MediawikiApi::Response:0x00007f3811e874c0 @response=#<Faraday::Response:0x00007f37fb4ca240 @on_complete_callbacks=[], @env=#<Faraday::Env @method=:get @url=#<URI::HTTPS https://meta.wikimedia.org//w/api.php?action=query&format=json&pllimit=500&prop=links&titles=Training+modules%2Fdashboard%2Fmodules> @request=#<Faraday::RequestOptions (empty)> @request_headers={"User-Agent"=>"Faraday v1.10.2"} @ssl=#<Faraday::SSLOptions verify=true> @response=#<Faraday::Response:0x00007f37fb4ca240 ...> @response_headers={"date"=>"Mon, 12 Feb 2024 19:11:59 GMT", "server"=>"mw2338.codfw.wmnet", "x-content-type-options"=>"nosniff", "x-frame-options"=>"DENY", "content-disposition"=>"inline; filename=api-result.json", "vary"=>"Accept-Encoding,Treat-as-Untrusted,X-Forwarded-Proto,Cookie", "cache-control"=>"private, must-revalidate, max-age=0", "content-type"=>"application/json; charset=utf-8", "age"=>"0", "x-cache"=>"cp4038 miss, cp4038 pass", "x-cache-status"=>"pass", "server-timing"=>"cache;desc=\"pass\", host;desc=\"cp4038\"", "strict-transport-security"=>"max-age=106384710; includeSubDomains; preload", "report-to"=>"{ \"group\": \"wm_nel\", \"max_age\": 604800, \"endpoints\": [{ \"url\": \"https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0\" }] }", "nel"=>"{ \"report_to\": \"wm_nel\", \"max_age\": 604800, \"failure_fraction\": 0.05, \"success_fraction\": 0.0}", "set-cookie"=>"WMF-Last-Access=12-Feb-2024;Path=/;HttpOnly;secure;Expires=Fri, 15 Mar 2024 12:00:00 GMT, GeoIP=US:WA:Seattle:47.67:-122.34:v4; Path=/; secure; Domain=.wikimedia.org, NetworkProbeLimit=0.001;Path=/;Secure;Max-Age=3600", "x-client-ip"=>"75.172.66.198", "accept-ranges"=>"bytes", "transfer-encoding"=>"chunked"} @status=200 @reason_phrase="OK" @response_body="{\"batchcomplete\":\"\",\"query\":{\"pages\":{\"10167630\":{\"pageid\":10167630,\"ns\":0,\"title\":\"Training modules/dashboard/modules\",\"links\":[{\"ns\":2,\"title\":\"User:Astinson (WMF)/dashboard modules/defining-your-event.json\"},{\"ns\":2,\"title\":\"User:Astinson (WMF)/dashboard modules/planning-leading-up-to-the-event.json\"},{\"ns\":2,\"title\":\"User:Astinson (WMF)/dashboard modules/planning-well-before-the-event.json\"},{\"ns\":2,\"title\":\"User:GFontenelle (WMB)/dashboard modules/carregue-o-acervo-do-seu-glam-nas-plataformas-wikimedia.json\"},{\"ns\":2,\"title\":\"User:GFontenelle (WMB)/dashboard modules/compartilhe-seu-glam-no-ecossistema-wikimedia.json\"},{\"ns\":2,\"title\":\"User:GFontenelle (WMB)/dashboard modules/introducao-ao-ecossistema-wikimedia.json\"},{\"ns\":2,\"title\":\"User:JSutherland (WMF)/dashboard modules/dealing with online harassment closing cases.json\"},{\"ns\":2,\"title\":\"User:JSutherland (WMF)/dashboard modules/dealing with online harassment communication.json\"},{\"ns\":2,\"title\":\"User:JSutherland (WMF)/dashboard modules/dealing with online harassment fundamentals.json\"},{\"ns\":2,\"title\":\"User:JSutherland (WMF)/dashboard modules/dealing with online harassment handling reports.json\"},{\"ns\":2,\"title\":\"User:JSutherland (WMF)/dashboard modules/dealing with online harassment other forms.json\"},{\"ns\":2,\"title\":\"User:JSutherland (WMF)/dashboard modules/keeping events safe.json\"},{\"ns\":2,\"title\":\"User:Jbuatti (WMF)/dashboard modules/handling-private-information.json\"},{\"ns\":2,\"title\":\"User:OShehata (WMF)/dashboard modules/using-the-dashboard.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/create-a-campaign.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/delete-a-program.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/editing-basics.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/editing-medical-topics.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/evaluating-articles.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/get-activity-from-multiple-wikis.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/images-and-media.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/plagiarism.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/sandboxes.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/set-up-an-editathon.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/set-up-wikipedia-education-program-course.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/sources.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/translating-articles.json\"},{\"ns\":2,\"title\":\"User:Ragesoss/dashboard modules/wikipedia-essentials.json\"},{\"ns\":2,\"title\":\"User:Sage (Wiki Ed)/dashboard modules/adding-to-data.json\"},{\"ns\":2,\"title\":\"User:Sage (Wiki Ed)/dashboard modules/article-scoped-programs.json\"},{\"ns\":2,\"title\":\"User:Sage (Wiki Ed)/dashboard modules/dashboard-admins.json\"},{\"ns\":2,\"title\":\"User:Sage (Wiki Ed)/dashboard modules/databases-and-linked-data.json\"},{\"ns\":2,\"title\":\"User:Sage (Wiki Ed)/dashboard modules/evaluating-wikidata.json\"},{\"ns\":2,\"title\":\"User:Sage (Wiki Ed)/dashboard modules/introduction-to-wikidata.json\"},{\"ns\":2,\"title\":\"User:Sage (Wiki Ed)/dashboard modules/querying-wikidata.json\"},{\"ns\":2,\"title\":\"User:Sage (Wiki Ed)/dashboard modules/wikidata-community.json\"},{\"ns\":2,\"title\":\"User:Sage (Wiki Ed)/dashboard modules/wikidata-wikiprojects.json\"},{\"ns\":2,\"title\":\"User:Stefan Schneider (WMDE)/dashboard modules/artikel-bewerten.json\"},{\"ns\":2,\"title\":\"User:Stefan Schneider (WMDE)/dashboard modules/diskutieren-basiswissen.json\"},{\"ns\":2,\"title\":\"User:Stefan Schneider (WMDE)/dashboard modules/editieren-basiswissen.json\"},{\"ns\":2,\"title\":\"User:Stefan Schneider (WMDE)/dashboard modules/wikipedia-basiswissen.json\"}]}}}}">>, @envelope=["query"]>

        current_links = response.dig('pages', @wiki_base_page, 'links') || []

@ragesoss ragesoss marked this pull request as draft February 14, 2024 22:55
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.

None yet

2 participants