From 14b06b78e53621ec60cfab699d5e9bd3df55c452 Mon Sep 17 00:00:00 2001 From: Dr4goniez Date: Sat, 17 Aug 2024 07:09:41 +0900 Subject: [PATCH] Consistent Casing for "iconUrl" Replaced all occurrences of "iconURL" in the extension's repo with "iconUrl" after spotting a typo in `mw.echo.dm.NotificationItem.js#13`, "iconUrl" (find the correct "iconURL" in `mw.echo.Controller.js#394` in the diff). Thankfully the typo was only in the documentation block, but given the casing of other config object properties like "primaryUrl" and "secondaryUrl", it would be best to make them all consistent to prevent any bug that could happen in the future. Change-Id: I56e6a1d2c7695204b35e767679a27ee22b3fe4bc --- includes/Formatters/EchoFlyoutFormatter.php | 4 ++-- includes/Formatters/SpecialNotificationsFormatter.php | 4 ++-- modules/controller/mw.echo.Controller.js | 2 +- modules/model/mw.echo.dm.BundleNotificationItem.js | 2 +- modules/model/mw.echo.dm.NotificationItem.js | 6 +++--- modules/ui/mw.echo.ui.NotificationItemWidget.js | 4 ++-- tests/qunit/model/test_mw.echo.dm.NotificationItem.js | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/includes/Formatters/EchoFlyoutFormatter.php b/includes/Formatters/EchoFlyoutFormatter.php index ccea0c259..940cab72a 100644 --- a/includes/Formatters/EchoFlyoutFormatter.php +++ b/includes/Formatters/EchoFlyoutFormatter.php @@ -18,7 +18,7 @@ class EchoFlyoutFormatter extends EchoEventFormatter { 'img', [ 'class' => 'mw-echo-icon', - 'src' => $this->getIconURL( $model ), + 'src' => $this->getIconUrl( $model ), ] ); @@ -70,7 +70,7 @@ class EchoFlyoutFormatter extends EchoEventFormatter { ); } - private function getIconURL( EchoEventPresentationModel $model ) { + private function getIconUrl( EchoEventPresentationModel $model ) { return EchoIcon::getUrl( $model->getIconType(), $this->language->getDir() diff --git a/includes/Formatters/SpecialNotificationsFormatter.php b/includes/Formatters/SpecialNotificationsFormatter.php index d0775d5eb..e347dfb20 100644 --- a/includes/Formatters/SpecialNotificationsFormatter.php +++ b/includes/Formatters/SpecialNotificationsFormatter.php @@ -23,7 +23,7 @@ class SpecialNotificationsFormatter extends EchoEventFormatter { 'img', [ 'class' => 'mw-echo-icon', - 'src' => $this->getIconURL( $model ), + 'src' => $this->getIconUrl( $model ), ] ); @@ -112,7 +112,7 @@ class SpecialNotificationsFormatter extends EchoEventFormatter { ); } - private function getIconURL( EchoEventPresentationModel $model ) { + private function getIconUrl( EchoEventPresentationModel $model ) { return EchoIcon::getUrl( $model->getIconType(), $this->language->getDir() diff --git a/modules/controller/mw.echo.Controller.js b/modules/controller/mw.echo.Controller.js index 3aa6449fb..29a801e8f 100644 --- a/modules/controller/mw.echo.Controller.js +++ b/modules/controller/mw.echo.Controller.js @@ -391,7 +391,7 @@ compactHeader: content.compactHeader, body: content.body }, - iconURL: content.iconUrl, + iconUrl: content.iconUrl, iconType: content.icon, primaryUrl: OO.getProp( content.links, 'primary', 'url' ), secondaryUrls: OO.getProp( content.links, 'secondary' ) || [], diff --git a/modules/model/mw.echo.dm.BundleNotificationItem.js b/modules/model/mw.echo.dm.BundleNotificationItem.js index 3d4aba361..86857ac48 100644 --- a/modules/model/mw.echo.dm.BundleNotificationItem.js +++ b/modules/model/mw.echo.dm.BundleNotificationItem.js @@ -29,7 +29,7 @@ // bundled notifications use the compact header and do not have icons bundledNotificationModels.forEach( ( bundled ) => { bundled.content.header = bundled.content.compactHeader; - delete bundled.iconURL; + delete bundled.iconUrl; } ); this.list = new mw.echo.dm.NotificationsList(); diff --git a/modules/model/mw.echo.dm.NotificationItem.js b/modules/model/mw.echo.dm.NotificationItem.js index fa94612c2..4b1a529ec 100644 --- a/modules/model/mw.echo.dm.NotificationItem.js +++ b/modules/model/mw.echo.dm.NotificationItem.js @@ -57,7 +57,7 @@ this.bundled = !!config.bundled; this.source = config.source || ''; this.iconType = config.iconType; - this.iconURL = config.iconURL; + this.iconUrl = config.iconUrl; this.read = !!config.read; this.seen = !!config.seen; @@ -242,8 +242,8 @@ * * @return {string} Notification icon URL */ - mw.echo.dm.NotificationItem.prototype.getIconURL = function () { - return this.iconURL; + mw.echo.dm.NotificationItem.prototype.getIconUrl = function () { + return this.iconUrl; }; /** diff --git a/modules/ui/mw.echo.ui.NotificationItemWidget.js b/modules/ui/mw.echo.ui.NotificationItemWidget.js index cdc2d1605..423b61b36 100644 --- a/modules/ui/mw.echo.ui.NotificationItemWidget.js +++ b/modules/ui/mw.echo.ui.NotificationItemWidget.js @@ -39,7 +39,7 @@ } ); let $icon; - const iconUrl = this.model.getIconURL(); + const iconUrl = this.model.getIconUrl(); // Icon if ( iconUrl ) { // Only invert non colored images @@ -52,7 +52,7 @@ $icon = $( '
' ) .addClass( `mw-echo-ui-notificationItemWidget-icon ${ invertIconClass }` ) .append( $( '' ).attr( { - src: this.model.getIconURL(), + src: this.model.getIconUrl(), role: 'presentation', alt: ' ' } ) ); diff --git a/tests/qunit/model/test_mw.echo.dm.NotificationItem.js b/tests/qunit/model/test_mw.echo.dm.NotificationItem.js index af3d2cca9..7ecc54478 100644 --- a/tests/qunit/model/test_mw.echo.dm.NotificationItem.js +++ b/tests/qunit/model/test_mw.echo.dm.NotificationItem.js @@ -80,7 +80,7 @@ QUnit.module( 'ext.echo.dm - NotificationItem', ( hooks ) => { isBundled: false, getTimestamp: nowFormatted, getPrimaryUrl: undefined, - getIconURL: undefined, + getIconUrl: undefined, getIconType: undefined, getSecondaryUrls: [], getModelName: 'local',