(I just had my morning coffee and I think I started going into too many details due to this, sorry for that ;))
A:
The getNumberOfTasks
method is used only to assess how much of the progress bar to allocate for the given handler - even if it returns 0, Jira will still call the update
method.
As such, I would say that if myService.doesSomethingForUserExist
returns very fast (e.g. it reads everything from caches) it makes sense to use it, but if it has to go to the database, it’s probably easier (and more performant) to just hardcode 1
.
As for us, in some cases we opted for returning the exact number of entries we will update (mostly for handlers that will update thousands of entities or ones that need to reindex some values) and in others, we simply return a hardcoded number (when the handler is doing trivial tasks that will finish in milliseconds and there’s no point in allocating it a visible part of the progress bar).
B:
When an admin selects the option to anonymize a user, we will show them a new UI page containing a summary of what will happen before they start the actual operation.
This page will contain a few sections (this will be removed, this will be updated, this you might have to check manually, etc.) that will basically be lists/tables containing the data collected from collecting those AffectedEntity
objects.
As such, those items are groups of objects that the handler will update, e.g. there might be an AffectedEntity
called “Issue comments” with some bigger number of occurrences (instead of actually returning thousands of separate objects, one per every comment).
The example you provided is perfectly fine, as it will be informative for the administrator.
The descriptionKey is an i18n entry, and you might provide translations if you want to, although we are not forcing this now.
C:
We do not currently plan to provide such feature - user key is an internal representation that shouldn’t leak to the UI (although it does sometimes ), an should be as immutable as it can be.
Unfortunately, we have to touch it during the anonymization, as prior to Jira 8.4 it is generated based on the username, and as such often contains personal data.