1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 13:40:20 +02:00

Change the way we fetch multiple posts by ID

JSON-API specifies that multiple resources should be fetched with a
comma-separated list of IDs, i.e. discussions/1,2,3,4. But this is
problematic because if we do a findQuery with only one ID, then a
single object will come back from the API where the serializer is
expecting an array containing a single object.

Instead, I’ve just implemented an ids “filter” on the discussions index
API route (which is the default way that the adapter finds multiple
IDs.)
This commit is contained in:
Toby Zerner
2015-01-16 17:15:23 +10:30
parent 5e288f55f5
commit abc794c966
3 changed files with 18 additions and 38 deletions

View File

@@ -1,4 +1,5 @@
import JsonApiSerializer from 'ember-json-api/json-api-serializer';
export default JsonApiSerializer.extend({
normalize: function(type, hash, property) {
var json = {};