Hi, @terrakok, sorry for a late reply.
As you can see, we have different types of actions($.action_name
). We can separate them into groups, and i give you a main idea how.
First of all, lets see whats wrong with an example above. Event must be commended on issue instead of commented on note.
This happens, because $.target_type
is Note. But this only means that target is a Notable (ruby gitlab-ce code) object. And it might be an issue, merge request, snippet, etc.
So, is case of $.target_type
= Note you should get information about what has been noted from $.note.noteable_type
and object id from $.note.noteable_id
/$.note.noteable_iid
.
In example below:
"target_type": "Note",
- this is Notable object"noteable_type": "Issue"
- this is Issue"noteable_id": 377
- Issue id(not iid) is 337{
"title": null,
"project_id": 1,
"action_name": "commented on",
"target_id": 1312,
"target_iid": 1312,
"target_type": "Note",
"author_id": 1,
"data": null,
"target_title": null,
"created_at": "2015-12-04T10:33:58.089Z",
"note": {
"id": 1312,
"body": "What an awesome day!",
"attachment": null,
"author": {
"name": "Dmitriy Zaporozhets",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
"web_url": "http://localhost:3000/root"
},
"created_at": "2015-12-04T10:33:56.698Z",
"system": false,
"noteable_id": 377,
"noteable_type": "Issue",
"noteable_iid": 377
},
"author": {
"name": "Dmitriy Zaporozhets",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
"web_url": "http://localhost:3000/root"
},
"author_username": "root"
}
This can be solved in Android code, as it solved in Rails - with smth like STI but on GSON side (with custom deserializer or other way).