Page MenuHomePhabricator

Notifications are not sent when a user mentions another if the signature of the sender contains localized namespaces
Closed, ResolvedPublic

Description

If I remove my custom signature from [[pt:Special:Preferences]], and set my gender to unspecified, I'm able to notify another user by making an edit such as
https://pt.wikipedia.org/w/index.php?diff=36719631
But if I change the gender to Male, the user is not notified when I do a similar edit:
https://pt.wikipedia.org/w/index.php?diff=next&oldid=36719631


Version: master
Severity: major
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=66473
https://bugzilla.wikimedia.org/show_bug.cgi?id=71353

Details

Reference
bz53132

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:04 AM
bzimport added projects: Notifications, I18n.
bzimport set Reference to bz53132.
bzimport added a subscriber: Unknown Object (MLST).

It is also not sent if I use "[[User:" in a custom signature and mention the user again:
https://pt.wikipedia.org/w/index.php?diff=36719696

Using "[[Usuário" in the custom signature link (and keeping gender = male) doesn't work either.

(In reply to comment #2)

Using "[[Usuário" in the custom signature link (and keeping gender = male)
doesn't work either.

Thata was tested here: https://pt.wikipedia.org/w/index.php?diff=next&oldid=36719696

Using "[[Utilizador:" also doesn't send any notification when I edit:
https://pt.wikipedia.org/w/index.php?diff=next&oldid=36719718

I made a more comprehensive set of tests to find out under which circumstances the I'm able to send notifications by mentioning another user:

  • "No gender" makes [[Special:MyPage]] to show the NS alias "Usuário(a)" and:
    • No custom signature: works (this defaults to a signature using "Usuário(a)")
    • Signature using "[[User:": fails
    • Signature using "[[Usuário(a):": works
    • Signature using "[[Usuário:": fails
    • Signature using "[[Usuária:": fails
    • Signature using "[[Utilizador:": fails
  • "Gender = male" makes [[Special:MyPage]] to show the NS alias "Usuário" and:
    • No custom signature: fails
    • Signature using "[[User:": fails
    • Signature using "[[Usuário(a):": works
    • Signature using "[[Usuário:": fails
    • Signature using "[[Usuária:": fails
    • Signature using "[[Utilizador:": fails
  • "Gender = female" makes [[Special:MyPage]] to show the NS alias "Usuária" and:
    • No custom signature: fails
    • Signature using "[[User:": fails
    • Signature using "[[Usuário(a):": works
    • Signature using "[[Usuário:": fails
    • Signature using "[[Usuária:": fails
    • Signature using "[[Utilizador:": fails

FYI: the default file languages/messages/MessagesPt.php[1] has:

$namespaceNames = array(
...
NS_USER => 'Utilizador',
...
);

$namespaceAliases = array(
'Usuário' => NS_USER,
...
);

$namespaceGenderAliases = array(
NS_USER => array( 'male' => 'Utilizador', 'female' => 'Utilizadora' ),
...

);

and currently the file wmf-config/InitialiseSettings.php[2] has the following:

'wgNamespaceAliases' => array(
...
'+ptwiki' => array(

		'Utilizador' => NS_USER,
		...

)
...
)

'wgExtraNamespaces' => array(
...
'ptwiki' => array(

		NS_USER => 'Usuário(a)'
		...

)
...
)

'wgExtraGenderNamespaces' => array(
'default' => array(),
...
'ptwiki' => array(

		NS_USER => array( 'male' => 'Usuário', 'female' => 'Usuária' ),
		...

),
...

)

[1] https://github.com/wikimedia/mediawiki-core/blob/master/languages/messages/MessagesPt.php#L66
[2] https://github.com/wikimedia/operations-mediawiki-config/blob/master/wmf-config/InitialiseSettings.php

On man, this, like, really sucks.

Relevant function is EchoDiscussionParser::getUserFromLine(), which currently only accepts the canonical localized variants of user namespace, user talk namespace and Special:Contributions.

It basically needs an entry for ns 2 and 3 in Language#getNamespaces(), an entry for each namespace 2 and 3 alias listed in Language#getNamespaceAliases(), and all that for both English and content language.

(And probably all aliases for Special:Contributions, too, using SpecialPageFactory::getAliasList().)

Something like this (untested):

static function getUserFromLine( $line, $timestampPos ) {

global $wgContLang;
// Later entries have a higher precedence
// @todo Handle optional whitespace in links
$possiblePrefixes = array();

foreach ( array( $wgContLang, Language::factory( 'en' ) ) as $language ) {
  $nsNames = $language->getNamespaces();
  $possiblePrefixes[] = '[[' . $nsNames[NS_USER] . ':';
  $possiblePrefixes[] = '[[' . $nsNames[NS_USER_TALK] . ':';

  $nsAliases = $language->getNamespaceAliases();
  foreach ( $nsAliases as $text => $id ) {
    if ( $id == NS_USER || $id == NS_USER_TALK ) {
      $possiblePrefixes[] = '[[' . $text . ':';
    }
  }
}

// @todo Handle possible aliases
$possiblePrefixes[] = '[[' . SpecialPage::getTitleFor( 'Contributions' )->getPrefixedText() . '/';

bsitu wrote:

Maybe we should just remove the text pattern match for signature, It's unclear to me why it started with the signature requirement from the first place.

As opposed to just matching on link? I honestly don't know; Kaldari might?

(In reply to comment #9)

Maybe we should just remove the text pattern match for signature, It's
unclear
to me why it started with the signature requirement from the first place.

I believe that would be useful, since it would also make edits such as
https://pt.wikipedia.org/w/index.php?diff=36939646&uselang=en&diffonly=1
to trigger notifications as they should.

Change 87477 had a related patch set uploaded by Legoktm:
Support non-English namespace names in DicussionParser::getUserFromLine

https://gerrit.wikimedia.org/r/87477

(In reply to comment #13)

Change 87477 had a related patch set uploaded by Legoktm:
Support non-English namespace names in DicussionParser::getUserFromLine

https://gerrit.wikimedia.org/r/87477

This is basically MatmaRex's patch fixed up a bit by me.

For the record, given the current usage of customized signatures on Portuguese Wikipedia[0], there are at least 741 users who are not able to use Echo to mention other users, and previous to a change[1] to our [[pt:MediaWiki:Signature]], the number was over 17000 (female users which didn't customize their signature).

[0] https://pt.wikipedia.org/wiki/Project_talk:Notificações#Dados_de_Prefer.C3.AAncias
[1] https://pt.wikipedia.org/w/index.php?diff=36985689&oldid=27625950

Thank you all for bringing this issue to our attention.

My recommendation would be that we remove the requirement that a signature be included before a mention notification is sent, as stated here:

https://www.mediawiki.org/wiki/Echo/Feature_requirements#User_Mention

When we created this feature, we were being very cautious to not over-spam users, which is why we put in some of these restrictions. But I don't think this particular limitation is needed anymore.

I believe this would be an important bug to fix sooner rather than later, given how many folks are impacted by this restriction.

Thank you for flagging this issue!

That would seem to be a Product decision - and one that would involve assigning E2 engineers back to non-critical Echo bugs, to boot - and so Maryana's concern.

Lego/MatmaRex's bug fixes the actual problem here: let's stick with that. If there is a need for a new feature it will both have to wait and have to be approved of/supervised by the Product Manager for the feature.

This also affects signatures with namespaces with spaces replaced with underscores, like [[User_talk:Matma Rex]].

  • Bug 55915 has been marked as a duplicate of this bug. ***

(In reply to comment #16)

My recommendation would be that we remove the requirement that a signature be
included before a mention notification is sent, as stated here:
[...]

Regarding "remove the requirement that a signature be included before a mention notification is sent", which I'm generally in favour of...

I just saw Bug 54639 ("Echo is not triggering notifications when a mention is made while reorganizing comments in the page") which makes me worry that (if the signature-requirement is taken away) mass notifications will be accidentally sent when threads are shuffled/split/merged or archived.

Just worrying out-loud; I might have understood the details incorrectly.

Good point. Luckily I think we could easily avoid that issue by just counting the number of mentions for each user in the old and new wikitext and only sending a notification is the number increased.

Wikifram wrote:

A) I would support the removal of the need to sign a comment before a "ping" works (I wasn't aware of this requirement, and thought that my "ping" remained unanswered until JdForrester nicely explained this to me)

but...

B) I have the habit to archive my talk page by using "copy-paste", I wouldn't want people to get unwanted notifications when I do this though.

I fear that A and B are mutually exclusive requirements...

Change 87477 merged by jenkins-bot:
Support non-English namespace names in DiscussionParser::getUserFromLine

https://gerrit.wikimedia.org/r/87477

I presume this edit https://ja.wiktionary.org/w/index.php?oldid=617213 should have invoked a notification towards [[User:Whym]], but it didn't.

(In reply to comment #24)

I presume this edit https://ja.wiktionary.org/w/index.php?oldid=617213
should
have invoked a notification towards [[User:Whym]], but it didn't.

Confirmed. I've been testing it at jpwikt, and cannot get mention notifications to work. I tried twice with my interface language (for both accounts) set to Japanese, and to English. Neither worked.

Change 108329 had a related patch set uploaded by Whym:
(bug 53132) properly get timestamp position in DiscussionParser

https://gerrit.wikimedia.org/r/108329

(In reply to comment #26)

Change 108329 had a related patch set uploaded by Whym:
(bug 53132) properly get timestamp position in DiscussionParser

https://gerrit.wikimedia.org/r/108329

Just to put this patch in context: unless this patch is applied, the parser takes timestamp substrings instead of timestamp positions. Languages that put the year at the beginning of the timestamp, substrings as "2013" or "2014" were interpret as the "position". This made some vadility checks fail in the code.

Change 108329 had a related patch set uploaded by Legoktm:
Properly get timestamp position in DiscussionParser

https://gerrit.wikimedia.org/r/108329

Change 108329 merged by jenkins-bot:
Properly get timestamp position in DiscussionParser

https://gerrit.wikimedia.org/r/108329

Patch should go out with 1.23wmf12, which will reach the Japanese Wiktionary on February 4th, and all sites by the 6th. See [[wikitech:Deployments]] for all the details.

Closing for now, please re-open if you notice any other issues related to this bug.