Page MenuHomePhabricator

Support language variants in notifications
Closed, ResolvedPublic

Description

Currently the app schedules two local notifications (search sendNotificationWithTitlefor these placements in the codebase):

  1. One is an "edit reverted" notification that it parses from polling and persisting the echo notifications API via RemoteNotificationsController.
  2. The other is an "in the news" notification that is parsed and presented from our standard Explore feed controllers (WMFFeedContentSource.m) if there's a news event.

For edit reverted, we only want to show one notification per wiki language, regardless of variant.
For in the news, we want to show the wiki news notification for every variant the user has selected.

Note for #1, we do have a current bug in main, with variants enabled, when trying to fetch the notifications API. The app is sending in the full variant language code, causing a warning in the API response:

GET https://www.mediawiki.org/w/api.php?action=query&format=json&formatversion=2&meta=notifications&notfilter=!read&notformat=model&notlimit=max&notwikis=enwiki%7Czh_hantwiki%7Csr_ecwiki%7Cwikidatawiki

Response:

{
  "batchcomplete": true,
  "warnings": {
    "notifications": {
      "warnings": "Unrecognized values for parameter \"notwikis\": zh_hantwiki, sr_ecwiki"
    }
  },
  "limits": {
    "notifications": 50
  },
  "query": {
    "notifications": {
      "list": [
        {
          "wiki": "enwiki",
          "id": 193808332,
          "type": "edit-user-talk",
          "category": "edit-user-talk",
          "section": "alert",
          "timestamp": {
            "utciso8601": "2020-06-29T16:31:22Z",
            "utcunix": 1593448282,
            "unix": "1593448282",
            "utcmw": "20200629163122",
            "mw": "20200629163122",
            "date": "29 June"
          },
          ...
}

Event Timeline

Per our meeting, we'll fix this so the API error doesn't occur, but we'll hold off on other UX changes or fixes, as notifications will be the focus of the next release.

Planning dev notes: let's just fix the API error but lean on QA to regression test in the news and edit reverted notifications.

Note for QA: this fixes a couple of errors we were seeing from the notifications API, nothing really user-facing. I think a regression test of notifications (edit reverted and in the news) would be good if possible.

JMinor claimed this task.