Page MenuHomePhabricator

Notify users when their user group membership is about to expire, or has expired
Closed, ResolvedPublic8 Estimated Story Points

Description

Currently, as part of the manual permission expiry process, a notification template is posted to a user's talk page "a few days" before their rights are removed.

When this functionality is available in core MediaWiki, it would be nice to provide users with a notification that their rights are soon to expire. Possibly a week before expiry, or a day before if the rights were assigned for less than two weeks. It would also be nice to send a notification when the rights finally expire.

Basic information

  - Purpose of the notification:  Provide users with notice that their membership of a user group/groups are about to expire/have expired, giving them the opportunity to start a community discussion to have their rights renewed, or just acting as a courtesy notification.
  - Notification name:  user-rights or user-rights-expiry (not sure if it needs to be separate from existing user-rights notification)
  - What triggers notification?: The notifications would have to be timed, rather than being created reactively. See my comment below.
  - "Notice" or "Alert"?:  Alert (?)
  - Notification type (standard, bundled, expandable bundle):  Standard

Wording

For a single message

  • Header: Your user rights [are about to expire/have expired]
  • Body: Your sysop and bureaucrat permissions [will expire on DATE/have expired].

For Bundled Messages

  • Main, bundling message: Don't think we need bundling.
  • Subsidiary, bundled message:

Links

  - Primary link target: Not sure. The existing user-rights notification points to Special:ListGroupRights, which is a pretty silly target. Personally I don't think user rights notifications need any target at all.
  - Primary link label (for email display only):

  - #1 secondary link target: Log entry where the expiring user groups were assigned (see UserRightsPresentationModel::getLogLink())
  - #1 secondary link label: User rights log

  - #2 secondary link target:
  - #2 secondary link label:

Icon

  - Icon name:  user-rights

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Should be doable, but maybe not as trivial as you might think:

Even sending a notification at the moment when the rights expire isn't possible, since the expiry is a passive thing (a certain DB condition ug_expiry < wfTimestampNow() no longer evaluating to true) that doesn't actually "happen" and can't be hooked.

It would be simple enough though to do this using a cronjob in Echo. I proposed a solution at T156808: Back-end infrastructure for timed notifications in Echo, which ought to be relatively simple to implement.

As I commented at T159416, "This is a nice-to-have sort of thing that I am definitely going to keep pushing for, but it doesn't seem like a critical ingredient to me", so I don't think we ought to consider it a blocker. Particularly because I've made assurances that expiring user groups will be enabled before MW 1.29 goes out so we can get rid of the feature flag. Otherwise we could be sitting here for a very long time.

@TTO: What about sending notifications from UserGroupMembership::purgeExpired()? They might be slightly late, but better late than never, right?

@TTO: What about sending notifications from UserGroupMembership::purgeExpired()? They might be slightly late, but better late than never, right?

purgeExpired() is only called when a user group is added or removed. One of the main audiences for the user group expiry feature is small wikis, where the user rights interface might be used as infrequently as once or twice a year, so you could be waiting a very long time for that notification...

Hmm, perhaps purgeExpired() could be called by something that happens more frequently, or even by an automated daily maintenance script (similar to purgeUnusedProjects.php). The downside of relying on an automated maintenance script is that it wouldn't be very convenient for 3rd party wikis. The other option, creating a delayed Echo notification, is also problematic though, as you would need to track down and update or replace the delayed notifications every time you changed the expiration.

Hmm, perhaps purgeExpired() could be called by something that happens more frequently, or even by an automated daily maintenance script (similar to purgeUnusedProjects.php).

Possibly. But this doesn't solve the issue of raising a notification when rights are about to expire, which would be useful to have in the context of the temporary user right process on Meta. In fact that is possibly more important than the notification when the rights actually expire, because it gives users time to start a community discussion to renew their rights. You wouldn't want to hack that into purgeExpired, would you?

The other option, creating a delayed Echo notification, is also problematic though, as you would need to track down and update or replace the delayed notifications every time you changed the expiration.

I don't think it would be insurmountably difficult. You could simply look for a delayed notification with a matching notification type, user, and group.

I think a maintenance script should be the way to go. It would send pre-expiry notifications immediately and enqueue timed jobs for rights expiring within next 24 hours. No complex future notification search and deletion is needed as long as jobs verify that user right parameters are still the same.

Next question: what to do if the right was assigned from Meta? It would not be reflected in local user rights log thus we will be leading people to empty or misleading logs.

Next question: what to do if the right was assigned from Meta? It would not be reflected in local user rights log thus we will be leading people to empty or misleading logs.

In fact, from testing on the Beta cluster, it seems that no Echo notifications are issued at all for cross-wiki rights changes... This is T53540: Support cross-wiki rights change notification in Echo

Change 350500 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/extensions/Echo@master] WIP: Add user right expiry notifications

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

Change 350961 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/core@master] Automatically purge expired user groups

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

Change 350961 abandoned by MaxSem:
Automatically purge expired user groups

Reason:
Discussed with Aaron in person, going in a different direction.

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

kaldari set the point value for this task to 8.Jun 5 2017, 10:32 PM
kaldari changed the task status from Open to Stalled.Jul 20 2017, 8:09 PM

Currently stalled, pending T168107/T156808.

Change 350500 abandoned by MaxSem:
Add user right expiry notifications

Reason:
Not working on this.

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

@TTO, a small point: I notice you have not defined a defined a Primary Link Target. But you do have a Secondary Link Target. To clarify, the Primary Link is where the user goes if she just clicks on the notification body. The secondary links are the little, explicit links/labels underneath the message body.

If I might make a suggestion: perhaps it would make sense to just make the current Secondary Link ("Log entry where the expiring user groups were assigned...") the Primary, and not have a Secondary.

Screen Shot 2018-10-01 at 10.14.02 AM.png (498×177 px, 34 KB)

If the notifications can be provided after groups have expired:
Add a hook to UserGroupExpiryJob called before the expired rights are removed
Extension (echo) checks what groups are expired, and adds notifications
Core removes the expired groups

For what's worth, T370842 does this now (have been busy applying for authorisation on various projects, and already running on a few projects). I'm not sure how important this task itself is as a result.

I think T370842 makes this redundant (enabled on like 80+ wikis). The only reason why I'm not making it as complete at the moment is that the bot doesn't have global bot status.

A_smart_kitten subscribed.

(adding MediaWiki-User-management for visibility)

I think T370842 makes this redundant (enabled on like 80+ wikis). The only reason why I'm not making it as complete at the moment is that the bot doesn't have global bot status.

I wouldn't necessarily say it makes this task redundant myself - one reason being, Leaderbot's global reminder bot task is enabled on many Wikimedia wikis; however, as the functionality requested in this task hasn't been added to the software itself, third-party wikis won't yet have access to it.

Change #1232792 had a related patch set uploaded (by Neriah; author: Neriah):

[mediawiki/core@master] UserGroupManager: call UserGroupsChanged for expired memberships

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

Change #1232793 had a related patch set uploaded (by Neriah; author: Neriah):

[mediawiki/extensions/Echo@master] Echo: notify users when temporary rights expire

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

neriah changed the task status from Stalled to In Progress.Feb 10 2026, 3:36 PM
neriah raised the priority of this task from Low to Medium.

(seems worth an entry in tech-news once merged/deployed :))

Change #1232792 merged by jenkins-bot:

[mediawiki/core@master] UserGroupManager: call UserGroupsChanged for expired memberships

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

@A_smart_kitten @neriah

I got notified that this has been merged. Should it be put in tech news, being distributed on 20 April? How should I word the entry?

(seems worth an entry in tech-news once merged/deployed :))

@STei-WMF Apologies, I probably should have been clearer in my initial comment regarding Tech/News - I believe that there are/were two patches that have to be merged for this to be complete, & the patch to ext:Echo is still open. Once that patch has also been merged, I believe we should be ready for an entry :)

I will start thinking of some potential wordings, though. (@neriah, any thoughts?)

Yes, the notification should arrive after the second change is merged.

I will start thinking of some potential wordings, though. (@neriah, any thoughts?)

Is there anything specific we should report? For example, should we explain that during peak hours, some time may pass between when the permission actually expires and when the notification is received?

Seems like this may make https://meta.wikimedia.org/wiki/Global_reminder_bot no longer needed

I believe that you are right. However, it is possible that for certain permissions there is still benefit in an update a week before the expiration of the permission, for example for ipblock-exempt, for which users can certainly benefit from an early notification. Perhaps it will be possible to disable it by default, and to enable it only on wikis that will request to renew this. @Leaderboard

Change #1232793 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Echo: notify users when temporary rights expire

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

@neriah Sorry seeing this only now. I've been thinking about the impact of this feature. My feeling is that

  • many wikis will still find the ability to get email notifications helpful as many wikis require users to submit applications early on (eg for temp sysop) + many people won't see Echo notifications
  • but I can see where you're coming from. and think that this will be on a wiki-by-wiki basis. I expect most wikis to continue using the bot.

Any wiki that does not want the bot can simply turn it off themselves (by going to https://meta.wikimedia.org/wiki/Global_reminder_bot/global). Wikis can also use their individual configuration files to selectively enable/disable the bot for specific rights as they see fit.

I plan to update Tech News when I see it; do ping me on my talk page if I miss it.

(removing T156808: Back-end infrastructure for timed notifications in Echo as a subtask; it seems like the implementation of this that was merged didn't need that task to be completed first)


How should I word the entry?

I guess my first draft (based partially on T3876#8744758, which was announced in 2023/15) might be something like:

Users can now receive a notification when their temporary membership in a user-group expires.

...though I'm probably not be the best person at wording good announcements :)
I also don't know whether this on its own would/wouldn't provide sufficient context/information. @STei-WMF do you have any thoughts/input on this from a comms perspective?

One thing to note, though, is that (IIUC) this change won't take effect on Wikimedia wikis until after next week's deployment train, as there isn't a train this week. Therefore, maybe this announcement should be made in the Tech/News issue that gets sent out on 4 May (ie., two weeks from yesterday), so that it's fully-deployed by the time this announcement is made.

As a side-note -- it occurs to me that we might also want to document this new notification-type somewhere; e.g. maybe at https://www.mediawiki.org/wiki/Help:Notifications/Types?

[...] should we explain that during peak hours, some time may pass between when the permission actually expires and when the notification is received?

Hmm, not sure. My first instinct might be to leave this detail out of the notification -- I guess I'd hope (without knowing much about the underlying code) that e.g. it might not be applicable/noticeable in most situations. Other views welcome, though :)