mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Added signup_events to the event timeline
refs https://github.com/TryGhost/Team/issues/469 Signup events are captured by status changes with no `from_status`, this means that the member did not have a status (did not exist) before this change.
This commit is contained in:
parent
c8eb50bf57
commit
e003c10e8b
@ -90,6 +90,24 @@ module.exports = class EventRepository {
|
||||
};
|
||||
}
|
||||
|
||||
async getSignupEvents(options = {}) {
|
||||
options.withRelated = ['member'];
|
||||
options.filter = 'from_status:null';
|
||||
const {data: models, meta} = await this._MemberStatusEvent.findPage(options);
|
||||
|
||||
const data = models.map((data) => {
|
||||
return {
|
||||
type: 'signup_event',
|
||||
data: data.toJSON(options)
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
data,
|
||||
meta
|
||||
};
|
||||
}
|
||||
|
||||
async getEventTimeline(options = {}) {
|
||||
if (!options.limit) {
|
||||
options.limit = 10;
|
||||
@ -100,7 +118,8 @@ module.exports = class EventRepository {
|
||||
const allEventPages = await Promise.all([
|
||||
this.getNewsletterSubscriptionEvents(options),
|
||||
this.getSubscriptionEvents(options),
|
||||
this.getLoginEvents(options)
|
||||
this.getLoginEvents(options),
|
||||
this.getSignupEvents(options)
|
||||
]);
|
||||
|
||||
const allEvents = allEventPages.reduce((allEvents, page) => allEvents.concat(page.data), []);
|
||||
|
Loading…
Reference in New Issue
Block a user