Subscriptions

Subscriptions

Implementation of the subscriptions feature in general terms. It is extended by DisussionTools' topic subscription and CD's legacy section watching.

Constructor

new Subscriptions()

Source:

Create a subscriptions instance. It is supposed to be used as a singleton returned by controller.getSubscriptionsInstance.

Methods

getState(subscribeId) → (nullable) {boolean}

Source:

Get the subscription state of a section or the page.

Parameters:
Name Type Description
subscribeId string
Throws:
Returns:
Type
boolean

getType() → {string}

Source:

Get the subscriptions type. In practice, returns 'dt' or 'legacy' based on the used class.

Returns:
Type
string

itemsToKeys(arr) → {Array.<object>}

Source:

For internal use. Convert the subscription list to the standard format, with section IDs as keys instead of array elements, to store it.

Parameters:
Name Type Description
arr Array.<string>

Array of section IDs.

Returns:
Type
Array.<object>

(async) loadToTalkPage(bootProcessopt, …argsopt)

Source:

Do everything .load does and also perform manipulations with the talk page.

Parameters:
Name Type Attributes Description
bootProcess BootProcess <optional>
args * <optional>
<repeatable>

processOnTalkPage()

Source:

Process subscriptions when they are loaded to a talk page.

(async) subscribe(subscribeId, id, unsubscribeHeadlineopt, quietopt)

Source:

Subscribe to a section.

Parameters:
Name Type Attributes Default Description
subscribeId string

Section's DiscussionTools ID.

id string

Section's ID.

unsubscribeHeadline string <optional>

Headline of a section to unsubscribe from (at the same time).

quiet boolean <optional>
false

Don't show a success notification.

(async) unsubscribe(subscribeId, id, quietopt, sectionopt)

Source:

Unsubscribe from a section.

Parameters:
Name Type Attributes Default Description
subscribeId string

Section's DiscussionTools ID.

id string

Section's ID.

quiet boolean <optional>
false

Don't show a success notification.

section Section <optional>

Section being unsubscribed from, if any, for legacy subscriptions.

(protected) updateLocally(subscribeId, subscribe)

Source:

Update the subscription list by adding or removing a subscription, without saving anything to the server.

Parameters:
Name Type Description
subscribeId string

Section's subscribe ID (modern or legacy format).

subscribe boolean

Subscribe or unsubscribe.