mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
🐛 Fixed create and update user methods to account for created_at and subscribed fields
refs https://github.com/TryGhost/Ghost/issues/12156
- During the refactor - 117309b4e8 (diff-3daeef67d07a2a0f94c89a86cafcede9R44)
, `subscribed` and `created_at` fields have been overlooked. All fields accepted by Ghost's `POST /members` and `PUT /members/:id` should be supported
This commit is contained in:
parent
56b9f4d350
commit
30f758e297
@ -33,6 +33,7 @@ module.exports = function ({
|
|||||||
'email',
|
'email',
|
||||||
'name',
|
'name',
|
||||||
'note',
|
'note',
|
||||||
|
'subscribed',
|
||||||
'labels',
|
'labels',
|
||||||
'geolocation'
|
'geolocation'
|
||||||
]), options);
|
]), options);
|
||||||
@ -42,7 +43,9 @@ module.exports = function ({
|
|||||||
return Member.findPage(options);
|
return Member.findPage(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function create({email, name, note, labels, geolocation}, options) {
|
async function create(data, options) {
|
||||||
|
const {email, labels} = data;
|
||||||
|
|
||||||
debug(`create email:${email}`);
|
debug(`create email:${email}`);
|
||||||
|
|
||||||
/** Member.add model method expects label object array*/
|
/** Member.add model method expects label object array*/
|
||||||
@ -54,13 +57,17 @@ module.exports = function ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return Member.add({
|
return Member.add(Object.assign(
|
||||||
email,
|
{},
|
||||||
name,
|
{labels},
|
||||||
note,
|
_.pick(data, [
|
||||||
labels,
|
'email',
|
||||||
geolocation
|
'name',
|
||||||
}, options);
|
'note',
|
||||||
|
'subscribed',
|
||||||
|
'geolocation',
|
||||||
|
'created_at'
|
||||||
|
])), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function safeStripe(methodName) {
|
function safeStripe(methodName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user