Page MenuHomePhabricator

AJAXPoll does not support temporary accounts
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Add the following to your LocalSettings.php:
$wgGroupPermissions['*']['ajaxpoll-vote'] = true;
  • Make sure temporary accounts are enabled on your wiki
  • Try to vote on a poll while not being logged in

What happens?:

The API returns an error:

{
  "error": {
    "code": "internal_api_error_MediaWiki\\Exception\\CannotCreateActorException",
    "info": "[38894581d108cd154f3505db] Exception caught: Cannot create an actor for an IP user when temporary accounts are enabled",
    "errorclass": "MediaWiki\\Exception\\CannotCreateActorException",
    "*": "MediaWiki\\Exception\\CannotCreateActorException at /var/www/html/w/includes/User/ActorStore.php(600)\nfrom /var/www/html/w/includes/User/ActorStore.php(600)\n#0 /var/www/html/w/includes/User/ActorStore.php(372): MediaWiki\\User\\ActorStore->validateActorForInsertion()\n#1 /var/www/html/w/extensions/AJAXPoll/includes/AJAXPoll.php(212): MediaWiki\\User\\ActorStore->acquireActorId()\n#2 /var/www/html/w/extensions/AJAXPoll/includes/api/ApiAJAXPollSubmitVote.php(37): AJAXPoll::submitVote()\n#3 /var/www/html/w/includes/Api/ApiMain.php(2059): ApiAJAXPollSubmitVote->execute()\n#4 /var/www/html/w/includes/Api/ApiMain.php(964): MediaWiki\\Api\\ApiMain->executeAction()\n#5 /var/www/html/w/includes/Api/ApiMain.php(935): MediaWiki\\Api\\ApiMain->executeActionWithErrorHandling()\n#6 /var/www/html/w/includes/Api/ApiEntryPoint.php(138): MediaWiki\\Api\\ApiMain->execute()\n#7 /var/www/html/w/includes/MediaWikiEntryPoint.php(180): MediaWiki\\Api\\ApiEntryPoint->execute()\n#8 /var/www/html/w/api.php(30): MediaWiki\\MediaWikiEntryPoint->run()\n#9 {main}"
  },
  "servedby": "f7d70f476ac2"
}

What should have happened instead?:

The API should not error, but instead, a temporary account should be created for the user.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

MW: 1.46.0-alpha (83f4ac2)
AJAXPoll: 2.3 (d88a450)

Other information (browser name/version, screenshots, etc.):

Event Timeline

I'm not sure whether it's feasible to create a temp account when a user votes, maybe we should instead just disallow anons from voting completely (even when the permissions are configured to allow it)? cc @ashley as a maintainer

I'm not sure whether it's feasible to create a temp account when a user votes, maybe we should instead just disallow anons from voting completely (even when the permissions are configured to allow it)? cc @ashley as a maintainer

Seems reasonable to me; go for it! 👍

SomeRandomDeveloper moved this task from Backlog to Later on the User-SomeRandomDeveloper board.

I didn't have the time yet to submit a patch for this task, but I probably will eventually. Not claiming for now in case somebody else wants to