Skip to content

Commit 19566d5

Browse files
committed
serializers/crate-owner-invite: Fix users side-loading
Previously, the `normalizeResponse()` implementation was throwing away the `users` array in the payload, because of a "missing id" issue (see #3490). The root cause for that however was not that the `id` field in the `user` objects was missing (it actually exists), but that the `modelNameFromPayloadKey()` implementation was unconditionally returning `'crate-owner-invite'` even for `user` payloads. This change fixes the `modelNameFromPayloadKey()` implementation to be compatible with `user` payloads and removes the now obsolete `normalizeResponse()` implementation.
1 parent 71b8f8b commit 19566d5

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

app/serializers/crate-owner-invite.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,12 @@ import ApplicationSerializer from './application';
33
export default class CrateOwnerInviteSerializer extends ApplicationSerializer {
44
primaryKey = 'crate_id';
55

6-
modelNameFromPayloadKey() {
6+
modelNameFromPayloadKey(payloadKey) {
7+
if (payloadKey === 'users') return 'user';
78
return 'crate-owner-invite';
89
}
910

1011
payloadKeyFromModelName() {
1112
return 'crate_owner_invite';
1213
}
13-
14-
normalizeResponse(store, schema, payload, id, requestType) {
15-
if (payload.users) {
16-
delete payload.users;
17-
}
18-
19-
return super.normalizeResponse(store, schema, payload, id, requestType);
20-
}
2114
}

0 commit comments

Comments
 (0)