Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ProtectCore

Module used for requesting page protection, for tagging pages with protection templates and actually applying protection.

Localisation: This is an abstract class. The following abstract methods must be implemented:

In addition, the following methods and fields should be overridden:

See enwiki localisation at https://github.com/wikimedia-gadgets/twinkle-enwiki/blob/master/src/protect.ts

Hierarchy

Index

Constructors

constructor

Properties

currentProtectionLevels

currentProtectionLevels: Record<string, { admin?: string; cascade?: boolean; expiry: string; level: string; source?: string }> = {}

disableTaggingOnRedirectTemplateRegex

disableTaggingOnRedirectTemplateRegex: RegExp = null

Regex matching the redirect category shell template whose existence removes the need to add a protection template to the redirect since the shell auto-detects it. This should be null if the wiki has no such template.

existingRequestRegex

existingRequestRegex: RegExp = null

Regex expression to search for an existing request on the request page, and abort if found. Leaving this null (default) means that no check for existing request is performed.

existingTagRegex

existingTagRegex: RegExp = null

Regex that matches protection tags already existing on the page. Leaving this as null (default) means that no existing tag detection takes place.

footerlinks

footerlinks: {}

Set of links shown in the bottom right of the module dialog. Object keys are labels and values are the wiki page names.

Type declaration

  • [label: string]: string

formevents

formevents: { createlevel: any; editlevel: any; editmodify: any; movelevel: any; movemodify: any; pclevel: any; pcmodify: any; tagtype: any } = ...

Type declaration

hasFlaggedRevs

hasFlaggedRevs: boolean = ...

hasProtectLog

hasProtectLog: boolean

hasStableLog

hasStableLog: boolean

isTemplate

isTemplate: boolean = ...

moduleName

moduleName: string = 'protect'

portletId

portletId: string = 'twinkle-protect'

Optional ID for the portlet. This defaults to twinkle-${portletName.toLowerCase()} if unspecified

portletName

portletName: string = ...

Name displayed on the portlet

portletTooltip

portletTooltip: string = ...

Tooltip shown when hovering on the portlet

protectLog

protectLog: false | LogEvent[]

protectReasonAnnotations

protectReasonAnnotations: any[] = []

protectionPresetsInfo

protectionPresetsInfo: Record<string, { create?: string; edit?: string; expiry?: string; move?: string; reason?: string; stabilize?: string; template?: string }> = {}

protectionTags

protectionTags: quickFormElementData[] = []

requestPageAcronym

requestPageAcronym: string = 'RfPP'

Short form or acronym for the requestPageName. Used in text. Usage is not in form of a link so this doesn't necessarily need to be a redirect to the requestPageName.

requestPageName

requestPageName: string = 'Wikipedia:Requests for page protection'

Full name of the page where protection requests are placed.

stableLog

stableLog: false | LogEvent[]

watched

watched: string | boolean

windowTitle

windowTitle: string = ...

Static moduleName

moduleName: string = 'protect'

The name of the module, used to check if the user has the module disabled

Methods

addMenu

  • addMenu(): void

addPreference

  • addPreference(pref: any): void

annotateProtectReason

  • annotateProtectReason(e: any): void

canTag

  • canTag(): boolean

changeAction

  • changeAction(e: any): void

changePreset

  • changePreset(e: any): void

doCustomExpiry

  • doCustomExpiry(target: any): void

evaluate

  • evaluate(e: any): boolean

fetchProtectingAdmin

  • fetchProtectingAdmin(api: any, pageName: any, protType: any, logIds?: any): any

fetchProtectionLevel

  • fetchProtectionLevel(): void

fileRequest

  • fileRequest(rppPage: Page, input: { category: string; expiry: string; reason: string }): PromiseBase<api, any, any, api, any, any, api, any, any, api, any, any>
  • Parameters

    • rppPage: Page
    • input: { category: string; expiry: string; reason: string }
      • category: string
      • expiry: string
      • reason: string

    Returns PromiseBase<api, any, any, api, any, any, api, any, any, api, any, any>

Abstract getCreateProtectionPresets

  • getCreateProtectionPresets(): quickFormElementData[]

getProtectionLengths

  • getProtectionLengths(): { label: string; value: string }[]

getProtectionLevels

  • getProtectionLevels(): Record<string, { applicable?: boolean | ((type: string) => boolean); defaultSelected?: true; label: string; types: ("edit" | "move" | "create" | "stable")[]; weight: number }>
  • Returns Record<string, { applicable?: boolean | ((type: string) => boolean); defaultSelected?: true; label: string; types: ("edit" | "move" | "create" | "stable")[]; weight: number }>

Abstract getProtectionPresets

  • getProtectionPresets(): quickFormElementData[]

getRequestTextAndSummary

  • getRequestTextAndSummary(input: any): [string, string]
  • Returns the request text and edit summary.

    Parameters

    • input: any

    Returns [string, string]

    • the first string is the request text, second string is the edit summary

Private getTypeNameAndReason

  • getTypeNameAndReason(list: any, selection: any, parentLabel?: any): [string, string]

insertTagIntoPage

  • insertTagIntoPage(text: string, tag: string): string
  • Insert tag into the page. You may want to override this to have the tag inserted after short description or hatnotes

    Parameters

    • text: string
    • tag: string

    Returns string

makeWindow

  • makeWindow(): void

showLogAndCurrentProtectInfo

  • showLogAndCurrentProtectInfo(): void

taggingPage

  • taggingPage(params: any): PromiseBase<any, any, any, any, any, any, any, any, any, any, any, any>

Static userPreferences

Generated using TypeDoc