Page MenuHomePhabricator

add warning for logged out users on new Special:NewLexeme page
Closed, ResolvedPublic5 Estimated Story Points

Description

As an editor I want to see a warning before creating a new Lexeme in case I am not logged in in order to not reveal my IP.

Problem:
The old Special:NewLexeme page showed a warning for logged out users. The new one does not. It should.

Screenshots/mockups:
What it looks like on the old page:

image.png (568×784 px, 83 KB)

BDD
GIVEN a logged out user
WHEN they open the Special:NewLexeme page
THEN they see a warning that their IP will be revealed
AND they can still decide to create the new Lexeme without logging in

Message copy:
"Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to a username, among other benefits."

Acceptance criteria:

  • non-logged-in editors are shown a warning message on the page
  • the warning is placed below the intro sentence at the top
  • ensure requests are indeed sent by logged in user, when logged in, and by anon when not ++

Notes:

  • We should reuse the copy from the old page.
  • The links in the message should be the same links as in the old page

++ By @Michael 's suggestion : the request fails when you're logged out even though you think you're logged in. ( Example: You open the page while logged-in -> no message -> your cookie expires -> you click "create" -> you leaked your IP address )

Event Timeline

Do we want to use the existing message from core (anoneditwarning) or add a Lexeme one for this?

guergana.tzatchkova set the point value for this task to 5.
guergana.tzatchkova added a subscriber: Michael.

Do we want to use the existing message from core (anoneditwarning) or add a Lexeme one for this?

From my side: always reuse unless there is a good reason not to

Task Breakdown Notes:

  • How do we know when someone is logged in but not really logged in when making the request? We can use the assertuser API param when making the request (see: https://www.wikidata.org/w/api.php at the bottom)
  • We can use mw.user.getName() to obtain the user name, or null when the user is anonymous

Potential Plan of Action:

  1. Get the message key through the resource loader into the component
  2. Make sure we have access to the user in the page itself
  3. Display the message depending on whether the user is logged in or not
  4. Send the request to create a new lexeme with the username

Change 818167 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/WikibaseLexeme@master] WIP: Show warning for anonymous users

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

I realize that this might be a bit late to bring it up, but are we sure that we want that warning to be only yet another paragraph in the intro, like on the old page?

In my mind, this was to be highlighted as a message in a yellow warning box, like on an entity page. (But statically in the intro section.)

image.png (149×273 px, 12 KB)

@Lydia_Pintscher What do you think?

And how much space should there be below the warning?

image.png (487×1 px, 97 KB)

And how much space should there be below the warning?

image.png (487×1 px, 97 KB)

I looked at Figma to see if it can answer that question, but I think it’s kind of moot, Figma already specifies some other margins of the adjacent “search for existing” text that we don’t seem to actually have (unless I’m mistaken).

So is that a warning in Wikit terms? (storybook)

Yes, that is the component I had in mind.

I guess with the spacing we can try to take some inspiration from T312652

Change 818167 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/WikibaseLexeme@master] WIP: Show warning for anonymous users

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

Alright, the pull request was merged and this change ^ should be ready now. Looks like this locally:

image.png (498×1 px, 97 KB)

Change 818167 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Show warning for anonymous users

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

Seems to work on https://wikidata.beta.wmflabs.org/wiki/Special:NewLexemeAlpha?debug=2; doesn’t seem to work without ?debug yet, not sure why. Hopefully just Beta weirdness.