Jump to content

MediaWiki:SubmitWizard.js/doc

From Wikinews, the free news source you can write!

This script provides a user friendly interface to simplify the article development life cycle and review process on English Wikinews. It is built using Vue.js and the @wikimedia's codex design system.

The script provides dialogs and notifications for various actions, and can be triggered by other scripts or templates by adding specific URL parameters to the page.

Core Actions and Logic

The script can perform several distinct actions, each with its own logic.

Submit for Review

This is the primary function of the script, allowing users to submit a draft for review.

  • Trigger: Can be triggered by the URL parameter ?page=Current_Page_Name or manually.
  • Algorithm:
    • The script first performs security checks:
      • It checks that the user is on en.wikinews.org or en.m.wikinews.org.
      • It checks that the page is in the article namespace (Namespace 0).
    • It fetches the current page content.
    • It checks if the article has an "exemption template" (e.g., {{Original reporting}}, {{Interview}}).
    • If no exemption template is found:
      • It counts the number of {{source}} templates.
      • If the source count is less than 2, it shows a "insufficient sources" warning and stops.
    • If the article has an exemption or 2+ sources:
      • It removes any maintenance templates (e.g., {{Develop}}, {{Stale}}, {{Abandoned}}).
      • It checks if the {{Review}} template already exists. If yes, it shows an "already submitted" warning and stops.
      • It shows a confirmation dialog ("Are you sure you want to submit...").
    • On user confirmation:
      • It prepends the {{Review}} template to the cleaned page content.
      • It saves the page with the edit summary: "Submitting article for review (via SubmitWizard)".
      • It reloads the page upon successful edit.

Request Assistance (Help Me)

This action allows an author to request help from other editors.

  • Trigger: Can be triggered by the URL parameter ?helpme=1.
  • Algorithm:
    • Performs the security checks (Host and Namespace).
    • It fetches the current page content.
    • It checks if the {{Helpneeded}} template already exists. If yes, it shows an "already requested help" warning and stops.
    • It shows a dialog box with information about requesting help, including links to the Water Cooler/Assistance page and the Telegram group.
    • On user clicking "Request Help":
      • It prepends the {{Helpneeded}} template to the page content.
      • It saves the page with the edit summary: "Requesting assistance".
      • It reloads the page.


Find Abandoned Article to Help

This feature helps editors find an article that needs work.

  • Trigger: Can be triggered by the URL parameter ?helpabandoned=1.
  • Algorithm:
    • It first queries Category:Article assistance requested.
    • If articles are found in that category (and are not the current page):
      • It randomly selects one article and redirects the user to it.
    • If that category is empty:
      • It queries Category:Review.
      • It filters the list to find "abandoned" articles (last edited more than 5 days ago), excluding the current page.
      • If abandoned articles are found, it randomly selects one and redirects the user.
      • If no abandoned articles are found, it randomly selects any other article from Category:Review (excluding the current page) and redirects the user.
      • If no other articles are found at all, it shows a notification.

Pre-Review Actions

This opens a dialog that lets a user either request a pre-review or perform one.

  • Trigger: Can be triggered by the URL parameter ?pre-review=1.
  • Algorithm:
    • Performs the security checks (Host and Namespace).
    • It opens a dialog with two buttons: "Request Pre Review" and "Perform Pre Review".
  • Sub-Action: Request Pre Review
    • If the user clicks "Request Pre Review".
    • It checks if the {{Pre-review}} template already exists. If yes, it shows a warning.
    • Otherwise, it prepends the {{Pre-review}} template to the page.
    • It saves the page with the edit summary: "Requesting pre-review".
    • It reloads the page.
  • Sub-Action: Perform Pre Review
    • If the user clicks "Perform Pre Review" (or triggers with ?pre-review-perform=1).
    • It dynamically loads another script: MediaWiki:SubmitWizard/Pre-Review.js.
    • It then calls the triggerPreReviewAction() function from that newly loaded script.
    • (Note: The actual logic for performing the pre-review is contained in MediaWiki:SubmitWizard/Pre-Review.js, not this script.)