Expand all

mw.echo.ui.CrossWikiNotificationItemWidget

Extends

Constructor

new mw.echo.ui.CrossWikiNotificationItemWidget(controller, model, [config]) #

Cross-wiki notification item widget. This widget is expandable and displays groups of notification item lists by their sources.

TODO: When we have local bundles (without groups of lists) we can separate the "expand" functionality and UI to another mixin so we can use it with both widgets.

Parameters:

Name Type Attributes Description
controller mw.echo.Controller

Echo notifications controller

model mw.echo.dm.CrossWikiNotificationItem

Notification group model

config Object optional

Configuration object

Mixes in:
Source:
Cross-wiki notification item widget.

Methods

checkShowTitles() #

Check whether the titles should be shown and toggle them in each of the group lists.

Source:

Check whether the titles should be shown and toggle them in each of the group lists.

destroy() #

Disconnect events when widget is destroyed.

Inherited from:
Source:
Disconnect events when widget is destroyed.

expand() #

Expand the group and fetch the list of notifications. Only fetch the first time we expand.

Source:
Expand the group and fetch the list of notifications.

getId() → {number} #

Get the notification Id

Inherited from:
Source:

Returns:

Notification id

Type
number
Get the notification Id

getList() → {mw.echo.ui.SortedListWidget} #

Get the list widget contained in this item

Source:

Returns:

List widget

Type
mw.echo.ui.SortedListWidget
Get the list widget contained in this item

getModel() → {mw.echo.dm.NotificationItem} #

Get the model associated with this widget.

Inherited from:
Source:

Returns:

Item model

Type
mw.echo.dm.NotificationItem
Get the model associated with this widget.

getPrimaryUrl() → {string} #

Get the notification link

Inherited from:
Source:

Returns:

Notification link

Type
string
Get the notification link

getTimestamp() → {number} #

Get the item id

Inherited from:
Source:

Returns:

Notification id

Type
number
Get the item id

isFake() → {boolean} #

Declares whether this widget is a cloned fake.

Inherited from:
Source:

Returns:

false

Type
boolean
Declares whether this widget is a cloned fake.

isForeign() → {boolean} #

Check whether this item is foreign.

Inherited from:
Source:

Returns:

Item is foreign

Type
boolean
Check whether this item is foreign.

isRead() → {boolean} #

Check whether this item is read.

Inherited from:
Source:

Returns:

Item is read

Type
boolean
Check whether this item is read.

isSeen() → {boolean} #

Check whether this item is seen.

Inherited from:
Source:

Returns:

Item is seen

Type
boolean
Check whether this item is seen.

markRead([isRead]) #

Mark this notification as read

Parameters:

Name Type Attributes Default Description
isRead boolean optional
true

Notification is marked as read

Overrides:
Source:
Mark this notification as read

onMarkAsReadButtonClick() #

Respond to mark as read button click

onModelDiscard(groupName) #

Respond to model removing source group

Parameters:

Name Type Description
groupName string

Symbolic name of the group

Source:
Respond to model removing source group

onPopupButtonWidgetChoose(item) #

Manage a click on a dynamic secondary link. We can't know what the link intends us to do in the API, so we trust the 'apiParams' to tell the controller. When the link is clicked, we will pass the information on to the controller, which will manage whatever promise and action is needed.

NOTE: The messages are parsed as HTML. If user-input is expected please make sure to properly escape it.

Parameters:

Name Type Description
item OO.ui.ButtonOptionWidget

The selected item

Inherited from:
Source:
Manage a click on a dynamic secondary link.

onPrimaryLinkClick() → {boolean} #

Respond to primary link click. Override this in the descendents.

Inherited from:
Source:

Returns:

true

Type
boolean
Respond to primary link click.

populateFromModel() #

Populate the items in this widget according to the data in the model

Source:

Populate the items in this widget according to the data in the model

resetInitiallyUnseen() #

Remove the 'initiallyUnseen' class, which was only used for the unseen animation when the user has first seen it.

Inherited from:
Source:

Remove the 'initiallyUnseen' class, which was only used for the unseen animation when the user has first seen it.

showErrorMessage(label, link) #

Show an error message

Parameters:

Name Type Description
label string

Error label

link string

Error link

Source:
Show an error message

toggleExpanded(show) #

Toggle the expand/collapsed state of this group widget

Parameters:

Name Type Description
show boolean

Show the widget expanded

Source:
Toggle the expand/collapsed state of this group widget

toggleListDisplay(showList) #

Toggle the visibility of the notification item list and the placeholder/error widget.

Parameters:

Name Type Description
showList boolean

Show the list

Source:
Toggle the visibility of the notification item list and the placeholder/error widget.

toggleMarkAsReadButtons([showMarkAsRead]) #

Toggle the function of the 'mark as read' buttons from 'mark as read' to 'mark as unread' and vice versa.

Parameters:

Name Type Attributes Description
showMarkAsRead boolean optional

Show the 'mark as read' buttons

  • "false" means that the item is marked as read, whereby we show the user 'mark unread' buttons.
  • "true" means that the item is marked as unread and we show the user 'mark as read' buttons
Inherited from:
Source:

Toggle the function of the 'mark as read' buttons from 'mark as read' to 'mark as unread' and vice versa.

toggleRead([read]) #

Toggle the read state of the widget

Parameters:

Name Type Attributes Description
read boolean optional

The current read state. If not given, the state will become the opposite of its current state.

Inherited from:
Source:
Toggle the read state of the widget

toggleSeen([seen]) #

Toggle the seen state of the widget

Parameters:

Name Type Attributes Description
seen boolean optional

The current seen state. If not given, the state will become the opposite of its current state.

Inherited from:
Source:
Toggle the seen state of the widget

toggleTitles([show]) #

Toggle the visibility of the titles

Parameters:

Name Type Attributes Description
show boolean optional

Show titles

Source:
Toggle the visibility of the titles

updateExpandButton() #

Update the expand button label

Source:
Update the expand button label