LegacySubscriptions

LegacySubscriptions

Class implementing CD's legacy section watching.

Constructor

new LegacySubscriptions()

Source:

Extends

Methods

(protected) actuallySubscribe(headline, id, unsubscribeHeadlineopt) → {Promise.<undefined>}

Source:

Add a section present on the current page to the subscription list.

Parameters:
Name Type Attributes Description
headline string
id string

Unused.

unsubscribeHeadline string <optional>

Headline of section to unsubscribe from (used when a section is renamed on the fly in Comment#update or CommentForm#submit).

Throws:
Returns:
Type
Promise.<undefined>

areLoaded() → {boolean}

Source:

Test if the subscription list is loaded.

Returns:
Type
boolean

getForCurrentPage() → (nullable) {Array.<object>}

Source:

Get the subscription list for the current page.

Returns:
Type
Array.<object>

getForPageId(pageId) → (nullable) {Array.<object>}

Source:

Get the subscription list for a page.

Parameters:
Name Type Description
pageId number
Returns:
Type
Array.<object>

getOriginalState(headline) → {boolean}

Source:

Check whether the user was subscribed to a section when the page was loaded.

Parameters:
Name Type Description
headline string

Headline.

Returns:
Type
boolean

getPageIds() → {Array.<number>}

Source:

Get the IDs of pages that have subscriptions.

Returns:
Type
Array.<number>

getState(subscribeId) → (nullable) {boolean}

Source:
Inherited From:

Get the subscription state of a section or the page.

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

getType() → {string}

Source:
Inherited From:

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

Returns:
Type
string

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

Source:
Inherited From:

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) load(bootProcessopt, reuseopt) → {Promise.<undefined>}

Source:

Request the subscription list from the server and assign it to the instance.

Parameters:
Name Type Attributes Default Description
bootProcess BootProcess <optional>
reuse boolean <optional>
false

Reuse the existing request.

Returns:
Type
Promise.<undefined>

(async) loadToTalkPage(bootProcessopt, …argsopt)

Source:
Inherited From:

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

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

pack(allPagesData) → {string}

Source:

Convert a subscriptions object into an optimized string and compress it.

Parameters:
Name Type Description
allPagesData object
Returns:
Type
string

processOnTalkPage(…argsopt)

Source:
Overrides:

Process subscriptions when they are loaded to a talk page.

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

(async) save(allPagesData)

Source:

Save the subscription list to the server as a user option.

Parameters:
Name Type Description
allPagesData object

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

Source:
Inherited From:

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.

unpack(compressed)

Source:

Unpack a compressed subscriptions string into an object.

Parameters:
Name Type Description
compressed string

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

Source:
Inherited From:

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:
Overrides:

Update the subscription list by adding or removing a subscription. It's a local operation - nothing is saved to the server.

Parameters:
Name Type Description
subscribeId string

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

subscribe boolean

Subscribe or unsubscribe.

(protected) updatePageSubscribeButton()

Source:
Inherited From:

Update the page subscription button label and tooltip.