Last modified: 2014-08-21 23:40:59 UTC
In MobileFrontend MobileUserInfo::getLastThanking a query is made to Echo to discover the last 'thank' a user received. Currently this code is messy and needs to know a lot about the existing implementation - e.g. which backend to use and which tables to query. It would be good if a convenience function was instead provided which abstracted all this.
See: bug 56825 and https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/includes/MobileUserInfo.php#L150 for further background
Echo already provides $wgEchoBackend, and you can use ApiEchoNotifications::getNotifications to check a user's notifications. Right now there is no way to query a specific type of notification, is that the specific enhancement request being asked for?
The query actually has some problem for users with large volume of notifications. Imagine a user has 500k notifications and the user has not received any thank notification, the query has to look through all 500k records to find the result. Of course, in reality, most of the users wouldn't have that big number of notifications, I guess this is okay. In theory, this query still has some potential risk. Mobile shouldn't fire a query directly to Echo tables, I agree that the functionality should be abstracted in Echo or Thanks. With that, we could also add some cache support, eg, storing the latest thanks in memcache.
Agreed, mobile shouldn't fire this query directly to Echo and we should never push the existing code to production in the current state. It does seem like a version of getNotifications that allows filtering is what is needed here despite the challenge in the implementation. I would be keen to see such an abstraction.
The WMF core features team tracks this bug on Mingle card https://mingle.corp.wikimedia.org/projects/flow/cards/492, but people from the community are welcome to contribute here and in Gerrit.
Change 137246 had a related patch set uploaded by Legoktm: API: Allow user to specify what notification types they want or don't want https://gerrit.wikimedia.org/r/137246
Change 137246 abandoned by Legoktm: API: Allow user to specify what notification types they want or don't want Reason: Doesn't really make sense after the notification type split I guess. I'm not really sure what direction CPB wanted to go, but it apparently wasn't important for them. https://gerrit.wikimedia.org/r/137246
https://gerrit.wikimedia.org/r/#/c/155663/