Skip to content

Conversation

@suecarmol
Copy link
Contributor

@suecarmol suecarmol commented Aug 15, 2025

Description

  • Removed the version item in all docker-compose files (the warning was bothering me)
  • Created the send_email_via_api command for other services to send emails from
  • Modified the retrieve_monthly_users command to use the newly created send email command

Caveats from this approach:

  • Rate-limiting handling has not been implemented
  • If TWL users have a different email address from their Wikipedia account, it could be unwelcome to send an email to that address
  • If a TWL user does not have the Allow other users to email me option set in Special:Preferences, then they will not receive an email

Rationale

Our email sending system has issues when sending to certain accounts. This is a possible solution to that problem.

Phabricator Ticket

T383070

How Has This Been Tested?

Tested locally. You can run python manage.py retrieve_monthly_users and change the target parameter to your Wikipedia username.

Screenshots of your changes (if appropriate):

Types of changes

What types of changes does your code introduce? Add an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Minor change (fix a typo, add a translation tag, add section to README, etc.)

Copy link
Contributor

@katydidnot katydidnot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks like a great POC and works as expected, just had some minor nits.

@jsnshrmn
Copy link
Member

Thanks for working on this!

Caveats from this approach:

I don't think these are intrinsic to the approach, just this implementation;

Rate-limiting handling has not been implemented

The need for that will be determined by the account that owns the bot;
It looks like autoconfirmed users aren't rate limited? There's also a specific user right for skipping rate limits: noratelimit
see https://www.mediawiki.org/wiki/Manual:$wgRateLimits
and
https://gerrit.wikimedia.org/r/plugins/gitiles/operations/mediawiki-config/+/refs/heads/master/wmf-config/InitialiseSettings.php#3214

If TWL users have a different email address from their Wikipedia account, it could be unwelcome to send an email to that address
If a TWL user does not have the Allow other users to email me option set in Special:Preferences, then they will not receive an email

I think we can add error handling for these things:

https://www.mediawiki.org/wiki/API:Emailuser#Possible_errors

I would suggest that we implement a warning email in TWLight for users that meet these cases; letting them know that if they want to continue to receive email from us (and participate in partners that require email), they need to change their wiki settings.

We could either just prepend a warning banner template to every email for users that meet these conditions or add account flags to track the issue at login and have a separate command for sending a standalone email to impacted users.

I think this mostly proves out the TWL engineering side of things; I think to close out this task, we get feedback on how to handle the above situations and figure out how we would want / need to do the on-wiki account setup for the bot owner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants