mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-23 18:30:06 +00:00
Repurpose survey call-out in the footer for beta feature invitation
Removing the info popup because we don't have to show a privacy notice when linking within the wiki. This adds a database query to every page view for logged-in users; If78bfc710, once merged, will fix that. Bug: T117669 Change-Id: I8451db34ae8e94264e4921ecd6df6e4b32c7623a
This commit is contained in:
parent
1608a5e6fc
commit
4f7f1a3a09
4
Echo.php
4
Echo.php
|
@ -507,8 +507,8 @@ $wgDefaultUserOptions['echo-show-alert'] = true;
|
|||
// By default, send emails for each notification as they come in
|
||||
$wgDefaultUserOptions['echo-email-frequency'] = 0; /*EchoHooks::EMAIL_IMMEDIATELY*/
|
||||
|
||||
// By default, do not dismiss the feedback alert
|
||||
$wgDefaultUserOptions['echo-dismiss-feedback-alert' ] = 0;
|
||||
// By default, do not dismiss the beta feature invitation
|
||||
$wgDefaultUserOptions['echo-dismiss-beta-invitation' ] = 0;
|
||||
|
||||
if ( $wgAllowHTMLEmail ) {
|
||||
$wgDefaultUserOptions['echo-email-format'] = 'html'; /*EchoHooks::EMAIL_FORMAT_HTML*/
|
||||
|
|
19
Hooks.php
19
Hooks.php
|
@ -420,7 +420,7 @@ class EchoHooks {
|
|||
}
|
||||
|
||||
if ( $wgEchoShowFooterNotice ) {
|
||||
$preferences['echo-dismiss-feedback-alert'] = array(
|
||||
$preferences['echo-dismiss-beta-invitation'] = array(
|
||||
'type' => 'api',
|
||||
);
|
||||
}
|
||||
|
@ -752,7 +752,7 @@ class EchoHooks {
|
|||
* @return bool true in all cases
|
||||
*/
|
||||
static function onPersonalUrls( &$personal_urls, &$title, $sk ) {
|
||||
global $wgEchoNewMsgAlert;
|
||||
global $wgEchoNewMsgAlert, $wgEchoShowFooterNotice;
|
||||
$user = $sk->getUser();
|
||||
if ( $user->isAnon() ) {
|
||||
return true;
|
||||
|
@ -815,6 +815,18 @@ class EchoHooks {
|
|||
'message' => $seenMsgTime
|
||||
) );
|
||||
|
||||
if (
|
||||
$wgEchoShowFooterNotice &&
|
||||
!$user->getOption( 'echo-cross-wiki-notifications' ) &&
|
||||
!$user->getOption( 'echo-dismiss-beta-invitation' )
|
||||
) {
|
||||
$unreadWikis = EchoUnreadWikis::newFromUser( $user );
|
||||
$counts = $unreadWikis->getUnreadCounts();
|
||||
if ( count( $counts ) > 1 ) {
|
||||
$sk->getOutput()->addJsConfigVars( 'wgEchoShowBetaInvitation', true );
|
||||
}
|
||||
}
|
||||
|
||||
$msgText = EchoNotificationController::formatNotificationCount( $msgCount );
|
||||
$alertText = EchoNotificationController::formatNotificationCount( $alertCount );
|
||||
|
||||
|
@ -1229,10 +1241,9 @@ class EchoHooks {
|
|||
}
|
||||
|
||||
public static function onResourceLoaderGetConfigVars( &$vars ) {
|
||||
global $wgEchoShowFooterNotice, $wgEchoFooterNoticeURL;
|
||||
global $wgEchoFooterNoticeURL;
|
||||
|
||||
$vars['wgEchoMaxNotificationCount'] = MWEchoNotifUser::MAX_BADGE_COUNT;
|
||||
$vars['wgEchoShowFooterNotice'] = $wgEchoShowFooterNotice;
|
||||
$vars['wgEchoFooterNoticeURL'] = $wgEchoFooterNoticeURL;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -52,6 +52,13 @@ $wgResourceModules += array(
|
|||
'dependencies' => array(
|
||||
'ext.echo.ui',
|
||||
'ext.echo.styles.badge',
|
||||
'mediawiki.util',
|
||||
),
|
||||
'messages' => array(
|
||||
'echo-popup-footer-beta-invitation',
|
||||
'echo-popup-footer-beta-invitation-link',
|
||||
// echo-popup-footer-beta-invitation uses this message with {{int:}}:
|
||||
'echo-pref-beta-feature-cross-wiki-message',
|
||||
),
|
||||
'targets' => array( 'desktop' ),
|
||||
),
|
||||
|
@ -119,9 +126,6 @@ $wgResourceModules += array(
|
|||
'echo-notification-message',
|
||||
'echo-notification-loginrequired',
|
||||
'echo-notification-popup-loginrequired',
|
||||
'echo-popup-footer-feedback',
|
||||
'echo-popup-footer-feedback-survey',
|
||||
'echo-popup-footer-feedback-info',
|
||||
'notification-link-text-collapse-all',
|
||||
"notification-link-text-expand-alert-count",
|
||||
"notification-link-text-expand-message-count",
|
||||
|
|
|
@ -96,9 +96,8 @@
|
|||
"echo-none": "You have no notifications.",
|
||||
"echo-more-info": "More info",
|
||||
"echo-feedback": "Feedback",
|
||||
"echo-popup-footer-feedback": "<strong>Provide feedback</strong>. [$2 $1]",
|
||||
"echo-popup-footer-feedback-survey": "Take this quick survey about notifications.",
|
||||
"echo-popup-footer-feedback-info": "This feedback link is designed to help the developers learn more about how people use Notifications so we continue to improve the tool. Clicking the survey link will send you to a third-party website.",
|
||||
"echo-popup-footer-beta-invitation": "<strong>Get notifications from other wikis here</strong>. [$2 $1]",
|
||||
"echo-popup-footer-beta-invitation-link": "Try the \"{{int:echo-pref-beta-feature-cross-wiki-message}}\" beta feature.",
|
||||
"echo-quotation-marks": "\"$1\"",
|
||||
"echo-api-failure": "Could not retrieve notifications. Please try again. (Error $1)",
|
||||
"echo-api-failure-cross-wiki": "Access to the remote domain was denied.",
|
||||
|
|
|
@ -87,9 +87,8 @@
|
|||
"echo-none": "Message shown to users who have no notifications. Also shown in the overlay.",
|
||||
"echo-more-info": "This is used for the title (mouseover text) of an icon that links to a page with more information about the Echo extension.\n{{Identical|More information}}",
|
||||
"echo-feedback": "Text for a link that goes to a feedback survey shown at [[Special:Notifications]].\n{{Identical|Feedback}}",
|
||||
"echo-popup-footer-feedback": "Text introducing the feedback link in a feedback alert in the notifications popup.\n\nParameters:\n* $1 - Text of the feedback link.\n* $2 - Link for the specific feedback.",
|
||||
"echo-popup-footer-feedback-survey": "Text introducing the survey feedback link itself in the feedback alert in the notification popup.",
|
||||
"echo-popup-footer-feedback-info": "Text for the popup that shows on hover over the info icon in the notification popup feedback alert.",
|
||||
"echo-popup-footer-beta-invitation": "Text inviting the user to enable the cross-wiki notifications beta feature, displayed at the bottom of the notifications popup.\n\nParameters:\n* $1 - Text of the link ({{msg-mw|echo-popup-footer-beta-invitation-link}}).\n* $2 - URL of the link (beta features section of Special:Preferences).",
|
||||
"echo-popup-footer-beta-invitation-link": "Text for the link in {{msg-mw|echo-popup-footer-beta-invitation}}.",
|
||||
"echo-quotation-marks": "Unused at this time.\n\n{{optional}}\nPuts the edit summary in quotation marks. Only translate if different than English.\n\nParameters:\n* $1 - ...",
|
||||
"echo-api-failure": "Label for the text that notes an error in retrieving notifications for the Echo popup.\n$1 - The api error code.",
|
||||
"echo-api-failure-cross-wiki": "Label for the api failure text for a failure to fetch cross-wiki notifications, but the remote server is not granted access.",
|
||||
|
|
|
@ -41,7 +41,7 @@ class ApiEchoNotifications extends ApiQueryBase {
|
|||
);
|
||||
}
|
||||
|
||||
$this->foreignNotifications = new EchoForeignNotifications( $this->getUser() );
|
||||
$this->foreignNotifications = new EchoForeignNotifications( $user );
|
||||
$this->crossWikiSummary = $params['crosswikisummary'];
|
||||
|
||||
$result = array();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* @cfg {string} [url] The URL for the survey
|
||||
*/
|
||||
mw.echo.ui.FooterNoticeWidget = function MwEchoUiFooterNoticeWidget( config ) {
|
||||
var $icon, label, dismissButton, infoPopup,
|
||||
var $icon, label, dismissButton,
|
||||
$row = $( '<div>' )
|
||||
.addClass( 'mw-echo-ui-footerNoticeWidget-row' );
|
||||
|
||||
|
@ -30,9 +30,9 @@
|
|||
|
||||
label = new OO.ui.LabelWidget( {
|
||||
label: $( '<span>' ).append(
|
||||
mw.message( 'echo-popup-footer-feedback',
|
||||
mw.message( 'echo-popup-footer-beta-invitation',
|
||||
// Text
|
||||
mw.msg( 'echo-popup-footer-feedback-survey' ),
|
||||
mw.msg( 'echo-popup-footer-beta-invitation-link' ),
|
||||
// Link
|
||||
config.url
|
||||
).parse()
|
||||
|
@ -46,26 +46,6 @@
|
|||
classes: [ 'mw-echo-ui-footerNoticeWidget-dismiss' ]
|
||||
} );
|
||||
|
||||
infoPopup = new OO.ui.PopupButtonWidget( {
|
||||
classes: [ 'mw-echo-ui-footerNoticeWidget-info' ],
|
||||
framed: false,
|
||||
icon: 'help',
|
||||
popup: {
|
||||
align: 'backwards',
|
||||
$content: $( '<p>' ).text( mw.msg( 'echo-popup-footer-feedback-info' ) ),
|
||||
padded: true,
|
||||
width: 450
|
||||
}
|
||||
} );
|
||||
infoPopup.$element.hover(
|
||||
function () {
|
||||
infoPopup.getPopup().toggle( true );
|
||||
},
|
||||
function () {
|
||||
infoPopup.getPopup().toggle( false );
|
||||
}
|
||||
);
|
||||
|
||||
// Events
|
||||
dismissButton.connect( this, { click: 'onDismissButtonClick' } );
|
||||
|
||||
|
@ -75,7 +55,6 @@
|
|||
$row
|
||||
.append(
|
||||
label.$element,
|
||||
infoPopup.$element,
|
||||
dismissButton.$element
|
||||
)
|
||||
);
|
||||
|
|
|
@ -108,15 +108,13 @@
|
|||
initialNotifCount = mw.config.get( 'wgEchoInitialNotifCount' );
|
||||
initialNotifCount = this.type === 'all' ? ( initialNotifCount.alert + initialNotifCount.message ) : initialNotifCount[ this.type ];
|
||||
if (
|
||||
mw.config.get( 'wgEchoShowFooterNotice' ) &&
|
||||
!mw.user.options.get( 'echo-dismiss-feedback-alert' ) &&
|
||||
initialNotifCount >= 1 &&
|
||||
mw.config.get( 'wgUserEditCount', 0 ) >= 100
|
||||
mw.config.get( 'wgEchoShowBetaInvitation' ) &&
|
||||
!mw.user.options.get( 'echo-dismiss-beta-invitation' )
|
||||
) {
|
||||
notice = new mw.echo.ui.FooterNoticeWidget( {
|
||||
// This is probably not the right way of doing this
|
||||
iconUrl: mw.config.get( 'wgExtensionAssetsPath' ) + '/Echo/modules/icons/feedback.svg',
|
||||
url: mw.config.get( 'wgEchoFooterNoticeURL' )
|
||||
url: mw.util.getUrl( 'Special:Preferences' ) + '#mw-prefsection-betafeatures'
|
||||
} );
|
||||
// Event
|
||||
notice.connect( this, { dismiss: 'onFooterNoticeDismiss' } );
|
||||
|
@ -214,9 +212,9 @@
|
|||
this.popup.clip();
|
||||
|
||||
// Save the preference in general
|
||||
new mw.Api().saveOption( 'echo-dismiss-feedback-alert', 1 );
|
||||
new mw.Api().saveOption( 'echo-dismiss-beta-invitation', 1 );
|
||||
// Save the preference for this session
|
||||
mw.user.options.set( 'echo-dismiss-feedback-alert', 1 );
|
||||
mw.user.options.set( 'echo-dismiss-beta-invitation', 1 );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue