All actions performed by a user with Advanced Mobile Contributions mode enabled should be tagged with `advanced mobile edit` tag introduced in T212959.
If possible, all thanks actions in the [[ https://en.wikipedia.org/w/index.php?title=Special:Log&offset=&limit=500&type=thanks&user=&page=&wpdate=&tagfilter= | thanks log ]] should also be marked with `mobile web edit`.
= Acceptance criteria
[] If MobileFrontend is not installed, the code to check for AMC and add the tag dies silently
[] If MobileFrontend is installed and the user is not opted into AMC, no tags are added
[] If MobileFrontend is installed and AMC is enabled and I thank a user, the edit tag is added
[] Any click on the thanks button on MOBILE creates a log entry on https://en.wikipedia.org/wiki/Special:Log which is tagged "mobile edit"
[] Any click on the thanks button on MOBILE AMC creates a log entry on https://en.wikipedia.org/wiki/Special:Log which is tagged "mobile edit" and "advanced mobile contribution".
[] Thanks entries are tagged "mobile edit" and "advanced mobile contribution" as appropriate.
= Developer notes
There is no need to introduce new Hook. The only required change is to publish Thanks Log entries both to RecentChange and UDP (`rcandudp`). The associated RecentChange save will trigger `RecentChangeSave` hook. MobileFrontend already knows how to add tags to the `RecentChangeSave`.
== from Piotr
EDIT: Does not apply any more
I think (Sam/Jon, please correct me if I'm wrong) that the easiest way to implement that in a nice way is to split change into two separate patches (for example I'll use Thanks extension)
1). First, check if the extension, or the MWCore part has a responsible hook for that action, if not, please create a new hook `Hooks::run('HOOKNAME', $tags)`. The {HOOKNAME} should be very descriptive, something like "ExtensionThanksLogEntryTagCreate".
2). in the MobileFrontend add a new hook listener. Add it to extension.json,. method should be located in `includes/amc/Hooks.php`. When hook is executed and current user has amc mode enabled, please add amc tag to the $tags array (it should be passed as reference).
Done, thanks to that, you do not create a hard dependency between Thanks and MobileFrontend, and you tackle the tagging.
There is one more thing, I'd love to pass the whole LogEntry object, not only $tags array, but looks like the common way is to pass references to arrays, I have one more day, I'll check is it ok to push objects (I'm concerned that those objects somehow/somewhere are serialized and thats why we pass scalar types/arrays)
== from Jon
It doesn't look like thanks on mobile are tagged with "mobile edit"
See:
https://en.wikipedia.org/wiki/Special:Log?type=&user=Jdlrobson&page=&wpdate=&tagfilter=&wpfilters%5B%5D=thanks
(I never thank on desktop)
In the Thanks extension the log entry is created at [[ https://github.com/wikimedia/mediawiki-extensions-Thanks/blob/master/includes/ApiThank.php#L69 | ApiThank::logThanks ]]
This is where the new hook must be added and run.
= QA steps
Test on https://en.m.wikipedia.beta.wmflabs.org/wiki/Special:MobileDiff/390159
* Visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=Special:MobileOptions&returnto=Special%3AMobileDiff%2F390159 and opt into advanced mobile mode
* Visit a diff and click "Thanks" in the bottom right corner
e.g. https://en.m.wikipedia.beta.wmflabs.org/wiki/Special:MobileDiff/390159
* Verify you get a message "Username was thanked"
* Verify the log message was tagged correctly at https://en.m.wikipedia.beta.wmflabs.org/wiki/Special:Log?type=&user=&page=&wpdate=&tagfilter=&wpfilters%5B%5D=thanks