Wikimedia Apps/Team/Android/PatrollerTasksDevNote

“Patroller tasks” is a task under the Suggested Edits feature, which allows patrollers to review and manage recent changes.

To enable the feature

edit
  1. Add the Test language as your primary language.
  2. The account you have logged in has the rollback right or is in the sysop user group. If not, please visit https://test.wikipedia.org/wiki/Wikipedia:Requests/Permissions for more information.

Onboarding

edit

Inherited from the OnboardingFragment and added one customized view for one of the onboarding screens. We will check the event logging preference before showing the last opt-in data collection screen of onboarding or not.

List of edits

edit

It has almost the same layout as the ones in the Watchlist, Notification, and Contributions.

  • Use PagingSource to request the API for every 50 edits.
  • Make API calls and filter conditions methods into statics objects to make sure the filter conditions are the same in the Diff screen.
  • Add a new customized dialog for displaying real-time user information.

Filters

edit

Currently, we are hiding the “Wiki language” section and the feature will be based on the app’s primary language.

User registration and experience

edit

Multiple choice, which allows users to see edits from unregistered users and registered users.

User experience conditions:

  1. Skip when only “UNREGISTERED” is selected.
  2. In the Enum class, the experience types are defined below
    // The format for the number is: min edit number, max edit number | min registration date, max registration date
    NEWCOMERS("newcomers", "0,10|0,4")
    LEARNERS("learners", "10,500|4,30")
    EXPERIENCED_USERS("experiencedUsers", "500,-1|30,-1")
    
  3. Pick the qualified user and return the value by the following criteria:
    qualifiedUser = if (requiredMaxEdits == -1 && requiredMaxLength == -1L) { // Experienced users
    	editsCount >= requiredMinEdits && diffDays >= requiredMinLength
    } else if (requiredMinEdits == 0 && requiredMinLength == 0L) { // Newcomers
    	editsCount in requiredMinEdits..requiredMaxEdits && diffDays in requiredMinLength..requiredMaxLength
    } else { // Learners
    	true
    }
    
    // Please note that the “Learners” is the editor between experienced users and newcomers, so no specific logic is needed.
    


User registration conditions

  1. Skip the following condition when: both anon and non-anon are selected, or anon and any of user experiences is selected.
  2. Filter anon items when only "UNREGISTERED" is selected and return the result.
  3. Filter non-anon items. E.g. "REGISTERED" or any user experiences are selected and return the result.
edit

The filter uses the following code as the ORES filter reference: https://github.com/wikimedia/mediawiki-extensions-ORES/blob/master/extension.json#L201-L232C28

The API will return both true and false, and the following logic checks the value from true.

DAMAGING_GOOD("damagingGood", "0|0.149"),
DAMAGING_MAY_PROBLEMS("damagingMayProblems", "0.149|0.629"),
DAMAGING_LIKELY_PROBLEMS("damagingLikelyProblems", "0.629|0.944"),
DAMAGING_VERY_LIKELY_PROBLEMS("damagingBad", "0.944|1"),

GOODFAITH_GOOD("goodfaithGood", "0.75|1"),
GOODFAITH_MAY_PROBLEMS("goodfaithMayProblems", "0.647|0.75"),
GOODFAITH_LIKELY_PROBLEMS("goodfaithLikelyProblems", "0.25|0.647"),
GOODFAITH_VERY_LIKELY_PROBLEMS("goodfaithBad", "0|0.25");

The method will return the data if its ORES scores from the API fit in the range from above.

Criteria

edit

The rest filter options will be put into the rcshow parameter, which the rcshow cannot accept both positive and negative at the same time. For example, sending anon|!anon will return an error message from the API.

Patrol edit

edit

It has the same interface as the present one, by adding the Damage and Intent chip buttons, and also the “Warn” function to the bottom navigation. Additionally, this screen is added to the SuggestedEditsVandalismPatrolFragment, which the SuggestedEditsVandalismPatrolFragment is a child fragment of SuggestedEditsCardsFragment, which supports the swipe gesture. This screen will use the static methods that have been used in the List of edits to fetch endpoints for the Diff contents to make sure the data is consistent.

Warn and templates

edit

The warn function reuses the TalkReplyActivity in the app, and it comes with multiple conditions such as showing the template selector and an entry for managing templates.

The manage templates function implemented the RecyclerView with swipeable and long-pressable actions, and the data is saved in the local database.

Analytics

edit

Since we are reusing multiple screens in the feature, having a special logic check before sending events is necessary. In most of the cases, it is required to check viewModel.isFromDiff or viewModel.fromRecentEdits before sending data.